From bea3f7c8d261b07174debe64ca4470ebb4c175b0 Mon Sep 17 00:00:00 2001 From: csunny Date: Thu, 8 Jun 2023 21:29:02 +0800 Subject: [PATCH] fix: chatglm stream output --- pilot/model/llm_out/chatglm_llm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pilot/model/llm_out/chatglm_llm.py b/pilot/model/llm_out/chatglm_llm.py index 1a44678fe..690be0f06 100644 --- a/pilot/model/llm_out/chatglm_llm.py +++ b/pilot/model/llm_out/chatglm_llm.py @@ -51,7 +51,10 @@ def chatglm_generate_stream( # else: # once_conversation.append(f"""###system:{message} """) - query = messages[-2].split("human:")[1] + try: + query = messages[-2].split("human:")[1] + except IndexError: + query = messages[-3].split("human:")[1] print("Query Message: ", query) # output = "" # i = 0