diff options
Diffstat (limited to 'packages/web/src/content/docs/zh-cn/server.mdx')
| -rw-r--r-- | packages/web/src/content/docs/zh-cn/server.mdx | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/packages/web/src/content/docs/zh-cn/server.mdx b/packages/web/src/content/docs/zh-cn/server.mdx index 985efedac..4f19cb5d4 100644 --- a/packages/web/src/content/docs/zh-cn/server.mdx +++ b/packages/web/src/content/docs/zh-cn/server.mdx @@ -1,5 +1,5 @@ --- -title: 伺服器 +title: 服务器 description: 通过 HTTP 与 opencode 服务器交互。 --- @@ -18,7 +18,7 @@ opencode serve [--port <number>] [--hostname <string>] [--cors <origin>] #### 選項 -| 旗幟 | 描述 | 預設 | +| 旗幟 | 描述 | 默认 | | --------------- | ----------------------------------- | ---------------- | | `--port` | 监听音频 | `4096` | | `--hostname` | 监听的主机名 | `127.0.0.1` | @@ -61,7 +61,7 @@ opencode TUI running, `opencode serve` will start a new server. --- -#### 連線到現有伺服器 +#### 连接到現有服务器 当您启动 TUI 时,它会随机分配端口和主机名。您可以重新设置 `--hostname` 和 `--port` [flags](/docs/cli)。使用它连线到其服务器然后器。 @@ -71,7 +71,7 @@ opencode TUI running, `opencode serve` will start a new server. ## 規格 -服务器发布了OpenAPI 3.1规范,可以在以下位置检视: +服务器发布了OpenAPI 3.1规范,可以在以下位置查看: ``` http://<hostname>:<port>/doc @@ -89,34 +89,34 @@ opencode服务器公开以下API。 ### 全球的 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ---------------- | ------------------------ | ------------------------------------ | | `GET` | `/global/health` | 获取服务器运行状况和版本 | `{ healthy: true, version: string }` | | `GET` | `/global/event` | 获取全域性事件(SSE 流) | 事件流 | --- -### 專案 +### 专案 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ------------------ | ------------ | ------------------------------------------ | -| `GET` | `/project` | 列出所有專案 | <a href={typesUrl}><code>專案[]</code></a> | -| `GET` | `/project/current` | 獲取當前專案 | <a href={typesUrl}><code>專案</code></a> | +| `GET` | `/project` | 列出所有专案 | <a href={typesUrl}><code>专案[]</code></a> | +| `GET` | `/project/current` | 获取当前专案 | <a href={typesUrl}><code>专案</code></a> | --- ### 路径和VCS -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ------- | ----------------------- | ------------------------------------------- | -| `GET` | `/path` | 獲取當前路徑 | <a href={typesUrl}><code>路徑</code></a> | -| `GET` | `/vcs` | 獲取當前專案的 VCS 資訊 | <a href={typesUrl}><code>VcsInfo</code></a> | +| `GET` | `/path` | 获取当前路徑 | <a href={typesUrl}><code>路徑</code></a> | +| `GET` | `/vcs` | 获取当前专案的 VCS 資訊 | <a href={typesUrl}><code>VcsInfo</code></a> | --- ### 例項 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ------ | ------------------- | -------------- | --------- | | `POST` | `/instance/dispose` | 执行当前实例项 | `boolean` | @@ -124,45 +124,45 @@ opencode服务器公开以下API。 ### 配置 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ------- | ------------------- | -------------------- | -------------------------------------------------------------------------------------- | -| `GET` | `/config` | 獲取配置資訊 | <a href={typesUrl}><code>配置</code></a> | +| `GET` | `/config` | 获取配置資訊 | <a href={typesUrl}><code>配置</code></a> | | `PATCH` | `/config` | 更新配置 | <a href={typesUrl}><code>配置</code></a> | -| `GET` | `/config/providers` | 列出提供商和預設模型 | `{ providers: `<a href={typesUrl}>提供商[]</a>`, default: { [key: string]: string } }` | +| `GET` | `/config/providers` | 列出提供商和默认模型 | `{ providers: `<a href={typesUrl}>提供商[]</a>`, default: { [key: string]: string } }` | --- -### 提供者 +### 提供商 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ------ | -------------------------------- | ---------------------- | --------------------------------------------------------------------------------- | | `GET` | `/provider` | 列出所有提供商 | `{ all: `<a href={typesUrl}>提供商[]</a>`, default: {...}, connected: string[] }` | -| `GET` | `/provider/auth` | 獲取提供商身份驗證方法 | `{ [providerID: string]: `<a href={typesUrl}>ProviderAuthMethod[]</a>` }` | +| `GET` | `/provider/auth` | 获取提供商身份验证方法 | `{ [providerID: string]: `<a href={typesUrl}>ProviderAuthMethod[]</a>` }` | | `POST` | `/provider/{id}/oauth/authorize` | 使用 OAuth 授權提供商 | <a href={typesUrl}><code>ProviderAuthAuthorization</code></a> | -| `POST` | `/provider/{id}/oauth/callback` | 处理成功的 OAuth 回拨 | `boolean` | +| `POST` | `/provider/{id}/oauth/callback` | 处理提供商的 OAuth 回调 | `boolean` | --- -### 會議 +### 会话 | 方法 | 路徑 | 描述 | 筆記 | | -------- | ---------------------------------------- | ---------------------------------- | -------------------------------------------------------------------------------- | -| `GET` | `/session` | 列出所有會話 | 返回 <a href={typesUrl}><code>Session[]</code></a> | -| `POST` | `/session` | 建立新會話 | 正文: `{ parentID?, title? }`,返回 <a href={typesUrl}><code>Session</code></a> | -| `GET` | `/session/status` | 獲取所有會話的會話狀態 | 返回 `{ [sessionID: string]: `<a href={typesUrl}>SessionStatus</a>` }` | -| `GET` | `/session/:id` | 獲取會話詳細資訊 | 返回<a href={typesUrl}><code>會話</code></a> | +| `GET` | `/session` | 列出所有会话 | 返回 <a href={typesUrl}><code>Session[]</code></a> | +| `POST` | `/session` | 建立新会话 | 正文: `{ parentID?, title? }`,返回 <a href={typesUrl}><code>Session</code></a> | +| `GET` | `/session/status` | 获取所有会话的会话狀態 | 返回 `{ [sessionID: string]: `<a href={typesUrl}>SessionStatus</a>` }` | +| `GET` | `/session/:id` | 获取会话详细信息 | 返回<a href={typesUrl}><code>会话</code></a> | | `DELETE` | `/session/:id` | 删除会话及所有资料 | 返回`boolean` | -| `PATCH` | `/session/:id` | 更新會話屬性 | 正文: `{ title? }`,返回 <a href={typesUrl}><code>Session</code></a> | -| `GET` | `/session/:id/children` | 獲取會話的子會話 | 返回 <a href={typesUrl}><code>Session[]</code></a> | -| `GET` | `/session/:id/todo` | 獲取會話的待辦事項列表 | 返回 <a href={typesUrl}><code>Todo[]</code></a> | +| `PATCH` | `/session/:id` | 更新会话屬性 | 正文: `{ title? }`,返回 <a href={typesUrl}><code>Session</code></a> | +| `GET` | `/session/:id/children` | 获取会话的子会话 | 返回 <a href={typesUrl}><code>Session[]</code></a> | +| `GET` | `/session/:id/todo` | 获取会话的待辦事項列表 | 返回 <a href={typesUrl}><code>Todo[]</code></a> | | `POST` | `/session/:id/init` | Analyze app and create `AGENTS.md` | body: `{ messageID, providerID, modelID }`, returns `boolean` | -| `POST` | `/session/:id/fork` | 在訊息中分叉現有會話 | 正文: `{ messageID? }`,返回 <a href={typesUrl}><code>Session</code></a> | +| `POST` | `/session/:id/fork` | 在消息中分叉現有会话 | 正文: `{ messageID? }`,返回 <a href={typesUrl}><code>Session</code></a> | | `POST` | `/session/:id/abort` | 中止正在执行的会话 | 返回`boolean` | -| `POST` | `/session/:id/share` | 分享會議 | 返回<a href={typesUrl}><code>會話</code></a> | -| `DELETE` | `/session/:id/share` | 取消共享會話 | 返回<a href={typesUrl}><code>會話</code></a> | -| `GET` | `/session/:id/diff` | 獲取本次會話的差異 | 查詢:`messageID?`,返回 <a href={typesUrl}><code>FileDiff[]</code></a> | +| `POST` | `/session/:id/share` | 分享会话 | 返回<a href={typesUrl}><code>会话</code></a> | +| `DELETE` | `/session/:id/share` | 取消共享会话 | 返回<a href={typesUrl}><code>会话</code></a> | +| `GET` | `/session/:id/diff` | 获取本次会话的差異 | 查询:`messageID?`,返回 <a href={typesUrl}><code>FileDiff[]</code></a> | | `POST` | `/session/:id/summarize` | 会议总结 | 正文:`{ providerID, modelID }`,返回 `boolean` | -| `POST` | `/session/:id/revert` | 回覆讯息 | 正文:`{ messageID, partID? }`,返回 `boolean` | +| `POST` | `/session/:id/revert` | 回复讯息 | 正文:`{ messageID, partID? }`,返回 `boolean` | | `POST` | `/session/:id/unrevert` | 恢复所有已恢复的消息 | 返回`boolean` | | `POST` | `/session/:id/permissions/:permissionID` | 回复许可权限请求 | 正文:`{ response, remember? }`,返回 `boolean` | @@ -172,37 +172,37 @@ opencode服务器公开以下API。 | 方法 | 路徑 | 描述 | 筆記 | | ------ | --------------------------------- | -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `GET` | `/session/:id/message` | 列出會話中的訊息 | 查詢: `limit?`,返回 `{ info: `<a href={typesUrl}>訊息</a>`, parts: `<a href={typesUrl}>Part[]</a>`}[]` | -| `POST` | `/session/:id/message` | 傳送訊息並等待回覆 | 正文: `{ messageID?, model?, agent?, noReply?, system?, tools?, parts }`,返回 `{ info: `<a href={typesUrl}>訊息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | -| `GET` | `/session/:id/message/:messageID` | 獲取訊息詳情 | 返回 `{ info: `<a href={typesUrl}>訊息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | +| `GET` | `/session/:id/message` | 列出会话中的消息 | 查询: `limit?`,返回 `{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>Part[]</a>`}[]` | +| `POST` | `/session/:id/message` | 发送消息并等待回复 | 正文: `{ messageID?, model?, agent?, noReply?, system?, tools?, parts }`,返回 `{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | +| `GET` | `/session/:id/message/:messageID` | 获取消息详情 | 返回 `{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | | `POST` | `/session/:id/prompt_async` | 非同步传送消息(休眠等待) | 主体:与 `/session/:id/message` 相同,返回 `204 No Content` | -| `POST` | `/session/:id/command` | 執行斜槓命令 | 正文: `{ messageID?, agent?, model?, command, arguments }`,返回 `{ info: `<a href={typesUrl}>訊息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | -| `POST` | `/session/:id/shell` | 執行 shell 命令 | 正文: `{ agent, model?, command }`,返回 `{ info: `<a href={typesUrl}>訊息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | +| `POST` | `/session/:id/command` | 执行斜槓命令 | 正文: `{ messageID?, agent?, model?, command, arguments }`,返回 `{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | +| `POST` | `/session/:id/shell` | 执行 shell 命令 | 正文: `{ agent, model?, command }`,返回 `{ info: `<a href={typesUrl}>消息</a>`, parts: `<a href={typesUrl}>部分[]</a>`}` | --- ### 命令 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ---------- | ------------ | ------------------------------------------ | | `GET` | `/command` | 列出所有命令 | <a href={typesUrl}><code>命令[]</code></a> | --- -### 檔案 +### 文件 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ------------------------ | -------------------- | ----------------------------------------------------------------------------------- | -| `GET` | `/find?pattern=<pat>` | 搜尋檔案中的文字 | 具有 `path`、`lines`、`line_number`、`absolute_offset`、`submatches` 的匹配對像陣列 | -| `GET` | `/find/file?query=<q>` | 按名稱查詢檔案和目錄 | `string[]`(路徑) | -| `GET` | `/find/symbol?query=<q>` | 查詢工作區符號 | <a href={typesUrl}><code>符號[]</code></a> | -| `GET` | `/file?path=<path>` | 列出檔案和目錄 | <a href={typesUrl}><code>FileNode[]</code></a> | -| `GET` | `/file/content?path=<p>` | 讀取檔案 | <a href={typesUrl}><code>檔案內容</code></a> | -| `GET` | `/file/status` | 獲取跟蹤檔案的狀態 | <a href={typesUrl}><code>檔案[]</code></a> | +| `GET` | `/find?pattern=<pat>` | 搜索文件中的文字 | 具有 `path`、`lines`、`line_number`、`absolute_offset`、`submatches` 的匹配对像数组 | +| `GET` | `/find/file?query=<q>` | 按名称查询文件和目录 | `string[]`(路徑) | +| `GET` | `/find/symbol?query=<q>` | 查询工作区符號 | <a href={typesUrl}><code>符號[]</code></a> | +| `GET` | `/file?path=<path>` | 列出文件和目录 | <a href={typesUrl}><code>FileNode[]</code></a> | +| `GET` | `/file/content?path=<p>` | 讀取文件 | <a href={typesUrl}><code>文件內容</code></a> | +| `GET` | `/file/status` | 获取跟蹤文件的狀態 | <a href={typesUrl}><code>文件[]</code></a> | -#### `/find/file` 查询引数 +#### `/find/file` 查询参数 -- `query`(必需)—搜寻字串(模糊匹配) +- `query`(必需)—搜寻字符串(模糊匹配) - `type`(可选)— 将结果限制为 `"file"` 或 `"directory"` - `directory` (任选) — 覆盖搜索的专案根目录 - `limit`(任选)— 最大结果 (1–200) @@ -212,7 +212,7 @@ opencode服务器公开以下API。 ### 工具(實驗) -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ------------------------------------------- | ---------------------------- | -------------------------------------------- | | `GET` | `/experimental/tool/ids` | 列出所有工具 ID | <a href={typesUrl}><code>工具ID</code></a> | | `GET` | `/experimental/tool?provider=<p>&model=<m>` | 列出具有模型 JSON 模式的工具 | <a href={typesUrl}><code>工具列表</code></a> | @@ -221,18 +221,18 @@ opencode服务器公开以下API。 ### LSP、格式化程式和 MCP -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ------ | ------------ | ------------------- | ------------------------------------------------------ | -| `GET` | `/lsp` | 獲取 LSP 伺服器狀態 | <a href={typesUrl}><code>LSPStatus[]</code></a> | -| `GET` | `/formatter` | 獲取格式化程式狀態 | <a href={typesUrl}><code>FormatterStatus[]</code></a> | -| `GET` | `/mcp` | 獲取 MCP 伺服器狀態 | `{ [name: string]: `<a href={typesUrl}>MCP狀態</a>` }` | +| `GET` | `/lsp` | 获取 LSP 服务器狀態 | <a href={typesUrl}><code>LSPStatus[]</code></a> | +| `GET` | `/formatter` | 获取格式化程式狀態 | <a href={typesUrl}><code>FormatterStatus[]</code></a> | +| `GET` | `/mcp` | 获取 MCP 服务器狀態 | `{ [name: string]: `<a href={typesUrl}>MCP狀態</a>` }` | | `POST` | `/mcp` | 动态添加 MCP 服务器 | 主体:`{ name, config }`,返回 MCP 状态对象 | --- ### 代理商 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | -------- | ------------------ | ------------------------------------------ | | `GET` | `/agent` | 列出所有可用的代理 | <a href={typesUrl}><code>代理[]</code></a> | @@ -240,7 +240,7 @@ opencode服务器公开以下API。 ### 記錄 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ------ | ------------------------------------------- | ------ | -------------------- | | `POST` | 身体:`{ service, level, message, extra? }` | `/log` | 写入日志。 `boolean` | @@ -248,7 +248,7 @@ opencode服务器公开以下API。 ### TUI -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ------ | ----------------------- | ----------------------------------------- | ------------ | | `POST` | `/tui/append-prompt` | 将文字附加到提示 | `boolean` | | `POST` | `/tui/open-help` | 开启帮助对话方块 | `boolean` | @@ -266,22 +266,22 @@ opencode服务器公开以下API。 ### 授權 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ----------- | ------------------------------------------ | --------- | -| `PUT` | `/auth/:id` | 设置身份验证凭据。正文必须与提供者架构匹配 | `boolean` | +| `PUT` | `/auth/:id` | 设置身份验证凭据。正文必须与提供商架构匹配 | `boolean` | --- -### 活動 +### 活动 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | -------- | ------------------------------------------------------------------- | ------------------ | | `GET` | `/event` | 服务器发送事件流。第一个事件是 `server.connected`,之后是总线事件。 | 服务器发送事件流。 | --- -### 檔案 +### 文件 -| 方法 | 路徑 | 描述 | 回應 | +| 方法 | 路徑 | 描述 | 回应 | | ----- | ------ | --------------- | ------------------------- | | `GET` | `/doc` | 开启API 3.1规范 | 具有OpenAPI规范的HTML页面 | |
