异步实现的workflow函数
(workflow_name: str, system_input: str)
| 91 | return asyncio.run(async_workflow(workflow_name, system_input)) |
| 92 | |
| 93 | async def async_workflow(workflow_name: str, system_input: str): |
| 94 | """异步实现的workflow函数""" |
| 95 | workflow_module = importlib.import_module(f'autoagent.workflows') |
| 96 | try: |
| 97 | workflow_func = getattr(workflow_module, workflow_name) |
| 98 | except AttributeError: |
| 99 | raise ValueError(f'Workflow function {workflow_name} not found...') |
| 100 | |
| 101 | result = await workflow_func(system_input) # 使用 await 等待异步函数完成 |
| 102 | debug_print(True, result, title=f'Result of running {workflow_name} workflow', color='pink3') |
| 103 | return result |
| 104 | |
| 105 | def clear_screen(): |
| 106 | console = Console() |
no test coverage detected