labring / FastGPT

FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, and visual AI workflow orchestration, letting you easily develop and deploy complex question-answering systems without the need for extensive setup or configuration.
https://tryfastgpt.ai
Other
17.49k stars 4.69k forks source link

v4.7版本挂载知识库或工具报错误:sse error: bad_response_status_code bad response status code 400 #1046

Closed leoterry-ulrica closed 5 months ago

leoterry-ulrica commented 7 months ago

例行检查

你的版本

问题描述 OneAPI-v0.6.3-alpha.1,FastGPT-v4.7版本。 在应用中一旦挂上知识库或工具,chat的时候会报以下错误(如果把知识库或工具拿掉,那可以正常chat):

[ERROR] 2024-03-21 16:51:24 sse error: bad_response_status_code bad response status code 400 (request id: 2024032200512459019245161442518) 
{
  message: '400 bad response status code 400 (request id: 2024032200512459019245161442518)',
  stack: 'Error: 400 bad response status code 400 (request id: 2024032200512459019245161442518)\n' +
    '    at eL.generate (/app/projects/app/.next/server/chunks/80555.js:21:70043)\n' +
    '    at af.makeStatusError (/app/projects/app/.next/server/chunks/80555.js:21:81687)\n' +
    '    at af.makeRequest (/app/projects/app/.next/server/chunks/80555.js:21:82610)\n' +
    '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
    '    at async g (/app/projects/app/.next/server/chunks/94900.js:121:1884)\n' +
    '    at async Object.w [as tools] (/app/projects/app/.next/server/chunks/94900.js:119:4647)\n' +
    '    at async N (/app/projects/app/.next/server/chunks/94900.js:125:2787)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async Promise.all (index 0)\n' +
    '    at async S (/app/projects/app/.next/server/chunks/94900.js:125:4092)\n' +
    '    at async h (/app/projects/app/.next/server/pages/api/core/chat/chatTest.js:1:2771)'
}

相关截图 image image

zhanghx0905 commented 7 months ago

遇到了相同的错误。我使用one-api连接本地部署的xinference

leoterry-ulrica commented 7 months ago

@c121914yu 是不是跟v4.7-alpha3这个修复有关:简易模式中,单纯选择知识库,仍保持旧逻辑,不调用工具。

leoterry-ulrica commented 7 months ago

遇到了相同的错误。我使用one-api连接本地部署的xinference

你解决了吗?

zhanghx0905 commented 7 months ago

遇到了相同的错误。我使用one-api连接本地部署的xinference

你解决了吗?

未解决,我正在等待正式版镜像,等正式版发布了我再测试

zhanghx0905 commented 6 months ago

根据我的测试,这个错误与packages\service\core\workflow\dispatch\agent\runTool\toolChoice.ts中第110行左右调用模型时,设置stream=True有关,我使用的Xinference不支持在设置Tools的同时设置stream=True

leoterry-ulrica commented 6 months ago

根据我的测试,这个错误与packages\service\core\workflow\dispatch\agent\runTool\toolChoice.ts中第110行左右调用模型时,设置stream=True有关,我使用的Xinference不支持在设置Tools的同时设置stream=True

现在解决办法是改fastgpt代码,还是让xinference修改?

leoterry-ulrica commented 6 months ago

@c121914yu 请问如何修改?

qinxuye commented 6 months ago

Xinference 目前使用 tools 的时候不能支持 stream。

leoterry-ulrica commented 6 months ago

Xinference 目前使用 tools 的时候不能支持 stream。

那有什么解决方案吗?

zhanghx0905 commented 6 months ago

我使用的是xinference v0.9.3,fastgpt 当前的最新main分支 让fastgpt兼容xinference的tools call的方法是设置stream=False,并且在工具调用返回的请求体中设置一个空的content。参见https://github.com/zhanghx0905/FastGPT/commit/2d21659be106cb56877fd7e646d3652f080071c6

07208a72dfa923abb97dfa093ee0a2a

不知道为什么,虽然模型结果正确返回了,fastgpt的对话框里没有显示出结果。

9a696f38211ba1591f4ec5662fcb29e

c121914yu commented 6 months ago

虽然模型结果正确返回了,fastgpt的对话框里没有显示出结果。

那必然是改得模型。直接做一个伪流接口。

leoterry-ulrica commented 6 months ago

虽然模型结果正确返回了,fastgpt的对话框里没有显示出结果。

那必然是改得模型。直接做一个伪流接口。

@qinxuye 这个能处理的吗?

jjssjdhhd commented 6 months ago

我也是这个问题,有谁解决了吗

studying-llama commented 6 months ago

有人解决了吗

cwateryuan commented 6 months ago

同样遇到了这个问题。

c121914yu commented 5 months ago

Xinference support: https://github.com/xorbitsai/inference/issues/1208