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

【问题】聊天客户端在流式回答过程中点“停止”,没有正确的给后端大模型发停止消息,导致后端模型还在输出 #195

Closed jinghai closed 1 year ago

c121914yu commented 1 year ago

终止是没法终止模型api的,没见哪个厂商提供了终止操作

JinCheng666 commented 5 months ago

终止是没法终止模型api的,没见哪个厂商提供了终止操作

@c121914yu 请问在api调用对话接口的应用场景中,如何能实现停止回答的操作?或者在一个问答窗口中,实现并发提问?

一、fastgpt页面,有停止回答功能,调用后能看到,但没有接口说明,不知道该如何使用 curl 'http://10.4.134.11:3020/_next/data/OLRnvyIpwtGgTD4p7MF0h/zh/chat.json?chatId=c91bj6l78lc4&appId=65efb0b8b12a789bea7777f7' \ -H 'Accept: /' \ -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' \ -H 'Connection: keep-alive' \ -H 'Referer: http://10.4.134.11:3020/chat?appId=65efb0b8b12a789bea7777f7' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0' \ -H 'x-nextjs-data: 1' \ --insecure image

二、在一个问答窗口中,用不同的chatid提问,接口返回的流数据的id均为空,导致无法将流式回答,区分到不同的提问上。 curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions' \ --header 'Authorization: Bearer fastgpt-xxxxxx' \ --header 'Content-Type: application/json' \ --data-raw '{ "chatId": "abcd",//在一个问答窗口中,随机生成不同的chatid "stream": false, "detail": false,

image

c121914yu commented 5 months ago

终止是没法终止模型api的,没见哪个厂商提供了终止操作

@c121914yu 请问在api调用对话接口的应用场景中,如何能实现停止回答的操作?或者在一个问答窗口中,实现并发提问?

一、fastgpt页面,有停止回答功能,调用后能看到,但没有接口说明,不知道该如何使用 curl 'http://10.4.134.11:3020/_next/data/OLRnvyIpwtGgTD4p7MF0h/zh/chat.json?chatId=c91bj6l78lc4&appId=65efb0b8b12a789bea7777f7' -H 'Accept: /' -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' -H 'Connection: keep-alive' -H 'Referer: http://10.4.134.11:3020/chat?appId=65efb0b8b12a789bea7777f7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0' -H 'x-nextjs-data: 1' --insecure image

二、在一个问答窗口中,用不同的chatid提问,接口返回的流数据的id均为空,导致无法将流式回答,区分到不同的提问上。 curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions' --header 'Authorization: Bearer fastgpt-xxxxxx' --header 'Content-Type: application/json' --data-raw '{ "chatId": "abcd",//在一个问答窗口中,随机生成不同的chatid "stream": false, "detail": false,

image

abort掉请求即可。后端会自动中断和api的服务。 同一个窗口chatId都相同,怎么会有不同呢?

JinCheng666 commented 5 months ago

终止是没法终止模型api的,没见哪个厂商提供了终止操作

@c121914yu 请问在api调用对话接口的应用场景中,如何能实现停止回答的操作?或者在一个问答窗口中,实现并发提问? 一、fastgpt页面,有停止回答功能,调用后能看到,但没有接口说明,不知道该如何使用 curl 'http://10.4.134.11:3020/_next/data/OLRnvyIpwtGgTD4p7MF0h/zh/chat.json?chatId=c91bj6l78lc4&appId=65efb0b8b12a789bea7777f7' -H 'Accept: /' -H 'Accept-Language: zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6' -H 'Connection: keep-alive' -H 'Referer: http://10.4.134.11:3020/chat?appId=65efb0b8b12a789bea7777f7' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0' -H 'x-nextjs-data: 1' --insecure image 二、在一个问答窗口中,用不同的chatid提问,接口返回的流数据的id均为空,导致无法将流式回答,区分到不同的提问上。 curl --location --request POST 'https://api.fastgpt.in/api/v1/chat/completions' --header 'Authorization: Bearer fastgpt-xxxxxx' --header 'Content-Type: application/json' --data-raw '{ "chatId": "abcd",//在一个问答窗口中,随机生成不同的chatid "stream": false, "detail": false, image

abort掉请求即可。后端会自动中断和api的服务。 同一个窗口chatId都相同,怎么会有不同呢?

感谢大佬,我给前端反馈下。直接abort掉请求