()
| 775 | # print(f"Initializing skills in temporary directory: {skills_dir}") |
| 776 | |
| 777 | async def _run(): |
| 778 | try: |
| 779 | async_gen = _yield_mcp_response( |
| 780 | chat_model, |
| 781 | system_prompt, |
| 782 | message_list, |
| 783 | mcp_servers, |
| 784 | mcp_output_enable, |
| 785 | tool_init_params, |
| 786 | source_id, |
| 787 | source_type, |
| 788 | temp_dir, |
| 789 | chat_id, |
| 790 | extra_tools, |
| 791 | ) |
| 792 | async for chunk in async_gen: |
| 793 | result_queue.put(("data", chunk)) |
| 794 | except Exception as e: |
| 795 | maxkb_logger.error(f"Exception: {e}", exc_info=True) |
| 796 | result_queue.put(("error", e)) |
| 797 | finally: |
| 798 | result_queue.put(("done", None)) |
| 799 | |
| 800 | # 在全局循环中调度任务 |
| 801 | asyncio.run_coroutine_threadsafe(_run(), loop) |
no test coverage detected