This commit is contained in:
@@ -12,7 +12,7 @@ from langchain_core.messages import AIMessage
|
||||
from ...main_graph.state import MainGraphState
|
||||
from ...agent.prompts import create_system_prompt
|
||||
from ...utils.logging import log_state_change
|
||||
from ...logger import debug, info, error
|
||||
from backend.app.logger import debug, info, error
|
||||
|
||||
|
||||
def create_dynamic_llm_call_node(chat_services: Dict[str, BaseChatModel], tools: list):
|
||||
@@ -115,24 +115,7 @@ def create_dynamic_llm_call_node(chat_services: Dict[str, BaseChatModel], tools:
|
||||
):
|
||||
chunks.append(chunk)
|
||||
|
||||
info(f"[llm_call] LLM astream 完成,共收到 {len(chunks)} 个 chunks")
|
||||
for i, chunk in enumerate(chunks[:10]): # 只打印前10个避免日志过多
|
||||
chunk_type = type(chunk).__name__
|
||||
chunk_content = getattr(chunk, 'content', '') if hasattr(chunk, 'content') else str(chunk)
|
||||
# 打印更多属性
|
||||
additional_kwargs = getattr(chunk, 'additional_kwargs', {}) or {}
|
||||
response_metadata = getattr(chunk, 'response_metadata', {}) or {}
|
||||
# 打印所有属性
|
||||
info(f"[llm_call] chunk[{i}] type={chunk_type}")
|
||||
info(f"[llm_call] chunk[{i}] content长度={len(chunk_content) if chunk_content else 0}, content={repr(chunk_content[:200] if chunk_content else '')}")
|
||||
info(f"[llm_call] chunk[{i}] additional_kwargs={additional_kwargs}")
|
||||
info(f"[llm_call] chunk[{i}] response_metadata keys={list(response_metadata.keys()) if response_metadata else []}")
|
||||
info(f"[llm_call] chunk[{i}] response_metadata={response_metadata}")
|
||||
# 检查是否有其他可能存储内容的属性
|
||||
if hasattr(chunk, 'tool_call_chunks'):
|
||||
info(f"[llm_call] chunk[{i}] tool_call_chunks={chunk.tool_call_chunks}")
|
||||
if hasattr(chunk, 'usage_metadata'):
|
||||
info(f"[llm_call] chunk[{i}] usage_metadata={chunk.usage_metadata}")
|
||||
info(f"[llm_call] LLM astream 完成,共收到 {len(chunks)} 个 chunks,info:{chunks}")
|
||||
|
||||
# 将所有 chunk 合并成最终的 AIMessage
|
||||
if chunks:
|
||||
|
||||
Reference in New Issue
Block a user