fix: Pipeline 处理添加耗时日志和异常捕获
- message_pipeline.handle_message 添加每步耗时日志(租户解析/会话管理/消息处理) - feishu_longconn_service Pipeline 调用包裹 try/catch,异常时记录完整堆栈 - feishu_bot.py 同样添加 Pipeline 异常捕获 - 防止 Pipeline 内部异常被静默吞掉导致消息无回复
This commit is contained in:
@@ -119,15 +119,20 @@ def _process_message_in_background(app, event_data: dict):
|
||||
logger.info(f"[Feishu Bot] 发送者={sender_name}({sender_id}), 群={chat_id}, 租户={tenant_id}")
|
||||
|
||||
# 4. 使用 Pipeline 统一处理消息
|
||||
pipeline = service_manager.get_pipeline()
|
||||
response_data = pipeline.handle_message(
|
||||
user_id=user_id,
|
||||
message=text_content,
|
||||
tenant_id=tenant_id,
|
||||
chat_id=chat_id,
|
||||
ip_address=f"feishu:{sender_id}:{sender_name}",
|
||||
invocation_method=f"feishu_bot({chat_type})"
|
||||
)
|
||||
try:
|
||||
pipeline = service_manager.get_pipeline()
|
||||
logger.info(f"[Feishu Bot] Pipeline 开始处理: user={user_id}")
|
||||
response_data = pipeline.handle_message(
|
||||
user_id=user_id,
|
||||
message=text_content,
|
||||
tenant_id=tenant_id,
|
||||
chat_id=chat_id,
|
||||
ip_address=f"feishu:{sender_id}:{sender_name}",
|
||||
invocation_method=f"feishu_bot({chat_type})"
|
||||
)
|
||||
except Exception as pipe_err:
|
||||
logger.error(f"[Feishu Bot] Pipeline 处理异常: {pipe_err}", exc_info=True)
|
||||
response_data = {"success": False, "error": str(pipe_err)}
|
||||
logger.info(f"[Feishu Bot] 处理结果: success={response_data.get('success')}")
|
||||
|
||||
# 5. 提取回复并发送
|
||||
|
||||
Reference in New Issue
Block a user