"""Coze客户端(临时模拟,等Agent-Coze实现后替换)""" import logging from typing import Dict, Any, Optional logger = logging.getLogger(__name__) class CozeClient: """ Coze客户端模拟类 TODO: 等Agent-Coze模块实现后,这个类将被真实的Coze网关客户端替换 """ async def create_conversation( self, bot_id: str, user_id: str, meta_data: Optional[Dict[str, Any]] = None ) -> Dict[str, Any]: """创建会话(模拟)""" logger.info(f"模拟创建Coze会话: bot_id={bot_id}, user_id={user_id}") # 返回模拟的会话信息 return { "conversation_id": f"mock_conversation_{user_id}_{bot_id[:8]}", "bot_id": bot_id, "status": "active", } async def send_message( self, conversation_id: str, content: str, message_type: str = "text" ) -> Dict[str, Any]: """发送消息(模拟)""" logger.info(f"模拟发送消息到会话 {conversation_id}: {content[:50]}...") # 返回模拟的消息响应 return { "message_id": f"mock_msg_{conversation_id[:8]}", "content": f"这是对'{content[:30]}...'的模拟回复", "role": "assistant", } async def end_conversation(self, conversation_id: str) -> Dict[str, Any]: """结束会话(模拟)""" logger.info(f"模拟结束会话: {conversation_id}") return {"status": "completed", "conversation_id": conversation_id}