From 56d138220a721dd7e5731a5c3343b6f8cadc44ff Mon Sep 17 00:00:00 2001 From: liangxinbing <1580466765@qq.com> Date: Sat, 8 Mar 2025 17:17:40 +0800 Subject: [PATCH] fix typo in README; log full arguments on parse json err; remove empty prompt for main.py and run_flow.py; --- README.md | 3 ++- README_tw.md | 3 ++- README_zh.md | 3 ++- app/agent/toolcall.py | 2 +- main.py | 3 +++ run_flow.py | 19 ++++++++++++------- 6 files changed, 22 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 95351bd..c9a2916 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,7 @@ Join our networking group on Feishu and share your experience with other develop ## Acknowledgement -Thanks to [anthropic-computer-use](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) and [broswer-use](https://github.com/browser-use/browser-use) for providing basic support for this project! +Thanks to [anthropic-computer-use](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) +and [browser-use](https://github.com/browser-use/browser-use) for providing basic support for this project! OpenManus is built by contributors from MetaGPT. Huge thanks to this agent community! diff --git a/README_tw.md b/README_tw.md index 85b9cc8..5519057 100644 --- a/README_tw.md +++ b/README_tw.md @@ -112,6 +112,7 @@ python run_flow.py ## 致謝 -感謝 [anthropic-computer-use](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) 和 [broswer-use](https://github.com/browser-use/browser-use) 為本項目提供基本支持! +感謝 [anthropic-computer-use](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) +和 [browser-use](https://github.com/browser-use/browser-use) 為本項目提供基本支持! OpenManus 由 MetaGPT 的貢獻者構建。非常感謝這個代理社區! diff --git a/README_zh.md b/README_zh.md index af8ece8..dae4c5f 100644 --- a/README_zh.md +++ b/README_zh.md @@ -112,6 +112,7 @@ python run_flow.py ## 致谢 -特别感谢 [anthropic-computer-use](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) 和 [broswer-use](https://github.com/browser-use/browser-use) 为本项目提供的基础支持! +特别感谢 [anthropic-computer-use](https://github.com/anthropics/anthropic-quickstarts/tree/main/computer-use-demo) +和 [browser-use](https://github.com/browser-use/browser-use) 为本项目提供的基础支持! OpenManus 由 MetaGPT 社区的贡献者共同构建,感谢这个充满活力的智能体开发者社区! diff --git a/app/agent/toolcall.py b/app/agent/toolcall.py index 374a6eb..b3b6439 100644 --- a/app/agent/toolcall.py +++ b/app/agent/toolcall.py @@ -154,7 +154,7 @@ class ToolCallAgent(ReActAgent): except json.JSONDecodeError: error_msg = f"Error parsing arguments for {name}: Invalid JSON format" logger.error( - f"📝 Oops! The arguments for '{name}' don't make sense - invalid JSON" + f"📝 Oops! The arguments for '{name}' don't make sense - invalid JSON, arguments:{command.function.arguments}" ) return f"Error: {error_msg}" except Exception as e: diff --git a/main.py b/main.py index 44ab9da..56c9f7a 100644 --- a/main.py +++ b/main.py @@ -12,6 +12,9 @@ async def main(): if prompt.lower() == "exit": logger.info("Goodbye!") break + if prompt.strip().isspace(): + logger.warning("Skipping empty prompt.") + continue logger.warning("Processing your request...") await agent.run(prompt) except KeyboardInterrupt: diff --git a/run_flow.py b/run_flow.py index 66e2db8..34d4242 100644 --- a/run_flow.py +++ b/run_flow.py @@ -3,29 +3,34 @@ import asyncio from app.agent.manus import Manus from app.flow.base import FlowType from app.flow.flow_factory import FlowFactory +from app.logger import logger async def run_flow(): - agent = Manus() + agents = { + "manus": Manus(), + } while True: try: prompt = input("Enter your prompt (or 'exit' to quit): ") if prompt.lower() == "exit": - print("Goodbye!") + logger.info("Goodbye!") break flow = FlowFactory.create_flow( flow_type=FlowType.PLANNING, - agents=agent, + agents=agents, ) - - print("Processing your request...") + if prompt.strip().isspace(): + logger.warning("Skipping empty prompt.") + continue + logger.warning("Processing your request...") result = await flow.execute(prompt) - print(result) + logger.info(result) except KeyboardInterrupt: - print("Goodbye!") + logger.warning("Goodbye!") break