FastGPT icon indicating copy to clipboard operation
FastGPT copied to clipboard

调用/api/v1/chat/completions 出现messages is empty(已经运行两周都正常) 麻烦大佬给点思路

Open xiaopang763 opened this issue 8 months ago • 4 comments

例行检查

  • [x ] 我已确认目前没有类似 issue
  • [x] 我已完整查看过项目 README,以及项目文档
  • [x] 我使用了自己的 key,并确认我的 key 是可正常使用的
  • [x] 我理解并愿意跟进此 issue,协助测试和提供反馈
  • [x] 我理解并认可上述内容,并理解项目维护者精力有限,不遵循规则的 issue 可能会被无视或直接关闭

你的版本

  • [ ] 公有云版本
  • [x] 私有部署版本, 具体版本号: 4.9.6

问题描述, 日志截图,配置文件等 调用/api/v1/chat/completions 出现messages is empty(已经运行两周都正常) 直接页面中上传 也是正常使用 接口:/api/v1/chat/completions 传参: { "chatId": "680877defd6c37168f886bf7", "stream": false, "detail": false, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "根据文件内容 给出两道单选题 两道多选题 两道判断题" }, { "type": "file_url", "name": "测试.docx", "url": "https://e-source.oss-cn-huhehaote-nebula-1.aliyuncs.com/e-source_1746607650023_83.docx" } ] } ] } 返参: { "code": 500, "statusText": "", "message": "messages is empty", "data": null } 日志截图: Api response error: undefined, messages is empty { message: 'messages is empty', stack: 'Error: messages is empty\n' + ' at R (/app/projects/app/.next/server/pages/api/v1/chat/completions.js:1:4699)\n' + ' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' + ' at async /app/projects/app/.next/server/pages/api/support/user/team/plan/getTeamPlanStatus.js:1:7058\n' + ' at async K (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:16881)\n' + ' at async U.render (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/compiled/next-server/pages-api.runtime.prod.js:20:17520)\n' + ' at async NextNodeServer.runApi (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:603:9)\n' + ' at async NextNodeServer.handleCatchallRenderRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/server/next-server.js:269:37)\n' + ' at async NextNodeServer.handleRequestImpl (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/server/base-server.js:818:17)\n' + ' at async invokeRender (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:178:21)\n' + ' at async handleRequest (/app/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected][email protected][email protected]/node_modules/next/dist/server/lib/router-server.js:355:24)' } 复现步骤 同上传参 持续出现 预期结果 希望能给思路 指导如何解决 相关截图

xiaopang763 avatar May 07 '25 08:05 xiaopang763

没复现~ 估计是你 api 写得有问题

c121914yu avatar May 20 '25 13:05 c121914yu

有找到问题所在吗,我也遇到这个问题

Vinkays avatar Jul 14 '25 06:07 Vinkays

应该是请求头设置有问题,我之前设置"Content-Type": "text/event-stream",改成"Content-Type": "application/json"就好了

Vinkays avatar Jul 14 '25 07:07 Vinkays

如果其它项没问题,检查请求头,这俩都要有

Content-Type : application/json Content-Length :

否则就会返回 { "code": 500, "statusText": "", "message": "messages is empty", "data": null }

jnn23 avatar Aug 25 '25 06:08 jnn23