diff --git a/demo/backend.py b/demo/backend.py index 762148d..02ce6b9 100644 --- a/demo/backend.py +++ b/demo/backend.py @@ -691,7 +691,7 @@ def bot_stream(messages, workspace, session_id="default"): if "" in cur_res: finished = True break - if chunk.choices[0].finish_reason == "stop" and not finished: + if chunk.choices and chunk.choices[0].finish_reason == "stop" and not finished: if not cur_res.endswith(""): cur_res += "" assistant_reply += ""