update error response format in streaming API to a normal message. So user can get what's going on.

This commit is contained in:
yangdx
2025-02-05 11:07:31 +08:00
parent 24effb127d
commit f1ea7f7415

View File

@@ -1793,10 +1793,12 @@ def create_app(args):
error_data = {
"model": ollama_server_infos.LIGHTRAG_MODEL,
"created_at": ollama_server_infos.LIGHTRAG_CREATED_AT,
"error": {
"code": "STREAM_ERROR",
"message": error_msg
"message": {
"role": "assistant",
"content": f"\n\nError: {error_msg}",
"images": None
},
"done": False
}
yield f"{json.dumps(error_data, ensure_ascii=False)}\n"