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/app/logger.py b/app/logger.py index 29c0bd9..c5d9ce1 100644 --- a/app/logger.py +++ b/app/logger.py @@ -15,7 +15,7 @@ def define_log_level(print_level="INFO", logfile_level="DEBUG", name: str = None _print_level = print_level current_date = datetime.now() - formatted_date = current_date.strftime("%Y%m%d") + formatted_date = current_date.strftime("%Y%m%d%H%M%S") log_name = ( f"{name}_{formatted_date}" if name else formatted_date ) # name a log with prefix name diff --git a/examples/japan-travel-plan/japan_travel_guide_instructions.txt b/examples/japan-travel-plan/japan_travel_guide_instructions.txt new file mode 100644 index 0000000..a45128f --- /dev/null +++ b/examples/japan-travel-plan/japan_travel_guide_instructions.txt @@ -0,0 +1,62 @@ +JAPAN TRAVEL HANDBOOK - GUIDE TO VERSIONS + +Location: D:/OpenManus/ + +1. DETAILED DIGITAL VERSION +File: japan_travel_handbook.html +Best for: Desktop/laptop viewing +Features: +- Complete comprehensive guide +- Detailed itinerary +- Full proposal planning section +- All hotel recommendations +- Comprehensive budget breakdown +Usage: Open in web browser for trip planning and detailed reference + +2. PRINT-FRIENDLY VERSION +File: japan_travel_handbook_print.html +Best for: Physical reference during travel +Features: +- Condensed essential information +- Optimized for paper printing +- Clear, printer-friendly formatting +- Quick reference tables +Usage: Print and keep in travel documents folder + +3. MOBILE-OPTIMIZED VERSION +File: japan_travel_handbook_mobile.html +Best for: On-the-go reference during trip +Features: +- Touch-friendly interface +- Collapsible sections +- Quick access emergency buttons +- Dark mode support +- Responsive design +Usage: Save to phone's browser bookmarks for quick access + +RECOMMENDED SETUP: +1. Before Trip: + - Use detailed version for planning + - Print the print-friendly version + - Save mobile version to phone + +2. During Trip: + - Keep printed version with travel documents + - Use mobile version for daily reference + - Access detailed version when needed for specific information + +3. Emergency Access: + - Mobile version has quick-access emergency information + - Keep printed version as backup + - All emergency numbers and contacts in both versions + +Note: All versions contain the same core information but are formatted differently for optimal use in different situations. + +IMPORTANT DATES: +- Trip Duration: April 15-23, 2024 +- Proposal Day: April 19, 2024 +- Key Reservation Deadlines: + * Flights: Book by January 2024 + * Hotels: Book by February 2024 + * Restaurant Reservations: Book by January 2024 + * JR Pass: Purchase by March 2024 diff --git a/examples/japan-travel-plan/japan_travel_handbook.html b/examples/japan-travel-plan/japan_travel_handbook.html new file mode 100644 index 0000000..5b5965e --- /dev/null +++ b/examples/japan-travel-plan/japan_travel_handbook.html @@ -0,0 +1,124 @@ + + + + + + Japan Travel Handbook - April 15-23, 2024 + + + +
+ [Previous content remains the same...] + +
+

🌸 Proposal Planning Guide 🌸

+ +

Ring Security & Transport

+ + +

Proposal Location Details - Maruyama Park

+ + +

Proposal Day Planning

+ + +

Celebration Dinner Options

+ + +
+

Important Notes:

+
    +
  • Keep proposal plans in separate notes from shared itinerary
  • +
  • Have a backup plan in case of rain (indoor locations listed above)
  • +
  • Consider hiring a local photographer to capture the moment
  • +
  • Save restaurant staff contact info in case of timing changes
  • +
+
+
+
+ + diff --git a/examples/japan-travel-plan/japan_travel_handbook_mobile.html b/examples/japan-travel-plan/japan_travel_handbook_mobile.html new file mode 100644 index 0000000..00e1a92 --- /dev/null +++ b/examples/japan-travel-plan/japan_travel_handbook_mobile.html @@ -0,0 +1,255 @@ + + + + + + Japan Travel Guide (Mobile) + + + +
+

Japan Travel Guide

+

April 15-23, 2024

+ +
+ + + + +
+ +
+

Emergency Contacts

+ +
+ + +
+
+ + + + + + + + + +
DateLocationActivities
Apr 15TokyoArrival, Shinjuku
Apr 16TokyoMeiji, Harajuku, Senso-ji
Apr 17TokyoTea Ceremony, Budokan
Apr 18KyotoTravel, Kinkaku-ji
Apr 19KyotoFushimi Inari, Proposal
Apr 20NaraDeer Park, Temples
Apr 21TokyoReturn, Bay Cruise
+
+
+ + +
+
+ + + + + + + +
EnglishJapanese
Thank youありがとう
Excuse meすみません
Pleaseお願いします
Where is......はどこですか
Help!助けて!
+
+
+ + +
+
+

Key Routes

+
    +
  • Tokyo-Kyoto: 2h15m
  • +
  • Kyoto-Nara: 45m
  • +
  • Last trains: ~midnight
  • +
+

JR Pass: Activate April 15

+
+
+ + +
+
+

April 19 Timeline

+
    +
  • 4:00 PM: Head to Maruyama Park
  • +
  • 5:30 PM: Arrive at spot
  • +
  • 7:00 PM: Dinner at Kikunoi Roan
  • +
+

Backup: Gion Shirakawa area

+
+
+ + +
+
+ + + + + + + +
ItemBudget
Hotels$1500-2000
Transport$600-800
Food$800-1000
Activities$600-800
Shopping$500-400
+
+
+
+ + + + diff --git a/examples/japan-travel-plan/japan_travel_handbook_print.html b/examples/japan-travel-plan/japan_travel_handbook_print.html new file mode 100644 index 0000000..b924628 --- /dev/null +++ b/examples/japan-travel-plan/japan_travel_handbook_print.html @@ -0,0 +1,162 @@ + + + + + Japan Travel Handbook (Print Version) - April 15-23, 2024 + + + +

Japan Travel Handbook (Print Version)

+

Trip Dates: April 15-23, 2024

+ +
+

Emergency Contacts & Important Information

+ +
+ +
+

Daily Itinerary Summary

+ + + + + + + + + +
DateLocationKey Activities
Apr 15TokyoArrival, Shinjuku area exploration
Apr 16TokyoMeiji Shrine, Harajuku, Senso-ji, Skytree
Apr 17TokyoTea Ceremony, Budokan, Yanaka Ginza
Apr 18KyotoTravel to Kyoto, Kinkaku-ji, Gion
Apr 19KyotoFushimi Inari, Arashiyama, Evening Proposal
Apr 20Nara/KyotoNara Park day trip, deer feeding
Apr 21TokyoReturn to Tokyo, bay cruise
+
+ +
+ +
+

Essential Japanese Phrases

+ + + + + + + +
EnglishJapaneseWhen to Use
Arigatou gozaimasuありがとうございますThank you (formal)
SumimasenすみませんExcuse me/Sorry
Onegaishimasuお願いしますPlease
Toire wa doko desu ka?トイレはどこですか?Where is the bathroom?
Eigo ga hanasemasu ka?英語が話せますか?Do you speak English?
+
+ +
+

Transportation Notes

+ +
+ +
+ +
+

Proposal Day Timeline (April 19)

+ + + + + + + +
TimeActivityNotes
4:00 PMHead to Maruyama ParkCheck weather first
4:30 PMTea house visitLight refreshments
5:15 PMPark walk beginsHead to weeping cherry tree
5:30 PMArrive at spotFind quiet area
7:00 PMDinner reservationKikunoi Roan
+

Backup Location: Gion Shirakawa area (in case of rain)

+
+ +
+

Quick Reference Budget

+ + + + + + + +
ItemBudget (USD)Notes
Hotels1500-2000Pre-booked
Transport600-800Including JR Pass
Food800-1000~$60/person/day
Activities600-800Including tea ceremony
Shopping500-400Souvenirs/gifts
+
+ + diff --git a/examples/readme.md b/examples/readme.md new file mode 100644 index 0000000..74a103a --- /dev/null +++ b/examples/readme.md @@ -0,0 +1,4 @@ +# Examples + +We put some examples in the `examples` directory. All the examples use the same prompt as `Manus`. +The Model we use is `claude3.5`. 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