| | |
| | | # 标记当前是否为来电接听模式 |
| | | self.incoming_call = None |
| | | |
| | | # Phase 1 App Runtime(连接内存,不建表) |
| | | self.active_app_id = "chat" |
| | | self.current_task_id = "conversation" |
| | | self.interaction_mode = "CHAT" |
| | | self.current_source = "default_chat" |
| | | self.tool_policy = "inherit_agent" |
| | | self.tool_allowlist = [] |
| | | self.original_system_prompt = None |
| | | self.awaiting_voice_app_choice = False |
| | | |
| | | async def handle_connection(self, ws: websockets.ServerConnection): |
| | | try: |
| | | # 获取运行中的事件循环(必须在异步上下文中) |
| | |
| | | self._init_prompt_enhancement() |
| | | """注入工具调用few-shot示例(仅function_call模式)""" |
| | | self._inject_tool_call_fewshot() |
| | | if self.original_system_prompt is None: |
| | | self.original_system_prompt = self.prompt |
| | | |
| | | except Exception as e: |
| | | self.logger.bind(tag=TAG).error(f"实例化组件失败: {e}") |