uni-app 为什么我的uni-ai开启流stream报SYSTEM_ERROR,Unable to get object content
uni-app 为什么我的uni-ai开启流stream报SYSTEM_ERROR,Unable to get object content
操作步骤:
见描述
预期结果:
返回{errCode: 0}
实际结果:
{"errCode": "SYSTEM_ERROR","errMsg": "Unable to get object content"}
bug描述:
代码中的参数options
和seeChannel
见机密信息。
const llmManager = uniCloud.ai.getLLMManager(options)
let streamRes = await llmManager.chatCompletion({
messages: [{"role":"user","content":"你好"}],
stream: true,
sseChannel: seeChannel
})
console.log(streamRes)
return {
errCode: 0,
errMsg: ''
}
之前该代码中streamRes
会打印{errCode: 0}
但是不知道什么时候开始,返回的是
{
"_events": Object,
"_eventsCount": 0,
"_maxListeners": undefined,
...
}
打开后显示
{"errCode": "SYSTEM_ERROR","errMsg": "Unable to get object content"}
使用的是nginx代理,且代理配置好了proxy_buffering off;
其中还会报错
03:58:44.955 [本地调试] SyntaxError: Unexpected token a in JSON at position 0
03:58:44.957 [本地调试] at JSON.parse (<anonymous>)
03:58:44.957 [本地调试] at IncomingMessage.emit (node:events:517:28)
03:58:44.957 [本地调试] at addChunk (node:internal/streams/readable:368:12)
03:58:44.957 [本地调试] at readableAddChunk (node:internal/streams/readable:341:9)
03:58:44.957 [本地调试] at Readable.push (node:internal/streams/readable:278:10)
03:58:44.957 [本地调试] at HTTPParser.parserOnBody (node:_http_common:131:24)
14:06:20.422 [本地调试] Error [ERR_UNHANDLED_ERROR]: Unhandled error. (SyntaxError: Unexpected token a in JSON at position 0
14:06:20.422 [本地调试] at JSON.parse (<anonymous>)
14:06:20.422 [本地调试] at IncomingMessage.emit (node:events:517:28)
14:06:20.422 [本地调试] at addChunk (node:internal/streams/readable:368:12)
14:06:20.422 [本地调试] at readableAddChunk (node:internal/streams/readable:341:9)
14:06:20.422 [本地调试] at Readable.push (node:internal/streams/readable:278:10)
14:06:20.422 [本地调试] at HTTPParser.parserOnBody (node:_http_common:131:24))
使用uni-ai计费网关,不管是否开启stream,都是正常的。 使用openai,关闭stream是正常的,开启的话就会报这两个错误。 apiKey和proxy都是正常。 runtime中,Nodejs8,Nodejs12,Nodejs18都试过了。 之前是好的,运行正常的。不知道怎么回事。
更多关于uni-app 为什么我的uni-ai开启流stream报SYSTEM_ERROR,Unable to get object content的实战教程也可以访问 https://www.itying.com/category-93-b0.html
1 回复
更多关于uni-app 为什么我的uni-ai开启流stream报SYSTEM_ERROR,Unable to get object content的实战教程也可以访问 https://www.itying.com/category-93-b0.html
别沉