更新print
Browse files
src/services/chat_service.py
CHANGED
@@ -215,7 +215,8 @@ class ChatService:
|
|
215 |
messages=messages,
|
216 |
tools=self.tools
|
217 |
)
|
218 |
-
print("使用 groq 模型生成第一次回應"
|
|
|
219 |
initial_response = response["choices"][0]["message"]
|
220 |
tool_calls = initial_response.get("tool_calls", [])
|
221 |
|
@@ -245,7 +246,8 @@ class ChatService:
|
|
245 |
"name": function_name,
|
246 |
"content": str(result)
|
247 |
})
|
248 |
-
print("添加工具執行結果到訊息歷史:"
|
|
|
249 |
|
250 |
except Exception as tool_error:
|
251 |
print(f"工具執行錯誤 {function_name}: {str(tool_error)}")
|
@@ -261,9 +263,11 @@ class ChatService:
|
|
261 |
messages=messages,
|
262 |
tools=self.tools
|
263 |
)
|
264 |
-
print("生成最終回應:"
|
|
|
265 |
final_message = final_response["choices"][0]["message"]
|
266 |
-
print("生成最終回應 message:"
|
|
|
267 |
|
268 |
# 組合最終回應
|
269 |
if transcribed_text:
|
|
|
215 |
messages=messages,
|
216 |
tools=self.tools
|
217 |
)
|
218 |
+
print("3. 使用 groq 模型生成第一次回應")
|
219 |
+
print(response)
|
220 |
initial_response = response["choices"][0]["message"]
|
221 |
tool_calls = initial_response.get("tool_calls", [])
|
222 |
|
|
|
246 |
"name": function_name,
|
247 |
"content": str(result)
|
248 |
})
|
249 |
+
print("添加工具執行結果到訊息歷史:")
|
250 |
+
print(messages)
|
251 |
|
252 |
except Exception as tool_error:
|
253 |
print(f"工具執行錯誤 {function_name}: {str(tool_error)}")
|
|
|
263 |
messages=messages,
|
264 |
tools=self.tools
|
265 |
)
|
266 |
+
print("生成最終回應:")
|
267 |
+
print(final_response)
|
268 |
final_message = final_response["choices"][0]["message"]
|
269 |
+
print("生成最終回應 message:")
|
270 |
+
print(final_response)
|
271 |
|
272 |
# 組合最終回應
|
273 |
if transcribed_text:
|