eosphoros-ai / DB-GPT

AI Native Data App Development framework with AWEL(Agentic Workflow Expression Language) and Agents
http://docs.dbgpt.cn
MIT License
13.74k stars 1.85k forks source link

[Bug] [Chat_Data] use stream model return json without data #2126

Open sun-timer opened 2 days ago

sun-timer commented 2 days ago

Search before asking

Operating system information

Linux

Python version information

3.10

DB-GPT version

latest release

Related scenes

Installation Information

Device information

x86_64 NVIDIA GeForce GTX 1080

Models information

LLM: iFlytekSpark-13B Embedding model:text2vec-large-chinese

What happened

When I call the streaming answer mode with the API, the answer result is only JSON characters, without data. image

What you expected to happen

Return streaming output results, just like non streaming output. image

How to reproduce

curl -X POST "http://localhost:5670/api/v2/chat/completions" \ -H "Authorization: Bearer dbgpt" \ -H "accept: application/json" \ -H "Content-Type: application/json" \ -d "{\"messages\":\"Hello\",\"model\":\"chatgpt_proxyllm\", \"stream\": true}"

Additional context

nothing

Are you willing to submit PR?

Aries-ckt commented 2 days ago
curl -X POST "http://localhost:5670/api/v2/chat/completions"
-H "Authorization: Bearer dbgpt"
-H "accept: application/json"
-H "Content-Type: application/json"
-d "{"messages":"Hello","model":"chatgpt_proxyllm", "stream": true}"

it is a normal chat, you can set your mode like

DBGPT_API_KEY=dbgpt
DB_NAME="{your_db_name}"

curl -X POST "http://localhost:5670/api/v2/chat/completions" \
    -H "Authorization: Bearer $DBGPT_API_KEY" \
    -H "accept: application/json" \
    -H "Content-Type: application/json" \
    -d "{\"messages\":\"show space datas limit 5\",\"model\":\"chatgpt_proxyllm\", \"chat_mode\": \"chat_data\", \"chat_param\": \"$DB_NAME\"}"

reference: http://docs.dbgpt.cn/docs/api/datasource

sun-timer commented 1 day ago

thank u for answer. What I mean is that it returned an incorrect response, which is that the streaming output did not output the complete table at the end. I use Source Code Deployment, where shall I modify to fix it image image

Aries-ckt commented 1 day ago

it looks like web chat data app not correct , can you show the whole complete chat data screen shot? did you specify your db name?