无需邀请码,小白也能轻松使用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
相关推荐
狼性书生6 分钟前
uniapp实现的简约美观的星级评分组件
前端·uni-app·vue·组件
书语时9 分钟前
ES6 Promise 状态机
前端·javascript·es6
说私域10 分钟前
定制开发开源AI智能名片驱动下的海报工厂S2B2C商城小程序运营策略——基于社群口碑传播与子市场细分的实证研究
人工智能·小程序·开源·零售
拉不动的猪37 分钟前
管理不同权限用户的左侧菜单展示以及权限按钮的启用 / 禁用之其中一种解决方案
前端·javascript·面试
HillVue42 分钟前
AI,如何重构理解、匹配与决策?
人工智能·重构
skywalk81631 小时前
市面上哪款AI开源软件做ppt最好?
人工智能·powerpoint
西陵1 小时前
前端框架渲染DOM的的方式你知道多少?
前端·javascript·架构
小九九的爸爸1 小时前
我是如何让AI帮我还原设计稿的
前端·人工智能·ai编程
海的诗篇_1 小时前
前端开发面试题总结-JavaScript篇(一)
开发语言·前端·javascript·学习·面试
江城开朗的豌豆1 小时前
eval:JavaScript里的双刃剑,用好了封神,用不好封号!
前端·javascript·面试