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)