MartialBE / one-hub

OpenAI 接口管理 & 分发系统,改自songquanpeng/one-api。支持更多模型,加入统计页面,完善非openai模型的函数调用。
https://one-api-martialbe.vercel.app/
Apache License 2.0
952 stars 194 forks source link

你好,MJ绘图的中转能增加支持么? #127

Closed iceiccy closed 2 months ago

iceiccy commented 5 months ago

例行检查

功能描述 请问如果不走MJ的后端开发,直接走中转的话,通过代理地址和API,直接做二包再中转给别人,这个好弄么? 应用场景

MartialBE commented 5 months ago

可是可以,但我没mj帐号,无法测试

woodchen-ink commented 5 months ago

可是可以,但我没mj帐号,无法测试

俺也没有, 难搞, 让愿意提供的发你邮箱😏

iceiccy commented 5 months ago

我有中转,只是测试中转可以么?毕竟那个MJ项目本身就支持创建API,跟使用别人的API中转不是一码事...

MartialBE commented 5 months ago

你说的是midjourney-proxy-plus这个项目的中转吗?

iceiccy commented 5 months ago

你说的是midjourney-proxy-plus这个项目的中转吗?

是的,midjourney-proxy-plus这个项目的中转,我用中转出来的API进行二次API对外

iceiccy commented 5 months ago

所以不需要去对接midjourney-proxy-plus项目,只需要支持这个项目的API就好,一个地址+key,进行二包对外开放

MartialBE commented 5 months ago

可以 下周我看看 到时候借我你的api我测试一下。😂😂

iceiccy commented 5 months ago

可以 下周我看看 到时候借我你的api我测试一下。😂😂

好的好的,没问题

228983380 commented 4 months ago

可以借鉴https://github.com/Calcium-Ion/new-api这个项目

MartialBE commented 4 months ago

可以 下周我看看 到时候借我你的api我测试一下。😂😂

好的好的,没问题

发我一下你的mj api和密钥,邮箱: buer@xiao5.info 测试好了我会发邮通知你的

iceiccy commented 4 months ago

已发

Buer @.***> 於 2024年4月3日 週三 下午3:13寫道:

可以 下周我看看 到时候借我你的api我测试一下。😂😂

好的好的,没问题

发我一下你的mj api和密钥,邮箱: @.*** 测试好了我会发邮通知你的

— Reply to this email directly, view it on GitHub https://github.com/MartialBE/one-api/issues/127#issuecomment-2033726560, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMPGYNXASJYF6NQUMD3KFODY3OTYRAVCNFSM6AAAAABFKCG7O2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTG4ZDMNJWGA . You are receiving this because you authored the thread.Message ID: @.***>

MartialBE commented 4 months ago

138

已支持, 该模块改自new api的代码。使用方式和它一致。

itq5 commented 4 months ago

138 已支持, 该模块改自new api的代码。使用方式和它一致。

似乎最新版本的docker还没支持

MartialBE commented 4 months ago

138 已支持, 该模块改自new api的代码。使用方式和它一致。

似乎最新版本的docker还没支持

已发版

itq5 commented 4 months ago

我使用new-api的可以正常会话,使用最新0.7.2日志会打印

one-api日志打印: relay error (channel #86): 无效的请求, 无法获取midjourney provider

客户端日志:

config: {
    transitional: {
      silentJSONParsing: true,
      forcedJSONParsing: true,
      clarifyTimeoutError: false
    },
    adapter: [ 'xhr', 'http' ],
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    timeout: 60000,
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    maxBodyLength: -1,
    env: { FormData: [Function], Blob: [class Blob] },
    validateStatus: [Function: validateStatus],
    headers: AxiosHeaders {
      Accept: 'application/json, text/plain, */*',
      'Content-Type': 'application/json',
      'mj-api-secret': 'sk-********4e',
      'User-Agent': 'axios/1.4.0',
      'Content-Length': '507',
      'Accept-Encoding': 'gzip, compress, deflate, br'
    },
    baseURL: 'http://12***.1:3000',
    method: 'post',
    url: '/mj/submit/imagine',
    data: '{"botType":"MID_JOURNEY","prompt":"Midjourney Bot 2024-04-02 20:31:03 Korean girl wearing a white wedding dress,2023s,hair photo,Hair with steps around the face,long hair style,full body photo, white background, 100mm lens ,best quality,sigma 24mm f1.4, high resolution 16k photography,full-body shots of people, front lighting, ultra-fine photos    --ar 9:16 --q 1 --s 100 --v 6.0 ","base64Array":[],"notifyHook":"https://m*****om/api/draw/mjPlusNotify","state":"1|1","accountFilter":{"modes":["FAST"]}}'
  },
  request: <ref *1> ClientRequest {
    _events: [Object: null prototype] {
      abort: [Function (anonymous)],
      aborted: [Function (anonymous)],
      connect: [Function (anonymous)],
      error: [Function (anonymous)],
      socket: [Function (anonymous)],
      timeout: [Function (anonymous)],
      finish: [Function: requestOnFinish]
    },
    _eventsCount: 7,
    _maxListeners: undefined,
    outputData: [],
    outputSize: 0,
    writable: true,
    destroyed: false,
    _last: true,
    chunkedEncoding: false,
    shouldKeepAlive: false,
    maxRequestsOnConnectionReached: false,
    _defaultKeepAlive: true,
    useChunkedEncodingByDefault: true,
    sendDate: false,
    _removedConnection: false,
    _removedContLen: false,
    _removedTE: false,
    strictContentLength: false,
    _contentLength: '507',
    _hasBody: true,
    _trailer: '',
    finished: true,
    _headerSent: true,
    _closed: false,
    socket: Socket {
      connecting: false,
      _hadError: false,
      _parent: null,
      _host: null,
      _closeAfterHandlingError: false,
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: false,
      _sockname: null,
      _pendingData: null,
      _pendingEncoding: '',
      server: null,
      _server: null,
      parser: null,
      _httpMessage: [Circular *1],
      timeout: 60000,
      [Symbol(async_id_symbol)]: 14038,
      [Symbol(kHandle)]: [TCP],
      [Symbol(lastWriteQueueSize)]: 0,
      [Symbol(timeout)]: Timeout {
        _idleTimeout: 60000,
        _idlePrev: [TimersList],
        _idleNext: [TimersList],
        _idleStart: 19625595,
        _onTimeout: [Function: bound ],
        _timerArgs: undefined,
        _repeat: null,
        _destroyed: false,
        [Symbol(refed)]: false,
        [Symbol(kHasPrimitive)]: false,
        [Symbol(asyncId)]: 14046,
        [Symbol(triggerId)]: 14040
      },
      [Symbol(kBuffer)]: null,
      [Symbol(kBufferCb)]: null,
      [Symbol(kBufferGen)]: null,
      [Symbol(kCapture)]: false,
      [Symbol(kSetNoDelay)]: true,
      [Symbol(kSetKeepAlive)]: true,
      [Symbol(kSetKeepAliveInitialDelay)]: 60,
      [Symbol(kBytesRead)]: 0,
      [Symbol(kBytesWritten)]: 0
    },
    _header: 'POST /mj/submit/imagine HTTP/1.1\r\n' +
      'Accept: application/json, text/plain, */*\r\n' +
      'Content-Type: application/json\r\n' +
      'mj-api-secret: sk-*****c4e\r\n' +
      'User-Agent: axios/1.4.0\r\n' +
      'Content-Length: 507\r\n' +
      'Accept-Encoding: gzip, compress, deflate, br\r\n' +
      'Host: 12***.1:3000\r\n' +
      'Connection: close\r\n' +
      '\r\n',
    _keepAliveTimeout: 0,
    _onPendingData: [Function: nop],
    agent: Agent {
      _events: [Object: null prototype],
      _eventsCount: 2,
      _maxListeners: undefined,
      defaultPort: 80,
      protocol: 'http:',
      options: [Object: null prototype],
      requests: [Object: null prototype] {},
      sockets: [Object: null prototype],
      freeSockets: [Object: null prototype] {},
      keepAliveMsecs: 1000,
      keepAlive: false,
      maxSockets: Infinity,
      maxFreeSockets: 256,
      scheduling: 'lifo',
      maxTotalSockets: Infinity,
      totalSocketCount: 1,
      [Symbol(kCapture)]: false
    },
    socketPath: undefined,
    method: 'POST',
    maxHeaderSize: undefined,
    insecureHTTPParser: undefined,
    joinDuplicateHeaders: undefined,
    path: '/mj/submit/imagine',
    _ended: true,
    res: IncomingMessage {
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 4,
      _maxListeners: undefined,
      socket: [Socket],
      httpVersionMajor: 1,
      httpVersionMinor: 1,
      httpVersion: '1.1',
      complete: true,
      rawHeaders: [Array],
      rawTrailers: [],
      joinDuplicateHeaders: undefined,
      aborted: false,
      upgrade: false,
      url: '',
      method: null,
      statusCode: 400,
      statusMessage: 'Bad Request',
      client: [Socket],
      _consuming: false,
      _dumped: false,
      req: [Circular *1],
      responseUrl: 'http://1***1:3000/mj/submit/imagine',
      redirects: [],
      [Symbol(kCapture)]: false,
      [Symbol(kHeaders)]: [Object],
      [Symbol(kHeadersCount)]: 10,
      [Symbol(kTrailers)]: null,
      [Symbol(kTrailersCount)]: 0
    },
    aborted: false,
    timeoutCb: null,
    upgradeOrConnect: false,
    parser: null,
    maxHeadersCount: null,
    reusedSocket: false,
    host: '127.0.0.1',
    protocol: 'http:',
    _redirectable: Writable {
      _writableState: [WritableState],
      _events: [Object: null prototype],
      _eventsCount: 3,
      _maxListeners: undefined,
      _options: [Object],
      _ended: true,
      _ending: true,
      _redirectCount: 0,
      _redirects: [],
      _requestBodyLength: 507,
      _requestBodyBuffers: [],
      _onNativeResponse: [Function (anonymous)],
      _currentRequest: [Circular *1],
      _currentUrl: 'http://***1:3000/mj/submit/imagine',
      _timeout: null,
      [Symbol(kCapture)]: false
    },
    [Symbol(kCapture)]: false,
    [Symbol(kBytesWritten)]: 0,
    [Symbol(kNeedDrain)]: false,
    [Symbol(corked)]: 0,
    [Symbol(kOutHeaders)]: [Object: null prototype] {
      accept: [Array],
      'content-type': [Array],
      'mj-api-secret': [Array],
      'user-agent': [Array],
      'content-length': [Array],
      'accept-encoding': [Array],
      host: [Array]
    },
    [Symbol(errored)]: null,
    [Symbol(kHighWaterMark)]: 16384,
    [Symbol(kRejectNonStandardBodyWrites)]: false,
    [Symbol(kUniqueHeaders)]: null
  },
  response: {
    status: 400,
    statusText: 'Bad Request',
    headers: AxiosHeaders {
      'content-type': 'application/json; charset=utf-8',
      'x-oneapi-request-id': '20240406085700920378323jWUZ48bw',
      date: 'Sat, 06 Apr 2024 00:57:00 GMT',
      'content-length': '100',
      connection: 'close'
    },
    config: {
      transitional: [Object],
      adapter: [Array],
      transformRequest: [Array],
      transformResponse: [Array],
      timeout: 60000,
      xsrfCookieName: 'XSRF-TOKEN',
      xsrfHeaderName: 'X-XSRF-TOKEN',
      maxContentLength: -1,
      maxBodyLength: -1,
      env: [Object],
      validateStatus: [Function: validateStatus],
      headers: [AxiosHeaders],
      baseURL: 'http://1***1:3000',
      method: 'post',
      url: '/mj/submit/imagine',
      data: '{"botType":"MID_JOURNEY","prompt":"Midjourney Bot 2024-04-02 20:31:03 Korean girl wearing a white wedding dress,2023s,hair photo,Hair with steps around the face,long hair style,full body photo, white background, 100mm lens ,best quality,sigma 24mm f1.4, high resolution 16k photography,full-body shots of people, front lighting, ultra-fine photos    --ar 9:16 --q 1 --s 100 --v 6.0 ","base64Array":[],"notifyHook":"https://m***om/api/draw/mjPlusNotify","state":"1|1","accountFilter":{"modes":["FAST"]}}'
    },
    request: <ref *1> ClientRequest {
      _events: [Object: null prototype],
      _eventsCount: 7,
      _maxListeners: undefined,
      outputData: [],
      outputSize: 0,
      writable: true,
      destroyed: false,
      _last: true,
      chunkedEncoding: false,
      shouldKeepAlive: false,
      maxRequestsOnConnectionReached: false,
      _defaultKeepAlive: true,
      useChunkedEncodingByDefault: true,
      sendDate: false,
      _removedConnection: false,
      _removedContLen: false,
      _removedTE: false,
      strictContentLength: false,
      _contentLength: '507',
      _hasBody: true,
      _trailer: '',
      finished: true,
      _headerSent: true,
      _closed: false,
      socket: [Socket],
      _header: 'POST /mj/submit/imagine HTTP/1.1\r\n' +
        'Accept: application/json, text/plain, */*\r\n' +
        'Content-Type: application/json\r\n' +
        'mj-api-secret: sk-****c4e\r\n' +
        'User-Agent: axios/1.4.0\r\n' +
        'Content-Length: 507\r\n' +
        'Accept-Encoding: gzip, compress, deflate, br\r\n' +
        'Host: 127.0.0.1:3000\r\n' +
        'Connection: close\r\n' +
        '\r\n',
      _keepAliveTimeout: 0,
      _onPendingData: [Function: nop],
      agent: [Agent],
      socketPath: undefined,
      method: 'POST',
      maxHeaderSize: undefined,
      insecureHTTPParser: undefined,
      joinDuplicateHeaders: undefined,
      path: '/mj/submit/imagine',
      _ended: true,
      res: [IncomingMessage],
      aborted: false,
      timeoutCb: null,
      upgradeOrConnect: false,
      parser: null,
      maxHeadersCount: null,
      reusedSocket: false,
      host: '127.0.0.1',
      protocol: 'http:',
      _redirectable: [Writable],
      [Symbol(kCapture)]: false,
      [Symbol(kBytesWritten)]: 0,
      [Symbol(kNeedDrain)]: false,
      [Symbol(corked)]: 0,
      [Symbol(kOutHeaders)]: [Object: null prototype],
      [Symbol(errored)]: null,
      [Symbol(kHighWaterMark)]: 16384,
      [Symbol(kRejectNonStandardBodyWrites)]: false,
      [Symbol(kUniqueHeaders)]: null
    },
    data: {
      code: 5,
      description: '无效的请求, 无法获取midjourney provider ',
      type: 'internal_error'
    }
  }
}

==> ./err-0.log <==
2024-04-06 08:57:00: [Nest] 549669  - 04/06/2024, 8:57:00 AM   ERROR [HttpExceptionFilter] 【2024-04-06 08:57:00】 ===> "提交Action任务失败、请检查系统日志"

==> ./out-0.log <==
2024-04-06 08:57:00: error:  HttpException: 提交Action任务失败、请检查系统日志
    at _0x3ec5b1.textToImage (/www/wwwroot/a****m/dist/modules/draw/draw.service.js:1:41058)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  response: '提交Action任务失败、请检查系统日志',
  status: 400,
  options: undefined
}
MartialBE commented 4 months ago

@itq5 你使用的是plus吗? 我修复了一些可能出错的地方,拉取docker pull ghcr.io/martialbe/one-api:dev 你能帮我测试一下看是否正常吗?

itq5 commented 4 months ago

@itq5 你使用的是plus吗? 我修复了一些可能出错的地方,拉取docker pull ghcr.io/martialbe/one-api:dev 你能帮我测试一下看是否正常吗?

拉取最新的dev版本,还是会报错relay error (channel #86): 无效的请求, 无法获取midjourney provider,使用的是https://api.holdai.top中转,new-api项目正常使用。

MartialBE commented 4 months ago

我使用chatgpt-web-midjourney-proxy绘图能够正常的请求。 可以借我一个 api_key 测试一下吗? 然后你使用的客户端是什么? 邮箱:buer@xiao5.info