From 85bd75d2366aa995019ddcaac184c12a9452025c Mon Sep 17 00:00:00 2001 From: gantnocap Date: Sun, 9 Mar 2025 13:11:44 +0800 Subject: [PATCH 1/2] feat: improve input handling - Add support for 'quit' command alongside 'exit' - Update input prompt to show both exit options - Enhance empty input handling to catch both empty strings and whitespace - Replace isspace() check with more robust empty string validation - Optimize command checking by storing lowercase result - Improve code readability and user experience --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 56c9f7a..0e5c52a 100644 --- a/main.py +++ b/main.py @@ -8,11 +8,12 @@ async def main(): agent = Manus() while True: try: - prompt = input("Enter your prompt (or 'exit' to quit): ") - if prompt.lower() == "exit": + prompt = input("Enter your prompt (or 'exit'/'quit' to quit): ") + prompt_lower = prompt.lower() + if prompt_lower in ["exit", "quit"]: logger.info("Goodbye!") break - if prompt.strip().isspace(): + if not prompt.strip(): logger.warning("Skipping empty prompt.") continue logger.warning("Processing your request...") From 52b67090a03d2d16dd0705aec02d43ae6175887a Mon Sep 17 00:00:00 2001 From: gantnocap Date: Sun, 9 Mar 2025 13:36:51 +0800 Subject: [PATCH 2/2] docs: improve installation guide, add uv for fast installation --- README.md | 34 ++++++++++++++++++++++++++++++++++ README_zh.md | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/README.md b/README.md index 4d670d4..b4beade 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,10 @@ We're also excited to introduce [OpenManus-RL](https://github.com/OpenManus/Open ## Installation +We provide two installation methods. Method 2 (using uv) is recommended for faster installation and better dependency management. + +### Method 1: Using conda + 1. Create a new conda environment: ```bash @@ -42,6 +46,36 @@ cd OpenManus pip install -r requirements.txt ``` +### Method 2: Using uv (Recommended) + +1. Install uv (A fast Python package installer and resolver): + +```bash +curl -LsSf https://astral.sh/uv/install.sh | sh +``` + +2. Clone the repository: + +```bash +git clone https://github.com/mannaandpoem/OpenManus.git +cd OpenManus +``` + +3. Create a new virtual environment and activate it: + +```bash +uv venv +source .venv/bin/activate # On Unix/macOS +# Or on Windows: +# .venv\Scripts\activate +``` + +4. Install dependencies: + +```bash +uv pip install -r requirements.txt +``` + ## Configuration OpenManus requires configuration for the LLM APIs it uses. Follow these steps to set up your configuration: diff --git a/README_zh.md b/README_zh.md index 10c99ec..bf16a86 100644 --- a/README_zh.md +++ b/README_zh.md @@ -22,6 +22,10 @@ Manus 非常棒,但 OpenManus 无需邀请码即可实现任何创意 🛫! ## 安装指南 +我们提供两种安装方式。推荐使用方式二(uv),因为它能提供更快的安装速度和更好的依赖管理。 + +### 方式一:使用 conda + 1. 创建新的 conda 环境: ```bash @@ -42,6 +46,36 @@ cd OpenManus pip install -r requirements.txt ``` +### 方式二:使用 uv(推荐) + +1. 安装 uv(一个快速的 Python 包管理器): + +```bash +curl -LsSf https://astral.sh/uv/install.sh | sh +``` + +2. 克隆仓库: + +```bash +git clone https://github.com/mannaandpoem/OpenManus.git +cd OpenManus +``` + +3. 创建并激活虚拟环境: + +```bash +uv venv +source .venv/bin/activate # Unix/macOS 系统 +# Windows 系统使用: +# .venv\Scripts\activate +``` + +4. 安装依赖: + +```bash +uv pip install -r requirements.txt +``` + ## 配置说明 OpenManus 需要配置使用的 LLM API,请按以下步骤设置: