diff --git a/readme_cn.md b/readme_cn.md new file mode 100644 index 0000000..72a1126 --- /dev/null +++ b/readme_cn.md @@ -0,0 +1,58 @@ +# MetaGPT-docs 贡献指南 + +## 概述 + +本仓库托管 [MetaGPT](https://github.com/geekan/MetaGPT) 的[文档网站](https://docs.deepwisdom.ai/)。要做出贡献,只需准备一个**markdown**文件并提交拉取请求(PR)。在您的PR获得批准并合并后,您的markdown文档将自动渲染到文档网站上。我们欢迎各种形式的提交,包括使用指南、错别字修正、实际应用等等! + +## 文件结构 + +```text + ├─ src + │ ├─ en # 英文文档 + │ │ ├─ index.md # 主页 + │ │ ├─ guide # 内容页面 + │ │ │ ├─ get_started # 网站上的版块 + │ │ │ │ ├─ introduction.md # 网站上的一个页面 + │ │ │ │ ├─ quickstart.md # 网站上的一个页面 + │ │ │ │ ├─ ... # 更多页面 + │ │ │ ├─ tutorials # 网站上的版块 + │ │ │ ├─ ... # 更多版块 + │ ├─ zh # 中文文档 与英文相同的结构 + │ ├─ rfcs # RFC文件 + │ ├─ public # 资源文件,在此处放置图片或视频 + │ ├─ blog # 博客文件 + │ ├─ utils # 一些工具 + ├─ vitepress/config.mts # 导航栏和侧边栏配置 +``` + +## 做出贡献 + +- 通过浏览`src/[语言]/guide`找到您感兴趣的文件并进行修改。文件的排列反映了文档网站上的层次结构。例如,`src/en/guide/get_started/quickstart.md`对应于`https://docs.deepwisdom.ai/en/guide/get_started/quickstart.html` +- 将您的媒体文件(如图片或视频)放在`src/public/image/guide`下,路径应与使用该媒体的文档相对应。不同语言的文档使用相同的媒体。在您的文档中,使用**相对路径**引用媒体 +- 翻译:如果您添加新文件,请将文档翻译成所有语言。我们将很快提供一个翻译代理 +- 要编辑侧边栏,请修改`src/.vitepress/config.mts`,找到`sidebar`下的字典 +- 提交并提交PR,完成! + +# 本地部署 + +如果您想预先检查您的更改在文档站点上的渲染效果,本节内容将对您有所帮助。 + +## 前提条件 + +- [Node.js](https://nodejs.org/en) 18版本或更高。 +- 支持[Markdown](https://en.wikipedia.org/wiki/Markdown)语法的文本编辑器。 + - 推荐使用[VSCode](https://code.visualstudio.com/),以及[官方Vue扩展](https://marketplace.visualstudio.com/items?itemName=Vue.volar)。 + +## 启动步骤 + +按照以下步骤启动开发服务器 + +1. `corepack enable pnpm` 以使用pnpm + + 或参考 [pnpm安装](https://pnpm.io/installation) + +2. `pnpm i` 安装依赖 + +3. `npm run docs:dev` + +开发服务器应该在 http://localhost:5173 运行。在浏览器中访问该URL,查看您的新站点! diff --git a/src/zh/guide/faq.md b/src/zh/guide/faq.md index fb5010c..eaada3d 100644 --- a/src/zh/guide/faq.md +++ b/src/zh/guide/faq.md @@ -76,7 +76,7 @@ MetaGPT社区-首席布道师 单月轮值,主要职责如下 - 注意:OpenAI的默认API设计尾部会有个v1,正确配置示例: `OPENAI_API_BASE: "``https://api.openai.com/v1``"` - 网络问题始终解决不了的同学,建议使用云端环境,参考 [MetaGPT快速体验](https://deepwisdom.feishu.cn/wiki/Q8ycw6J9tiNXdHk66MRcIN8Pnlg) -9. **Absolutely! How can I assist you today?** +9. **是否使用了Chi或者类似的服务?** - 是否使用了Chi或者类似的服务?这些服务有概率出错,目测在GPT-4 3.5k-4k token消耗时出错概率高 diff --git a/src/zh/guide/get_started/configuration.md b/src/zh/guide/get_started/configuration.md index 1fd4979..420e13a 100644 --- a/src/zh/guide/get_started/configuration.md +++ b/src/zh/guide/get_started/configuration.md @@ -11,10 +11,10 @@ ## 其他配置(可选) -Check [config2.example.yaml](https://github.com/geekan/MetaGPT/blob/main/config/config2.example.yaml) and -[config2.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/config2.py) for more details. +请查看 [config2.example.yaml](https://github.com/geekan/MetaGPT/blob/main/config/config2.example.yaml) 和 +[config2.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/config2.py) 获取完整配置参考。 ```yaml -enable_longterm_memory: false -prompt_schema: json #json or markdown +enable_longterm_memory: false # 是否启用长期记忆 +prompt_schema: json # 提示词格式(json 或 markdown) ``` diff --git a/src/zh/guide/get_started/configuration/llm_api_configuration.md b/src/zh/guide/get_started/configuration/llm_api_configuration.md index efb09cc..e8bfa7b 100644 --- a/src/zh/guide/get_started/configuration/llm_api_configuration.md +++ b/src/zh/guide/get_started/configuration/llm_api_configuration.md @@ -14,21 +14,18 @@ ```yaml llm: - api_type: 'openai' # or azure / ollama / groq etc. Check LLMType for more options - api_key: 'sk-...' # YOUR_API_KEY - model: 'gpt-4-turbo' # or gpt-3.5-turbo - # base_url: 'https://api.openai.com/v1' # or any forward url. - # proxy: 'YOUR_LLM_PROXY_IF_NEEDED' # Optional. If you want to use a proxy, set it here. - # pricing_plan: 'YOUR_PRICING_PLAN' # Optional. If your pricing plan uses a different name than the `model`. + api_type: 'openai' # 或 azure/ollama/groq 等,更多选项请查看 LLMType + model: 'gpt-4-turbo' # 或 gpt-3.5-turbo + base_url: 'https://api.openai.com/v1' # 或转发地址/其他LLM地址 + api_key: 'YOUR_API_KEY' + # proxy: 'YOUR_LLM_PROXY_IF_NEEDED' # 可选。如需使用代理请在此设置 + # pricing_plan: 'YOUR_PRICING_PLAN' # 可选。如果您的资费计划名称与`model`不同 ``` -请记住:如果您按照[安装](./installation)中的`git clone`方法,`config/config2.yaml` -文件已经存在。只需编辑它或创建一个名为`~/.metagpt/config2.yaml`的副本进行编辑。这样您就不会意外地使用git提交和共享您的API密钥。 - -> 注意: -> MetaGPT将按照以下优先顺序读取您的设置:`~/.metagpt/config2.yaml > config/config2.yaml` +> **注意**: +> 配置优先级为 `~/.metagpt/config2.yaml > config/config2.yaml` -如果想使用openai o1系列,需要额外配置下述信息 +如需使用OpenAI o1系列模型,需要添加以下额外配置: ```yaml llm: @@ -39,15 +36,15 @@ llm: stream: false ``` -可以用于初始化LLM,由于o1系列使用有些限制,出现问题可以及时反馈我们。 +该配置可用于初始化LLM。由于o1系列存在使用限制,遇到问题请及时向我们反馈。 -现在您可以开始使用了!请参阅[快速入门](./quickstart)或我们的[教程](/guide/tutorials/agent_101)以进行第一次运行! +完成上述步骤后,您的配置即告完成。要开始使用MetaGPT,请查看[快速入门指南](./quickstart)或我们的[教程](/en/guide/tutorials/agent_101)。 MetaGPT还支持各种LLM模型,根据您的需求配置模型API的密钥。 ## Anthropic / Claude API -支持模型名列表,在`metagpt/utils/token_counter.py`的`claude-*` +支持模型列表请查看 `metagpt/utils/token_counter.py` 中的 `claude-*` 系列 ```yaml llm: @@ -57,9 +54,9 @@ llm: model: 'claude-3-opus-20240229' ``` -## 智谱 API +## 智谱AI API -访问 [llm_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/llm_config.py) 获得更新详情。 +完整配置请参考[llm_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/llm_config.py) ```yaml llm: @@ -72,6 +69,8 @@ llm: 访问 [llm_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/llm_config.py) 获得更新详情。 +通常只需修改 `SPARK_APPID`、`SPARK_API_SECRET` 和 `SPARK_API_KEY` + ```yaml llm: api_type: 'spark' @@ -84,20 +83,20 @@ llm: ## Azure OpenAI API -访问 [llm_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/llm_config.py) 获得更新详情。 +完整配置请参考[llm_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/llm_config.py) ```yaml llm: api_type: 'azure' base_url: 'YOUR_AZURE_BASE_URL' api_key: 'YOUR_API_KEY' - api_version: 'YOUR_API_VERSION' # such as '2024-03-01-preview' - model: 'YOUR_MODEL_NAME' # or YOUR_DEPLOYMENT_NAME + api_version: 'YOUR_API_VERSION' # 例如 '2024-03-01-preview' + model: 'YOUR_MODEL_NAME' # 或您的部署名称 ``` ## 谷歌 Gemini -默认支持模型`gemini-pro` +默认支持模型 `gemini-pro` ```yaml llm: @@ -108,7 +107,7 @@ llm: ## 百度 千帆 API -支持`ERNIE-*`模型和部分主流开源模型,详见`metagpt/utils/token_counter.py` +支持 `ERNIE-*` 模型及主流开源模型,完整列表见 `metagpt/utils/token_counter.py` ### 使用安全认证AK/SK鉴权 @@ -119,7 +118,7 @@ llm: api_type: 'qianfan' access_key: 'YOUR_ACCESS_KEY' secret_key: 'YOUR_SECRET_KEY' - model: 'YOUR_MODEL_NAME like ERNIE-Bot-turbo' + model: 'ERNIE-Bot-turbo' # 示例模型名称 ``` 使用`endpoint`进行调用 @@ -129,45 +128,45 @@ llm: api_type: 'qianfan' access_key: 'YOUR_ACCESS_KEY' secret_key: 'YOUR_SECRET_KEY' - endpoint: 'YOUR_ENDPOINT_NAME like ernie_speed' + endpoint: 'ernie_speed' # 示例终端节点名称 ``` ### 使用应用AK/SK鉴权(不推荐) -使用`model`进行调用 +使用`model`参数: ```yaml llm: api_type: 'qianfan' api_key: 'YOUR_API_KEY' secret_key: 'YOUR_SECRET_KEY' - model: 'YOUR_MODEL_NAME like ERNIE-Bot-turbo' + model: 'ERNIE-Bot-turbo' # 示例模型名称 ``` -使用`endpoint`进行调用 +使用`endpoint`参数(适用于自部署模型): ```yaml llm: api_type: 'qianfan' api_key: 'YOUR_API_KEY' secret_key: 'YOUR_SECRET_KEY' - endpoint: 'YOUR_ENDPOINT_NAME like ernie_speed' + endpoint: 'ernie_speed' # 示例终端节点名称 ``` ## 阿里云 灵积 DashScope API -支持`qwen-*`模型和部分主流开源模型,详见`metagpt/utils/token_counter.py` +支持 `qwen-*` 模型及主流开源模型,完整列表见 `metagpt/utils/token_counter.py` ```yaml llm: api_type: 'dashscope' api_key: 'YOUR_API_KEY' - model: 'YOUR_ENDPOINT_NAME like qwen-max' + model: 'qwen-max' # 示例模型名称 ``` ## 月之暗面 Moonshot / Kimi API -支持 `moonshot-v1-*`模型,详见`metagpt/utils/token_counter.py` +支持 `moonshot-v1-*` 模型,完整列表见 `metagpt/utils/token_counter.py` ```yaml llm: @@ -179,7 +178,7 @@ llm: ## Fireworks API -支持 `Fireworks`models模型,详见`metagpt/utils/token_counter.py` +支持 `Fireworks` 模型,完整列表见 `metagpt/utils/token_counter.py` ```yaml llm: @@ -191,7 +190,7 @@ llm: ## Mistral API -支持 `Mistral`models模型,详见`metagpt/utils/token_counter.py` +支持 `Mistral` 模型,完整列表见 `metagpt/utils/token_counter.py` ```yaml llm: @@ -214,7 +213,7 @@ llm: max_token: 4000 ``` -## ollama API +## Ollama API ```yaml llm: @@ -223,9 +222,9 @@ llm: model: 'llama2' ``` -## WizardLM-2-8x22b via [openrouter](https://openrouter.ai/) +## 通过[OpenRouter](https://openrouter.ai/)使用WizardLM-2-8x22b -如果你需要 [wizardlm-2-8x22b](https://openrouter.ai/models/microsoft/wizardlm-2-8x22b),可以使用如下配置 +如需使用 [wizardlm-2-8x22b](https://openrouter.ai/models/microsoft/wizardlm-2-8x22b),请使用以下配置: ```yaml llm: @@ -235,9 +234,9 @@ llm: model: microsoft/wizardlm-2-8x22b ``` -## Llama-3-70b instruct via [openrouter](https://openrouter.ai/) +## 通过[OpenRouter](https://openrouter.ai/)使用Llama-3-70b-instruct -如果你需要 [llama-3-70b instruct](https://openrouter.ai/models/meta-llama/llama-3-70b-instruct:nitro),可以使用如下配置 +如需使用 [llama-3-70b-instruct](https://openrouter.ai/models/meta-llama/llama-3-70b-instruct:nitro),请使用以下配置: ```yaml llm: @@ -247,16 +246,16 @@ llm: model: meta-llama/llama-3-70b-instruct:nitro ``` -## Llama-3-70b via [groq](https://groq.com/) +## 通过[Groq](https://groq.com/)使用Llama-3-70b -如果你需要 llama3-70b,可以使用如下配置 +如需使用llama3-70b,请使用以下配置: ```yaml llm: - # Visit https://console.groq.com/keys to create api key + # 访问 https://console.groq.com/keys 创建API密钥 base_url: 'https://api.groq.com/openai/v1' api_key: 'YOUR_API_KEY' - model: 'llama3-70b-8192' # llama3-8b-8192,llama3-70b-8192,llama2-70b-4096 ,mixtral-8x7b-32768,gemma-7b-it + model: 'llama3-70b-8192' # 可选模型:llama3-8b-8192,llama3-70b-8192,llama2-70b-4096,mixtral-8x7b-32768,gemma-7b-it ``` ## [Amazon Bedrock API](https://aws.amazon.com/bedrock) @@ -271,12 +270,12 @@ llm: llm: api_type: 'bedrock' model: 'meta.llama3-70b-instruct-v1:0' - region_name: 'REGION' # e.g. us-east-1 + region_name: 'REGION' # 例如 us-east-1 access_key: 'YOUR_ACCESS_KEY' secret_key: 'YOUR_SECRET_KEY' ``` -## 火山方舟的API +## 火山方舟API 支持模型名列表,在`metagpt/utils/token_counter.py`的`doubao-*` diff --git a/src/zh/guide/get_started/configuration/tools.md b/src/zh/guide/get_started/configuration/tools.md index d2a6ebf..32f6e6b 100644 --- a/src/zh/guide/get_started/configuration/tools.md +++ b/src/zh/guide/get_started/configuration/tools.md @@ -1,53 +1,56 @@ # 配置工具(可选) -除了让智能体能调用大模型,我们时常期望智能体能调用工具。我们需要配置好所需工具以完成准备工作。 +除了基础的大语言模型(LLM)调用,我们通常希望智能体能够使用各类工具。本节将介绍相关工具的配置方法。 ## 网页搜索 API -Check [search_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/search_config.py) for more details. +查看 [search_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/search_config.py) 获取更多详情。 ```yaml -## Supported api_type: serpapi/google/serper/ddg -## serper: Visit https://serper.dev/ to get key. -## serpapi: Visit https://serpapi.com/ to get key. -## google: Visit https://console.cloud.google.com/apis/credentials to get key. -## ddg: it is free, no need to get key. +## 支持的 api_type: serpapi/google/serper/ddg +## serper: 访问 https://serper.dev/ 获取 API 密钥 +## serpapi: 访问 https://serpapi.com/ 获取 API 密钥 +## google: 访问 https://console.cloud.google.com/apis/credentials 获取 API 密钥 +## ddg: 免费服务,无需 API 密钥 search: api_type: 'google' # serpapi/google/serper/ddg api_key: 'YOUR_API_KEY' - cse_id: 'YOUR_CSE_ID' # only for google + cse_id: 'YOUR_CSE_ID' # 仅适用于 google params: - engine: google # google/bing/yahoo/baidu/yandex, check https://serpapi.com/bing-search-api for more details + engine: google # 支持 google/bing/yahoo/baidu/yandex,更多细节请查看 https://serpapi.com/bing-search-api google_domain: 'google.com' - gl: us - hl: en + gl: us # 地理定位参数 + hl: en # 语言参数 ``` ## 网页浏览 +查看 [browser_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/browser_config.py) 获取更多详情。 + ```yaml browser: engine: 'playwright' # playwright/selenium - # for playwright engine, please check https://playwright.dev/python/docs/api/class-browsertype - # for selenium engine, please check https://www.selenium.dev/documentation/webdriver/browsers + # 使用 playwright 引擎时,请参考 https://playwright.dev/python/docs/api/class-browsertype + # 使用 selenium 引擎时,请参考 https://www.selenium.dev/documentation/webdriver/browsers browser_type: 'chrome' # playwright: chromium/firefox/webkit; selenium: chrome/firefox/edge/ie ``` -## Azure TTS +## Azure 文本转语音 ```yaml +### TTS 相关配置 azure_tts_subscription_key: 'YOUR_API_KEY' azure_tts_region: 'eastus' ``` -## Mermaid +## Mermaid 图表 -Check [mermaid_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/mermaid_config.py) for more details. +查看 [mermaid_config.py](https://github.com/geekan/MetaGPT/blob/main/metagpt/configs/mermaid_config.py) 获取更多详情。 ```yaml mermaid: engine: 'nodejs' # nodejs/ink/playwright/pyppeteer - path: 'mmdc' # such as './node_modules/.bin/mmdc' - puppeteer_config: './config/puppeteer-config' # only for nodejs - pyppeteer_path: '/usr/bin/google-chrome-stable' # only for pyppeteer + path: 'mmdc' # 例如 './node_modules/.bin/mmdc' + puppeteer_config: './config/puppeteer-config' # 仅适用于 nodejs + pyppeteer_path: '/usr/bin/google-chrome-stable' # 仅适用于 pyppeteer ``` diff --git a/src/zh/guide/get_started/quickstart.md b/src/zh/guide/get_started/quickstart.md index 66a0b2c..5b6ef6c 100644 --- a/src/zh/guide/get_started/quickstart.md +++ b/src/zh/guide/get_started/quickstart.md @@ -10,13 +10,15 @@ pip install metagpt ## 配置 -完整配置不同LLM API(比如OpenAI、Azure、Anthropic等)的方法可在 [配置](./configuration/llm_api_configuration.md) 部分找到。 +不同LLM API(OpenAI、Azure、Anthropic等)及其他组件的配置方法请参考[配置指南](./configuration/llm_api_configuration.md) -## 一句话需求的软件开发 +对于正式使用MetaGPT,建议使用config2.yaml进行配置。具体说明请参考[配置文档](./configuration) + +## 用一句话需求开发软件 > 注意: > -> 下面为 [software startup example](https://github.com/geekan/MetaGPT/blob/main/metagpt/software_company.py) 的节选。如果你使用`git clone`方法进行安装,只需简单执行 +> 以下是对[软件启动示例](https://github.com/geekan/MetaGPT/blob/main/metagpt/software_company.py)的分解说明。如果您通过git clone方式安装MetaGPT,只需直接运行: > > ``` > metagpt "write a cli blackjack game" @@ -64,7 +66,7 @@ await startup(idea="write a cli blackjack game") # blackjack: 二十一点 运行效果大致如下: -