jack 2 月之前
父节点
当前提交
f2e5a29711
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      app/core/runner/llm_callback_handler.py

+ 8 - 3
app/core/runner/llm_callback_handler.py

@@ -54,9 +54,14 @@ class LLMCallbackHandler:
                     continue
 
                 choice = chunk.choices[0]
-                logging.debug(choice)
-                delta = choice.delta
-                logging.debug(delta)
+                # logging.debug(choice)
+                delta = None
+                if hasattr(choice, "delta"):
+                    delta = choice.delta
+                    # logging.debug(delta)
+                elif hasattr(choice, "message"):
+                    delta = choice.message
+                    # logging.debug(delta)
                 if not delta:
                     if chunk.usage:
                         self.event_handler.pub_message_usage(chunk)