update error response format in streaming API to a normal message. So user can get what's going on.
This commit is contained in:
@@ -1793,10 +1793,12 @@ def create_app(args):
|
|||||||
error_data = {
|
error_data = {
|
||||||
"model": ollama_server_infos.LIGHTRAG_MODEL,
|
"model": ollama_server_infos.LIGHTRAG_MODEL,
|
||||||
"created_at": ollama_server_infos.LIGHTRAG_CREATED_AT,
|
"created_at": ollama_server_infos.LIGHTRAG_CREATED_AT,
|
||||||
"error": {
|
"message": {
|
||||||
"code": "STREAM_ERROR",
|
"role": "assistant",
|
||||||
"message": error_msg
|
"content": f"\n\nError: {error_msg}",
|
||||||
|
"images": None
|
||||||
},
|
},
|
||||||
|
"done": False
|
||||||
}
|
}
|
||||||
yield f"{json.dumps(error_data, ensure_ascii=False)}\n"
|
yield f"{json.dumps(error_data, ensure_ascii=False)}\n"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user