AWorld icon indicating copy to clipboard operation
AWorld copied to clipboard

循环导入导致出现报错 chats.router not found

Open TheAriaYang opened this issue 1 year ago • 2 comments

在运行 aworld api 启动 API 服务时,进程崩溃并报错: AttributeError: partially initialized module 'aworld.cmd.web.routers.chats' has no attribute 'router' (most likely due to a circular import)

附加问题: Readme 写的命令是 aworld api_server 但运行后会报错 Error: No such command 'api_server'. 翻了代码发现现在应该是被改为了 api,建议一并修复下 readme 文件。

TheAriaYang avatar Aug 20 '25 14:08 TheAriaYang

循环依赖的部分在:

aworld/cmd/web/web_server.py from .routers import chats, workspaces, sessions, traces # noqa

aworld/cmd/web/routers/chats.py from aworld.cmd.web.web_server import get_user_id_from_jwt

TheAriaYang avatar Aug 20 '25 14:08 TheAriaYang

Thanks for your tips, Fixed @ https://github.com/inclusionAI/AWorld/pull/406

eric68668 avatar Aug 21 '25 06:08 eric68668