feat: 添加物流查询功能和完善 token 传递
- 添加 get_logistics 工具查询 Mall API /mall/api/order/parcel - 修复 Cookie token 传递到 MCP 的问题 - 增强 LLM 客户端超时处理和日志 - 移除 MALL_API_TOKEN,使用用户登录 token - 更新测试页面使用 setUser 设置用户属性 - 增强 webhook 调试日志
This commit is contained in:
@@ -81,12 +81,27 @@ async def classify_intent(state: AgentState) -> AgentState:
|
||||
|
||||
# Parse JSON response
|
||||
content = response.content.strip()
|
||||
|
||||
# Log raw response for debugging
|
||||
logger.debug(
|
||||
"LLM response for intent classification",
|
||||
response_preview=content[:500] if content else "EMPTY",
|
||||
content_length=len(content) if content else 0
|
||||
)
|
||||
|
||||
# Handle markdown code blocks
|
||||
if content.startswith("```"):
|
||||
content = content.split("```")[1]
|
||||
if content.startswith("json"):
|
||||
content = content[4:]
|
||||
|
||||
# Check for empty response
|
||||
if not content:
|
||||
logger.warning("LLM returned empty response for intent classification")
|
||||
state["intent"] = Intent.CUSTOMER_SERVICE.value # Default to customer service
|
||||
state["intent_confidence"] = 0.5
|
||||
return state
|
||||
|
||||
result = json.loads(content)
|
||||
|
||||
# Extract intent
|
||||
|
||||
Reference in New Issue
Block a user