L1-项目2-基于LangGraph智能分诊系统:系统运行起来之后,首次提问:你好,我是聚客AI学院Kevin。
报错:Assistant: 处理响应时发生未知错误。
调试信息: TypeError('Object of type AIMessage is not JSON serializable').
日志信息:
2025-07-25 10:13:46,091 - utils.llms - INFO - 成功初始化 qwen LLM
2025-07-25 10:13:46,546 - chromadb.telemetry.product.posthog - INFO - Anonymized telemetry enabled. See https://docs.trychroma.com/telemetry for more information.
2025-07-25 10:13:48,517 - chromadb.telemetry.product.posthog - ERROR - Failed to send telemetry event ClientStartEvent: capture() takes 1 positional argument but 3 were given
2025-07-25 10:13:48,529 - chromadb.telemetry.product.posthog - ERROR - Failed to send telemetry event ClientCreateCollectionEvent: capture() takes 1 positional argument but 3 were given
2025-07-25 10:13:48,545 - __main__ - DEBUG - Tool 'retrieve' routed to 'grade_documents' (retrieval tool)
2025-07-25 10:13:48,576 - __main__ - DEBUG - Tool 'multiply' routed to 'generate' (non-retrieval tool)
2025-07-25 10:13:48,580 - __main__ - INFO - Initialized ToolConfig with tools: {'retrieve', 'multiply'}, routing: {'retrieve': 'grade_documents', 'multiply': 'generate'}
2025-07-25 10:13:48,594 - __main__ - INFO - Database connection pool initialized
2025-07-25 10:13:48,606 - __main__ - DEBUG - Database connection pool initialized
2025-07-25 10:13:48,617 - __main__ - INFO - Connection db_connection_pool status: 0/20 connections in use
2025-07-25 10:13:48,679 - __main__ - INFO - Connection db_connection_pool status: OK, test connection successful
2025-07-25 10:13:58,008 - __main__ - INFO - Graph visualization saved as graph.png
聊天机器人准备就绪!输入 'quit'、'exit' 或 'q' 结束对话。
User: >? 你好,我是聚客AI学院Kevin
2025-07-25 10:14:48,634 - __main__ - INFO - Connection db_connection_pool status: 0/20 connections in use
2025-07-25 10:15:24,684 - __main__ - INFO - Agent processing user query
2025-07-25 10:15:24,703 - __main__ - INFO - agent question:content='你好,我是聚客AI学院Kevin' additional_kwargs={} response_metadata={} id='b330c14e-92e9-4917-8233-eb54a0abffd5'
2025-07-25 10:15:29,364 - httpx - INFO - HTTP Request: POST https://dashscope.aliyuncs.com/compatible-mode/v1/embeddings "HTTP/1.1 200 OK"
2025-07-25 10:15:29,504 - __main__ - INFO - Loading and caching prompt template from prompts/prompt_template_agent.txt
2025-07-25 10:15:31,467 - httpx - INFO - HTTP Request: POST https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions "HTTP/1.1 200 OK"
2025-07-25 10:15:31,603 - __main__ - INFO - Agent response: content='你好,Kevin!很高兴见到你。请问有什么我可以帮你的吗?' additional_kwargs={'refusal': None} response_metadata={'token_usage': {'completion_tokens': 15, 'prompt_tokens': 788, 'total_tokens': 803, 'completion_tokens_details': None, 'prompt_tokens_details': {'audio_tokens': None, 'cached_tokens': 0}}, 'model_name': 'qwen-max', 'system_fingerprint': None, 'finish_reason': 'stop', 'logprobs': None} id='run--de37c20c-5fd1-400e-b351-c8354ae75537-0' usage_metadata={'input_tokens': 788, 'output_tokens': 15, 'total_tokens': 803, 'input_token_details': {'cache_read': 0}, 'output_token_details': {}}
2025-07-25 10:15:48,638 - __main__ - INFO - Connection db_connection_pool status: 0/20 connections in use
2025-07-25 10:16:05,080 - __main__ - ERROR - Error processing response: Object of type AIMessage is not JSON serializable
这个问题如何解决?