songquanpeng / one-api

OpenAI 接口管理 & 分发系统,支持 Azure、Anthropic Claude、Google PaLM 2 & Gemini、智谱 ChatGLM、百度文心一言、讯飞星火认知、阿里通义千问、360 智脑以及腾讯混元,可用于二次分发管理 key,仅单可执行文件,已打包好 Docker 镜像,一键部署,开箱即用. OpenAI key management & redistribution system, using a single API for all LLMs, and features an English UI.
https://openai.justsong.cn/
MIT License
16.22k stars 3.75k forks source link

文新一言配置知识库报错:the length of messages must be an odd number #341

Closed muzibaby closed 11 months ago

muzibaby commented 11 months ago

[31/07/2023, 10:27:21] chat generate success. text len: 308. token len: 392. pay:true api response time: 1.61s { message: 'the length of messages must be an odd number', type: 'baidu_error', param: '', code: 336003 }

OneAPI

[GIN] 2023/07/31 - 10:26:02 | 200 | 876.792µs | 172.17.0.1 | GET "/api/group/" [GIN] 2023/07/31 - 10:26:02 | 200 | 562.375µs | 172.17.0.1 | GET "/api/channel/models" [GIN] 2023/07/31 - 10:26:02 | 200 | 25.207709ms | 172.17.0.1 | GET "/api/channel/2" [SYS] 2023/07/31 - 10:22:53 | failed to get token encoder for model ERNIE-Bot-turbo: no encoding for model ERNIE-Bot-turbo, using encoder for gpt-3.5-turbo [GIN] 2023/07/31 - 10:26:27 | 200 | 204.435375ms | 172.17.0.1 | PUT "/api/channel/" [GIN] 2023/07/31 - 10:26:32 | 200 | 14.997875ms | 172.17.0.1 | GET "/api/channel/?p=0" [GIN] 2023/07/31 - 10:26:34 | 200 | 472.833µs | 172.17.0.1 | GET "/api/group/" [GIN] 2023/07/31 - 10:26:34 | 200 | 8.12675ms | 172.17.0.1 | GET "/api/channel/models" [GIN] 2023/07/31 - 10:26:34 | 200 | 24.571542ms | 172.17.0.1 | GET "/api/channel/2" [GIN] 2023/07/31 - 10:26:45 | 200 | 24.347625ms | 172.17.0.1 | GET "/api/channel/?p=0" [GIN] 2023/07/31 - 10:26:47 | 200 | 415µs | 172.17.0.1 | GET "/api/group/" [GIN] 2023/07/31 - 10:26:47 | 200 | 1.504375ms | 172.17.0.1 | GET "/api/channel/models" [GIN] 2023/07/31 - 10:26:47 | 200 | 6.29525ms | 172.17.0.1 | GET "/api/channel/1" [GIN] 2023/07/31 - 10:26:54 | 200 | 13.897875ms | 172.17.0.1 | GET "/api/channel/?p=0" [GIN] 2023/07/31 - 10:27:07 | 200 | 1.224411251s | 172.17.0.1 | POST "/v1/chat/completions" [GIN] 2023/07/31 - 10:27:21 | 200 | 1.775595001s | 172.17.0.1 | POST "/v1/chat/completions" [GIN] 2023/07/31 - 10:27:46 | 200 | 1.271409543s | 172.17.0.1 | POST "/v1/embeddings" [GIN] 2023/07/31 - 10:27:58 | 200 | 1.082578667s | 172.17.0.1 | POST "/v1/embeddings" [GIN] 2023/07/31 - 10:27:58 | 200 | 272.808ms | 172.17.0.1 | POST "/v1/chat/completions" [SYS] 2023/07/31 - 10:27:58 | relay error (channel #2): the length of messages must be an odd number

songquanpeng commented 11 months ago

请求体贴一下

muzibaby commented 11 months ago

Sending request with body: { model: 'gpt-3.5-turbo-16k', apiKey: 'sk-5sslNl97GBDKY4P81173A3Bc6fBd4a05Be0826B9F1D0EdA9', temperature: 0, maxToken: 4000, messages: [ { obj: 'System', value: '知识库:\n' + '1: [李逵,唐原王,唐代宗李豫第十九子,唐德宗李适异母弟。大历十年,田承嗣不臣,而昭靖夭,无强王,帝乃悉王诸子,领诸镇军,威天下。于是以逵为原王,并开府仪同三司,然不出閤。大和六年薨。\n' + ']' }, { obj: 'Human', value: '知识库是关于 文心一言测试 的内容,参考知识库回答问题。与 "文心一言测试" 无关内容,直接回复: "我不知道"。' }, { _id: '64ccd019ab86e5f6b04db0a7', obj: 'Human', value: '李逵' } ], stream: true, res: ServerResponse { _events: [Object: null prototype] { finish: [Function: bound resOnFinish], close: [Function (anonymous)], error: [Function (anonymous)] }, _eventsCount: 3, _maxListeners: undefined, outputData: [], outputSize: 0, writable: true, destroyed: false, _last: false, chunkedEncoding: false, shouldKeepAlive: true, maxRequestsOnConnectionReached: false, _defaultKeepAlive: true, useChunkedEncodingByDefault: true, sendDate: true, _removedConnection: false, _removedContLen: false, _removedTE: false, strictContentLength: false, _contentLength: null, _hasBody: true, _trailer: '', finished: false, _headerSent: false, _closed: false, socket: Socket { connecting: false, _hadError: false, _parent: null, _host: null, _closeAfterHandlingError: false, _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 8, _maxListeners: undefined, _writableState: [WritableState], allowHalfOpen: true, _sockname: null, _pendingData: null, _pendingEncoding: '', server: [Server], _server: [Server], parser: [HTTPParser], on: [Function: socketListenerWrap], addListener: [Function: socketListenerWrap], prependListener: [Function: socketListenerWrap], setEncoding: [Function: socketSetEncoding], _paused: false, _httpMessage: [Circular *1], timeout: 0,

 [Symbol(kHandle)]: [TCP],
 [Symbol(lastWriteQueueSize)]: 0,
 [Symbol(timeout)]: Timeout {
   _idleTimeout: -1,
   _idlePrev: null,
   _idleNext: null,
   _idleStart: 182520,
   _onTimeout: null,
   _timerArgs: undefined,
   _repeat: null,
   _destroyed: true,
   [Symbol(refed)]: false,
   [Symbol(kHasPrimitive)]: false,
   [Symbol(asyncId)]: 12030,
   [Symbol(triggerId)]: 12028
 },
 [Symbol(kBuffer)]: null,
 [Symbol(kBufferCb)]: null,
 [Symbol(kBufferGen)]: null,
 [Symbol(kCapture)]: false,
 [Symbol(kSetNoDelay)]: true,
 [Symbol(kSetKeepAlive)]: false,
 [Symbol(kSetKeepAliveInitialDelay)]: 0,
 [Symbol(kBytesRead)]: 0,
 [Symbol(kBytesWritten)]: 0

}, _header: null, _keepAliveTimeout: 5000, _onPendingData: [Function: bound updateOutgoingData], req: IncomingMessage { _readableState: [ReadableState], _events: [Object: null prototype], _eventsCount: 2, _maxListeners: undefined, socket: [Socket], httpVersionMajor: 1, httpVersionMinor: 1, httpVersion: '1.1', complete: true, rawHeaders: [Array], rawTrailers: [], joinDuplicateHeaders: null, aborted: false, upgrade: false, url: '/api/openapi/v1/chat/completions', method: 'POST', statusCode: null, statusMessage: null, client: [Socket], _consuming: true, _dumped: false, cookies: [Getter/Setter], query: {}, previewData: [Getter/Setter], preview: [Getter/Setter], body: [Object],

 [Symbol(kHeaders)]: [Object],
 [Symbol(kHeadersCount)]: 28,
 [Symbol(kTrailers)]: null,
 [Symbol(kTrailersCount)]: 0,
 [Symbol(NextRequestMeta)]: [Object]

}, _sent100: false, _expect_continue: false, _maxRequestsPerSocket: 0, setHeader: [Function (anonymous)], statusCode: 200, flush: [Function: flush], write: [Function (anonymous)], end: [Function (anonymous)], on: [Function: on], writeHead: [Function: writeHead], status: [Function (anonymous)], send: [Function (anonymous)], json: [Function (anonymous)], redirect: [Function (anonymous)], setPreviewData: [Function (anonymous)], clearPreviewData: [Function (anonymous)], revalidate: [Function (anonymous)],

[Symbol(kOutHeaders)]: [Object: null prototype] { 'access-control-allow-origin': [Array], vary: [Array] },

} } api response time: 1.216s { message: 'the length of messages must be an odd number', type: 'baidu_error', param: '', code: 336003 }

使用的FastGPT main 分支代码 Oneapi的 oneapi-0.5.2-alpha.5

Regards, Vigo Song

---- 回复的原邮件 ---- | 发件人 | @.> | | 发送日期 | 2023年08月1日 00:23 | | 收件人 | @.> | | 抄送人 | @.> , @.> | | 主题 | Re: [songquanpeng/one-api] 使用文新一言的时候,配置知识库的时候,提示如下问题 0.5.2-alpha.5 (Issue #341) |

请求体贴一下

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

songquanpeng commented 11 months ago

这个问题按理说已经解决了,如果目前还是这样重开 issue