refactor: unify core pipeline logging with cs_agent logger

This commit is contained in:
2026-03-01 16:29:52 +08:00
parent a6b7bf1982
commit 8dd5a11b4b
11 changed files with 82 additions and 55 deletions

View File

@@ -1,7 +1,10 @@
from __future__ import annotations
import logging
from typing import Any
logger = logging.getLogger("cs_agent")
async def handle_image_workflow(*, workflow_router: Any, message: str, data: dict, image_urls: list) -> bool:
"""处理图片工作流(根据客户说的话判断执行哪种工作流)。"""
@@ -15,10 +18,10 @@ async def handle_image_workflow(*, workflow_router: Any, message: str, data: dic
acc_type = data.get("acc_type", "AliWorkbench")
image_url = image_urls[0]
print(f"[Agent] 检测到工作流类型:{workflow_type} (置信度:{confidence})")
logger.info("[Agent] 检测到工作流类型:%s (置信度:%s)", workflow_type, confidence)
if workflow_type == "find_image":
print(f"[Agent] 执行查找图片工作流 | 客户:{customer_id}")
logger.info("[Agent] 执行查找图片工作流 | 客户:%s", customer_id)
from core.workflow import workflow
return await workflow.find_image_workflow(
@@ -28,7 +31,7 @@ async def handle_image_workflow(*, workflow_router: Any, message: str, data: dic
acc_type=acc_type,
)
if workflow_type == "process_image":
print(f"[Agent] 执行处理图片工作流 | 客户:{customer_id}")
logger.info("[Agent] 执行处理图片工作流 | 客户:%s", customer_id)
from core.workflow import workflow
return await workflow.process_image_workflow(
@@ -38,7 +41,7 @@ async def handle_image_workflow(*, workflow_router: Any, message: str, data: dic
acc_type=acc_type,
)
if workflow_type == "transfer_human":
print(f"[Agent] 执行转人工派单工作流 | 客户:{customer_id}")
logger.info("[Agent] 执行转人工派单工作流 | 客户:%s", customer_id)
from core.workflow import workflow
return await workflow.transfer_to_designer_workflow(