无需邀请码,小白也能轻松使用Manus

无需邀请码,小白也能轻松使用Manus

1.先安装python环境,百度搜索安装conda(若已经有了就可以直接开始)

打开命令行窗口输入以下指令

sh 复制代码
conda create -n open_manus python=3.12
conda activate open_manus

此时命令行前面,若带有(open_manus)则表示环境激活成功。

2.通过git 命令下载openManus代码
sh 复制代码
git clone https://github.com/mannaandpoem/OpenManus.git
cd openManus
3.安装依赖环境
复制代码
pip install -r requirements.txt
4.修改配置文件
4.1获取模型的app-key

若没有模型的app-key,可以注册硅基流动,通过下面链接进入可以免费获取api密钥,其中有赠送的余额,否则后面输入提示词后大模型api会返回402报错信息

http 复制代码
https://cloud.siliconflow.cn/i/04IwSgIl
4.2修改config.toml配置文件
sh 复制代码
cp config/config.example.toml config/config.toml
vim config/config.toml
sh 复制代码
# Global LLM configuration
[llm]
model = "deepseek-chat"  #我这里使用的deepseek模型,需要进行去充值token。
base_url = "https://api.deepseek.com/v1"
api_key = "sk-..."  #替换为你模型的app-key
max_tokens = 4096
temperature = 0.0

# Optional configuration for specific LLM models
[llm.vision]
model = "deepseek-chat"
base_url = "https://api.deepseek.com/v1"
api_key = "sk-..."  #替换为你模型的app-key

修改完毕后按 ESC, 输入:wq (冒号+wq+enter) 保存。

5.运行模型
python 复制代码
python main.py
6.输入提示词
lua 复制代码
编写HTHL5页面的贪吃蛇游戏可以正常玩,要求支持键盘操作。注意:处理相应的过程文件及结果文件都请放入当前目录 output/

​ 若报错如下402,证明是app-key余额不足,则需前往4.1步骤重新获取 ​

成功后

7.该项目默认采用google搜索,若无法科学上网,则需更换搜索引擎

7.1 更换百度搜索引擎

​ a.接着参考app/tool/google_search.py ,写一个baidu_search.py,我这里写好了直接复制到app/tool/下即可

python 复制代码
import asyncio
from typing import List

from baidusearch.baidusearch import search 
from app.tool.base import BaseTool


class BaiduSearch(BaseTool):
    name: str = "baidu_search"
    description: str = """Perform a Baidu search and return a list of relevant links.
Use this tool when you need to find information on the web, get up-to-date data, or research specific topics.
The tool returns a list of URLs that match the search query.
"""
    parameters: dict = {
        "type": "object",
        "properties": {
            "query": {
                "type": "string",
                "description": "(required) The search query to submit to Baidu.",
            },
            "num_results": {
                "type": "integer",
                "description": "(optional) The number of search results to return. Default is 10.",
                "default": 10,
            },
        },
        "required": ["query"],
    }

    async def execute(self, query: str, num_results: int = 10) -> List[str]:
        """
        Execute a Baidu search and return a list of URLs.

        Args:
            query (str): The search query to submit to Baidu.
            num_results (int, optional): The number of search results to return. Default is 10.

        Returns:
            List[str]: A list of URLs matching the search query.
        """
        # Run the search in a thread pool to prevent blocking
        loop = asyncio.get_event_loop()
        links = await loop.run_in_executor(
            None, lambda: [result['url'] for result in search(query, num_results=num_results)]
        )

        return links

	

​ b.修改app/agent/manus.py ,引入刚刚写好的baidu_search, 将原来的GoogleSearch() 替换为BaiduSearch(),

​

​ c.再而在控制台使用 pip 安装 python-baidusearch:

bash 复制代码
pip install baidusearch

7.2 更换为Bing搜索引擎,与上面百度类似

​ a.编写bing_search.py文件放入app/tool/目录下

python 复制代码
import asyncio
import aiohttp
from bs4 import BeautifulSoup
from typing import List

from app.tool.base import BaseTool


class BingSearch(BaseTool):
    name: str = "bing_search"
    description: str = """使用必应搜索返回相关链接列表。
    当需要查找网络信息、获取最新数据或研究特定主题时使用此工具。
    该工具返回与搜索查询匹配的URL列表。
    """
    parameters: dict = {
        "type": "object",
        "properties": {
            "query": {
                "type": "string",
                "description": "(必填) 提交给必应的搜索查询。",
            },
            "num_results": {
                "type": "integer",
                "description": "(可选) 要返回的搜索结果数量。默认为10。",
                "default": 10,
            },
        },
        "required": ["query"],
    }

    async def execute(self, query: str, num_results: int = 10) -> List[str]:
        """
        执行必应搜索并返回URL列表。

        参数:
            query (str): 要提交给必应的搜索查询。
            num_results (int, optional): 要返回的搜索结果数量。默认为10。

        返回:
            List[str]: 与搜索查询匹配的URL列表。
        """
        headers = {
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
        }
        search_url = f"https://www.bing.com/search?q={query}"

        async with aiohttp.ClientSession() as session:
            try:
                async with session.get(search_url, headers=headers) as response:
                    response.raise_for_status()
                    html = await response.text()
            except Exception as e:
                raise RuntimeError(f"必应搜索请求失败: {str(e)}")

        soup = BeautifulSoup(html, 'html.parser')
        links = []

        # 必应搜索结果链接通常在类名为"b_algo"的div内,具体选择器可能需要根据实际页面结构调整
        for result in soup.select('.b_algo'):
            a_tag = result.select_one('a')
            if a_tag and 'href' in a_tag.attrs:
                link = a_tag['href']
                links.append(link)
                if len(links) >= num_results:
                    break

        return links[:num_results]

​ b.修改app/agent/manus.py ,引入刚刚写好的bing_search, 将原来的GoogleSearch() 替换为BingSearch(),

​

​ c.再而在控制台使用 pip 安装 aiohttp beautifulsoup4:

sh 复制代码
pip install aiohttp beautifulsoup4

以上三步就成功更换了搜索引擎,然后重新执行main.py即可验证。

tip:若出现更多问题可在下面链接寻求帮助

http 复制代码
https://github.com/mannaandpoem/OpenManus/issues
相关推荐
Be for thing3 小时前
Pytorch【12】transforms进阶|图像数据增强实战,提升模型泛化能力
人工智能·pytorch·机器学习
十有八七3 小时前
手搓 Agent(一):先有大脑——大模型只会做一件事
前端·人工智能·后端
锋行天下3 小时前
「踩坑实录」给 LangGraph Agent 接两个 FastMCP,我被 langchain 偷偷改了工具名
前端·人工智能·后端
阿里云大数据AI技术3 小时前
穹彻智能 × MaxCompute:具身智能 UMI 数据产线的全模态计算实践
人工智能
联犀3 小时前
ai时代复杂项目的golang项目如何更好的与ai共舞:monorepo+gozero
开发语言·人工智能·golang
飞Link3 小时前
灵巧手是什么?从机械结构、驱动方式到控制原理,认识机器人的精细操作能力
人工智能·python·机器人
跳跳的小星星4 小时前
自研组件】Vue2 + ElementUI 通用列表页封装 wkjp-list-page,一套配置搞定搜索、动态表格、分页、增删改
前端
阿里云大数据AI技术4 小时前
从“扫文件”到“找数据行”:EMR Serverless StarRocks 支持 Paimon Global Index
人工智能
tryCbest4 小时前
Vue3—— 第 18 篇:Vue 2 到 Vue 3 迁移指南——升级避坑全记录
前端·vue.js
武子康4 小时前
AI通关了,游戏就算通过测试了吗?
人工智能·游戏·机器学习