from __future__ import annotations from typing import Any async def handle_image_workflow(*, workflow_router: Any, message: str, data: dict, image_urls: list) -> bool: """处理图片工作流(根据客户说的话判断执行哪种工作流)。""" if not image_urls: return False workflow_type, confidence = workflow_router.detect_workflow(message) customer_id = data.get("from_id") acc_id = data.get("acc_id", "") acc_type = data.get("acc_type", "AliWorkbench") image_url = image_urls[0] print(f"[Agent] 检测到工作流类型:{workflow_type} (置信度:{confidence})") if workflow_type == "find_image": print(f"[Agent] 执行查找图片工作流 | 客户:{customer_id}") from core.workflow import workflow return await workflow.find_image_workflow( customer_id=customer_id, image_url=image_url, acc_id=acc_id, acc_type=acc_type, ) if workflow_type == "process_image": print(f"[Agent] 执行处理图片工作流 | 客户:{customer_id}") from core.workflow import workflow return await workflow.process_image_workflow( customer_id=customer_id, image_url=image_url, acc_id=acc_id, acc_type=acc_type, ) if workflow_type == "transfer_human": print(f"[Agent] 执行转人工派单工作流 | 客户:{customer_id}") from core.workflow import workflow return await workflow.transfer_to_designer_workflow( customer_id=customer_id, image_url=image_url, acc_id=acc_id, acc_type=acc_type, reason="客户主动要求转人工", ) return False