From d921fc4248d80fad091984022ae88357bb7744f5 Mon Sep 17 00:00:00 2001 From: XBsleepy Date: Fri, 7 Mar 2025 23:27:31 +0800 Subject: [PATCH 1/4] update logger name to seconds level --- app/logger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From e70332bfa2779376978c52ef75761928803cb605 Mon Sep 17 00:00:00 2001 From: XBsleepy Date: Sat, 8 Mar 2025 00:01:29 +0800 Subject: [PATCH 2/4] add examples dir and the first example --- .../japan_travel_guide_instructions.txt | 62 +++++ .../japan_travel_handbook.html | 124 +++++++++ .../japan_travel_handbook_mobile.html | 254 ++++++++++++++++++ .../japan_travel_handbook_print.html | 158 +++++++++++ examples/readme.md | 3 + 5 files changed, 601 insertions(+) create mode 100644 examples/japan-travel-plan/japan_travel_guide_instructions.txt create mode 100644 examples/japan-travel-plan/japan_travel_handbook.html create mode 100644 examples/japan-travel-plan/japan_travel_handbook_mobile.html create mode 100644 examples/japan-travel-plan/japan_travel_handbook_print.html create mode 100644 examples/readme.md 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..175ae5a --- /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 \ No newline at end of file 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..7e4990f --- /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

+
    +
  • Carrying the Ring: +
      +
    • Always keep the ring in your carry-on luggage, never in checked bags
    • +
    • Use a discrete, non-branded box or case
    • +
    • Consider travel insurance that covers jewelry
    • +
    • Keep receipt/appraisal documentation separate from the ring
    • +
    +
  • +
  • Airport Security Tips: +
      +
    • No need to declare the ring unless value exceeds ¥1,000,000 (~$6,700)
    • +
    • If asked, simply state it's "personal jewelry"
    • +
    • Consider requesting private screening to maintain surprise
    • +
    • Keep ring in original box until through security, then transfer to more discrete case
    • +
    +
  • +
+ +

Proposal Location Details - Maruyama Park

+
    +
  • Best Timing: +
      +
    • Date: April 19 (Day 5)
    • +
    • Time: 5:30 PM (30 minutes before sunset)
    • +
    • Park closes at 8:00 PM in April
    • +
    +
  • +
  • Specific Spot Recommendations: +
      +
    • Primary Location: Near the famous weeping cherry tree +
      - Less crowded in early evening +
      - Beautiful illumination starts at dusk +
      - Iconic Kyoto backdrop +
    • +
    • Backup Location: Gion Shirakawa area +
      - Atmospheric stone-paved street +
      - Traditional buildings and cherry trees +
      - Beautiful in light rain +
    • +
    +
  • +
+ +

Proposal Day Planning

+
    +
  • Morning Preparation: +
      +
    • Confirm weather forecast
    • +
    • Transfer ring to secure pocket/bag
    • +
    • Have backup indoor location details ready
    • +
    +
  • +
  • Suggested Timeline: +
      +
    • 4:00 PM: Start heading to Maruyama Park area
    • +
    • 4:30 PM: Light refreshments at nearby tea house
    • +
    • 5:15 PM: Begin walk through park
    • +
    • 5:30 PM: Arrive at proposal spot
    • +
    • 6:00 PM: Sunset and illumination begins
    • +
    • 7:00 PM: Celebratory dinner reservation
    • +
    +
  • +
+ +

Celebration Dinner Options

+
    +
  • Traditional Japanese: Kikunoi Roan +
    - Intimate 2-star Michelin restaurant +
    - Advance reservation required (3 months) +
    - Price: ¥15,000-20,000 per person +
  • +
  • Modern Fusion: The Sodoh +
    - Beautiful garden views +
    - Western-style seating available +
    - Price: ¥12,000-15,000 per person +
  • +
+ +
+

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
  • +
+
+
+
+ + \ No newline at end of file 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..37428c2 --- /dev/null +++ b/examples/japan-travel-plan/japan_travel_handbook_mobile.html @@ -0,0 +1,254 @@ + + + + + + Japan Travel Guide (Mobile) + + + +
+

Japan Travel Guide

+

April 15-23, 2024

+ +
+ + + + +
+ +
+

Emergency Contacts

+
    +
  • 🚑 Emergency: 119
  • +
  • 👮 Police: 110
  • +
  • 🏢 US Embassy: +81-3-3224-5000
  • +
  • ℹ️ Tourist Info: 03-3201-3331
  • +
+
+ + +
+
+ + + + + + + + + +
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
+
+
+
+ + + + \ No newline at end of file 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..110f41b --- /dev/null +++ b/examples/japan-travel-plan/japan_travel_handbook_print.html @@ -0,0 +1,158 @@ + + + + + Japan Travel Handbook (Print Version) - April 15-23, 2024 + + + +

Japan Travel Handbook (Print Version)

+

Trip Dates: April 15-23, 2024

+ +
+

Emergency Contacts & Important Information

+
    +
  • Emergency in Japan: 119 (Ambulance/Fire) / 110 (Police)
  • +
  • US Embassy Tokyo: +81-3-3224-5000
  • +
  • Tourist Information Hotline: 03-3201-3331
  • +
  • Your Travel Insurance: [Write number here]
  • +
+
+ +
+

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

+
    +
  • JR Pass: Activate on April 15
  • +
  • Tokyo-Kyoto Shinkansen: ~2h15m
  • +
  • Kyoto-Nara Local Train: ~45m
  • +
  • Last trains: Usually around midnight
  • +
  • Keep ¥3000 for unexpected taxi rides
  • +
+
+ +
+ +
+

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
+
+ + \ No newline at end of file diff --git a/examples/readme.md b/examples/readme.md new file mode 100644 index 0000000..c8d2adb --- /dev/null +++ b/examples/readme.md @@ -0,0 +1,3 @@ +# 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`. \ No newline at end of file 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 3/4] 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 From f04beec4864de067716958467f7ae1e1505db4ca Mon Sep 17 00:00:00 2001 From: liangxinbing <1580466765@qq.com> Date: Sat, 8 Mar 2025 17:20:29 +0800 Subject: [PATCH 4/4] format examples --- .../japan_travel_guide_instructions.txt | 2 +- .../japan_travel_handbook.html | 4 ++-- .../japan_travel_handbook_mobile.html | 5 +++-- .../japan_travel_handbook_print.html | 18 +++++++++++------- examples/readme.md | 5 +++-- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/examples/japan-travel-plan/japan_travel_guide_instructions.txt b/examples/japan-travel-plan/japan_travel_guide_instructions.txt index 175ae5a..a45128f 100644 --- a/examples/japan-travel-plan/japan_travel_guide_instructions.txt +++ b/examples/japan-travel-plan/japan_travel_guide_instructions.txt @@ -59,4 +59,4 @@ IMPORTANT DATES: * Flights: Book by January 2024 * Hotels: Book by February 2024 * Restaurant Reservations: Book by January 2024 - * JR Pass: Purchase by March 2024 \ No newline at end of file + * 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 index 7e4990f..5b5965e 100644 --- a/examples/japan-travel-plan/japan_travel_handbook.html +++ b/examples/japan-travel-plan/japan_travel_handbook.html @@ -28,7 +28,7 @@

🌸 Proposal Planning Guide 🌸

- +

Ring Security & Transport

  • Carrying the Ring: @@ -121,4 +121,4 @@
- \ No newline at end of file + diff --git a/examples/japan-travel-plan/japan_travel_handbook_mobile.html b/examples/japan-travel-plan/japan_travel_handbook_mobile.html index 37428c2..00e1a92 100644 --- a/examples/japan-travel-plan/japan_travel_handbook_mobile.html +++ b/examples/japan-travel-plan/japan_travel_handbook_mobile.html @@ -6,7 +6,8 @@ Japan Travel Guide (Mobile)