BAAI-Agents / Cradle

The Cradle framework is a first attempt at General Computer Control (GCC). Cradle supports agents to ace any computer task by enabling strong reasoning abilities, self-improvment, and skill curation, in a standardized general environment with minimal requirements.
https://baai-agents.github.io/Cradle/
MIT License
1.82k stars 159 forks source link

循环依赖问题 #87

Open 627539904 opened 5 days ago

627539904 commented 5 days ago

cardle.confg.config.py循环依赖cardle.gameio.gui_utils.py。 cardle.gameio.gui_utils.py与cardle.gameio.io_env.py循环依赖。 Config类,TargetWindow类,IOEnvironment类之间绕成一团。 这是我目前刚开始尝试运行项目就遇到的问题。 是我太菜了吗? 还是说,python中存在一种不需要在乎循环依赖就能正常运行的方式? 但看很多人提的问题都是已经能使用的问题。 是循环依赖不是问题,还是说他们都重构了一遍? 如果是项目本来就可以正常运行,请教一下,如何在保持大量循环依赖的情况下运行项目? ps: 如果可以,我不想大面积重构项目,这样后面版本更新就没法用了。

WeihaoTan commented 3 days ago

Thanks for reaching out. Could you elaborate on which env you are running? The code worked on our side and many other users also ran it successfully.

627539904 commented 3 days ago

Win11,VsCode,Pip

对于config.py和gameio模块的循环依赖,目前我是通过将config.py的import cradle.gameio从全局导入替换为局部导入临时解决的。但原有代码确实没办法直接运行,一直提示循环依赖。 和其他难以快速定位的问题不同,因为这是代码的结构的问题,过于明显,所以我很困惑。我甚至一度以为,Python已经能够智能解决循环依赖问题,或者您以及其他用户安装了能自动解决循环依赖的环境。但我并没有找到如此智能的方案。 从您的答复来看,循环依赖问题不是明确被解决了,而是没出现,或其他遇到的人没有提出。

所以,附上临时解决方式,或许对其他人有用: cradle_循环依赖_01 cradle_循环依赖_02

这不是一个优雅的解决方案,但可以临时凑合用。 随着项目复杂度的提升,后续可能有更好的解耦方式。