| | |
| | | "type": "function", |
| | | "function": { |
| | | "name": "switch_app", |
| | | "description": "切换设备当前 App。打开翻译、打开英语学习/复读、回到聊天、退出翻译时调用。app_id 只能是 chat、english_learning、english_translation。", |
| | | "description": ( |
| | | "切换设备当前 App。" |
| | | "chat=对话;english_translation=翻译;english_conversation=中英对话;" |
| | | "english_learning 需配合 task_id:repeater=复读机,shadowing=跟读。" |
| | | "退出当前模式、回到聊天时 app_id=chat。" |
| | | ), |
| | | "parameters": { |
| | | "type": "object", |
| | | "properties": { |
| | | "app_id": { |
| | | "type": "string", |
| | | "description": "目标 App:chat(聊天)、english_learning(复读)、english_translation(翻译)", |
| | | } |
| | | "description": "chat、english_learning、english_translation、english_conversation", |
| | | }, |
| | | "task_id": { |
| | | "type": "string", |
| | | "description": "可选。english_learning 下 repeater 或 shadowing;其它 App 可空", |
| | | }, |
| | | }, |
| | | "required": ["app_id"], |
| | | }, |
| | |
| | | |
| | | |
| | | @register_function("switch_app", switch_app_function_desc, ToolType.SYSTEM_CTL) |
| | | async def switch_app(conn: "ConnectionHandler", app_id: str): |
| | | async def switch_app(conn: "ConnectionHandler", app_id: str, task_id: str = ""): |
| | | from core.app_runtime.runtime import switch_app as runtime_switch |
| | | |
| | | result = await runtime_switch(conn, app_id, source="voice") |
| | | result = await runtime_switch(conn, app_id, source="voice", task_id=task_id or "") |
| | | if result.action == Action.ERROR: |
| | | return ActionResponse( |
| | | action=Action.RESPONSE, |