mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-13 22:15:35 +00:00
fix: proxy llm raise exception when proxy llm response has error (#303)
Close #302
This commit is contained in:
commit
3dbbc854ec
@ -77,6 +77,10 @@ def proxyllm_generate_stream(model, tokenizer, params, device, context_len=2048)
|
|||||||
text = ""
|
text = ""
|
||||||
for line in res.iter_lines():
|
for line in res.iter_lines():
|
||||||
if line:
|
if line:
|
||||||
|
if not line.startswith(b"data: "):
|
||||||
|
error_message = line.decode("utf-8")
|
||||||
|
yield error_message
|
||||||
|
else:
|
||||||
json_data = line.split(b": ", 1)[1]
|
json_data = line.split(b": ", 1)[1]
|
||||||
decoded_line = json_data.decode("utf-8")
|
decoded_line = json_data.decode("utf-8")
|
||||||
if decoded_line.lower() != "[DONE]".lower():
|
if decoded_line.lower() != "[DONE]".lower():
|
||||||
|
Loading…
Reference in New Issue
Block a user