开源智能体框架 OpenManus
安装配置
以 windows11 为例。
- 安装 OpenManus 框架包
shell
git clone https://github.com/mannaandpoem/OpenManus.git
cd OpenManus
conda create -n open_manus python=3.12
conda activate open_manus
pip install -r requirements.txt
一键安装包下载地址:OpenManus.rar
- (可选)安装 Playwright,用来控制浏览器行为。 首先安装 nodeJS,之后安装 Playwright
shell
# 全局安装 playwright
npm install -g playwright
# 下载浏览器(如 Chromium、Firefox 和 WebKit)才能运行(自动下载所需的浏览器并安装到默认路径 C:\Users\Administrator\AppData\Local\ms-playwright)
npx playwright install
- 配置配置文件
shell
# 进入 OpenManus/config 配置目录
cd config
# 复制配置文件
cp config/config.example.toml config/config.toml
编辑配置文件,内容如下:
shell
# Global LLM configuration
[llm]
model = "qwen-long"
base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1"
api_key = "sk-xxx"
max_tokens = 4096
temperature = 0.8
# Optional configuration for specific LLM models
[llm.vision]
[llm.vision]
model = "qwen-vl-max"
base_url = "https://dashscope.aliyuncs.com/compatible-mode/v1"
api_key = "sk-xxx"
max_tokens = 4096
temperature = 0.8
核心注意以下几点:
- 找调用的模型,以 qwen 为例,可在 百炼模型列表 中查找适合自己的模型
- base_url: 以 qwen-long 模型为例,我们可以从模型的 代码示例 中找出 base_url
- api_key:以 qwen 系列为例,可以从百炼平台的个人中心查询
- temperature:该值越小,确定性越高;该值越大,AI 的想象力越放飞,例如是诗歌创作。
如果是使用 Ollama 运行本地模型,则可以进行如下配置。
shell
# Global LLM configuration 替换为自己的参数
[llm]
model = "qwq"
base_url = "http://localhost:11434/v1"
api_key = "ollama"
max_tokens = 4096
temperature = 0.8
# Optional configuration for specific LLM models 替换为自己的参数
[llm.vision]
model = "qwq"
base_url = "http://localhost:11434/v1"
api_key = "ollama"
max_tokens = 4096
temperature = 0.8
开始使用
shell
# 进入项目目录
cd OpenManus
# 在终端打开对话窗口
python main.py
测试指令:
shell
Enter your prompt (or 'exit' to quit): 查询下呼和浩特今天的天气情况
OpenManus 首先会调用 google_search
工具拉取一些链接,之后会选择一个最权威的链接(比如,中国气象局)使用 browser_use
直接打开。
可视化界面
shell
# Global LLM configuration 替换为自己的参数
[llm]
model = "qwq"
base_url = "http://localhost:11434/v1"
api_key = "ollama"
max_tokens = 4096
temperature = 0.8
# Optional configuration for specific LLM models 替换为自己的参数
[llm.vision]
model = "qwq"
base_url = "http://localhost:11434/v1"
api_key = "ollama"
max_tokens = 4096
temperature = 0.8
# Server configuration
[server]
host = "localhost"
port = 5172
配置文件增加 server 模块。 启动脚本如下:
shell
python app.py
看到如下输出表示启动成功
shell
(D:\ai\OpenManus\open_manus_web) PS D:\ai\OpenManus> python app.py
INFO [browser_use] BrowserUse logging setup complete with level info
INFO [root] Anonymized telemetry enabled. See https://docs.browser-use.com/development/telemetry for more information.
INFO: Started server process [21192]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://localhost:5172 (Press CTRL+C to quit)
访问浏览器如下:
文章的最后,如果您觉得本文对您有用,请打赏一杯咖啡!感谢!
