mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-01 02:06:41 +00:00
chore(docs): i18n sync (#15417)
This commit is contained in:
@@ -558,6 +558,7 @@ OpenCode 可以透過環境變數進行設定。
|
||||
| `OPENCODE_AUTO_SHARE` | boolean | 自動分享工作階段 |
|
||||
| `OPENCODE_GIT_BASH_PATH` | string | Windows 上 Git Bash 可執行檔的路徑 |
|
||||
| `OPENCODE_CONFIG` | string | 設定檔路徑 |
|
||||
| `OPENCODE_TUI_CONFIG` | string | TUI 設定檔路徑 |
|
||||
| `OPENCODE_CONFIG_DIR` | string | 設定目錄路徑 |
|
||||
| `OPENCODE_CONFIG_CONTENT` | string | 內嵌 JSON 設定內容 |
|
||||
| `OPENCODE_DISABLE_AUTOUPDATE` | boolean | 停用自動更新檢查 |
|
||||
|
||||
@@ -14,10 +14,11 @@ OpenCode 支援 **JSON** 和 **JSONC**(帶註解的 JSON)格式。
|
||||
```jsonc title="opencode.jsonc"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
// Theme configuration
|
||||
"theme": "opencode",
|
||||
"model": "anthropic/claude-sonnet-4-5",
|
||||
"autoupdate": true,
|
||||
"server": {
|
||||
"port": 4096,
|
||||
},
|
||||
}
|
||||
```
|
||||
|
||||
@@ -33,7 +34,7 @@ OpenCode 支援 **JSON** 和 **JSONC**(帶註解的 JSON)格式。
|
||||
|
||||
設定檔是合併在一起的,而不是被替換。來自以下設定位置的設定會被合併。後面的設定僅在鍵衝突時覆寫前面的設定。所有設定中的非衝突設定都會被保留。
|
||||
|
||||
例如,如果您的全域設定設定了 `theme: "opencode"` 和 `autoupdate: true`,而您的專案設定設定了 `model: "anthropic/claude-sonnet-4-5"`,則最終設定將包含所有三個設定。
|
||||
例如,如果您的全域設定設定了 `autoupdate: true`,而您的專案設定設定了 `model: "anthropic/claude-sonnet-4-5"`,則最終設定將包含這兩個設定。
|
||||
|
||||
---
|
||||
|
||||
@@ -171,6 +172,10 @@ opencode run "Hello world"
|
||||
- `scroll_speed` - 自訂捲動速度倍率(預設值:`3`,最小值:`1`)。如果 `scroll_acceleration.enabled` 為 `true`,則忽略此選項。
|
||||
- `diff_style` - 控制差異呈現方式。`"auto"` 根據終端機寬度自適應,`"stacked"` 始終顯示單列。
|
||||
|
||||
使用 `OPENCODE_TUI_CONFIG` 指向自訂 TUI 設定檔。
|
||||
|
||||
`opencode.json` 中的舊版 `theme`、`keybinds` 和 `tui` 鍵已被棄用,並將在可能的情況下自動遷移。
|
||||
|
||||
[在此了解更多關於 TUI 的資訊](/docs/tui)。
|
||||
|
||||
---
|
||||
@@ -297,12 +302,12 @@ Bearer Token(`AWS_BEARER_TOKEN_BEDROCK` 或 `/connect`)優先於基於設定
|
||||
|
||||
### 主題
|
||||
|
||||
您可以透過 OpenCode 設定中的 `theme` 選項設定要使用的主題。
|
||||
在 `tui.json` 中設定您的 UI 主題。
|
||||
|
||||
```json title="opencode.json"
|
||||
```json title="tui.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"theme": ""
|
||||
"$schema": "https://opencode.ai/tui.json",
|
||||
"theme": "tokyonight"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -402,11 +407,11 @@ Bearer Token(`AWS_BEARER_TOKEN_BEDROCK` 或 `/connect`)優先於基於設定
|
||||
|
||||
### 快捷鍵
|
||||
|
||||
您可以透過 `keybinds` 選項自訂快捷鍵。
|
||||
在 `tui.json` 中自訂快捷鍵。
|
||||
|
||||
```json title="opencode.json"
|
||||
```json title="tui.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"$schema": "https://opencode.ai/tui.json",
|
||||
"keybinds": {}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -79,6 +79,32 @@ export const multiply = tool({
|
||||
|
||||
---
|
||||
|
||||
#### 與內建工具名稱衝突
|
||||
|
||||
自訂工具以工具名稱作為鍵值。如果自訂工具使用與內建工具相同的名稱,則自訂工具具有優先權。
|
||||
|
||||
例如,此檔案將替換內建的 `bash` 工具:
|
||||
|
||||
```ts title=".opencode/tools/bash.ts"
|
||||
import { tool } from "@opencode-ai/plugin"
|
||||
|
||||
export default tool({
|
||||
description: "Restricted bash wrapper",
|
||||
args: {
|
||||
command: tool.schema.string(),
|
||||
},
|
||||
async execute(args) {
|
||||
return `blocked: ${args.command}`
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
:::note
|
||||
除非您有意替換內建工具,否則請使用唯一的名稱。如果您想停用內建工具但不覆寫它,請使用[權限](/docs/permissions)。
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
### 參數
|
||||
|
||||
您可以使用 `tool.schema`(即 [Zod](https://zod.dev))來定義參數型別。
|
||||
|
||||
@@ -3,11 +3,11 @@ title: 快捷鍵
|
||||
description: 自訂您的快捷鍵。
|
||||
---
|
||||
|
||||
OpenCode 提供了一系列快捷鍵,您可以透過 OpenCode 設定進行自訂。
|
||||
OpenCode 提供了一系列快捷鍵,您可以透過 `tui.json` 進行自訂。
|
||||
|
||||
```json title="opencode.json"
|
||||
```json title="tui.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"$schema": "https://opencode.ai/tui.json",
|
||||
"keybinds": {
|
||||
"leader": "ctrl+x",
|
||||
"app_exit": "ctrl+c,ctrl+d,<leader>q",
|
||||
@@ -117,11 +117,11 @@ OpenCode 的大多數快捷鍵使用 `leader`(前導鍵)。這可以避免
|
||||
|
||||
## 停用快捷鍵
|
||||
|
||||
您可以透過在設定中將對應的鍵值設定為 "none" 來停用某個快捷鍵。
|
||||
您可以透過在 `tui.json` 中將對應的鍵值設定為 "none" 來停用某個快捷鍵。
|
||||
|
||||
```json title="opencode.json"
|
||||
```json title="tui.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"$schema": "https://opencode.ai/tui.json",
|
||||
"keybinds": {
|
||||
"session_compact": "none"
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ OpenCode 內建了多種適用於主流語言的 LSP 伺服器:
|
||||
| gopls | .go | 需要 `go` 指令可用 |
|
||||
| hls | .hs, .lhs | 需要 `haskell-language-server-wrapper` 指令可用 |
|
||||
| jdtls | .java | 需要已安裝 `Java SDK (version 21+)` |
|
||||
| julials | .jl | 需要已安裝 `julia` 和 `LanguageServer.jl` |
|
||||
| kotlin-ls | .kt, .kts | 為 Kotlin 專案自動安裝 |
|
||||
| lua-ls | .lua | 為 Lua 專案自動安裝 |
|
||||
| nixd | .nix | 需要 `nixd` 指令可用 |
|
||||
|
||||
@@ -307,6 +307,10 @@ export const CustomToolsPlugin: Plugin = async (ctx) => {
|
||||
|
||||
您的自訂工具將與內建工具一起在 OpenCode 中可用。
|
||||
|
||||
:::note
|
||||
如果外掛工具使用與內建工具相同的名稱,則外掛工具具有優先權。
|
||||
:::
|
||||
|
||||
---
|
||||
|
||||
### 日誌記錄
|
||||
|
||||
@@ -55,7 +55,7 @@ OpenCode Zen 是由 OpenCode 團隊提供的模型列表,這些模型已經過
|
||||
如果您是新使用者,我們建議從 OpenCode Zen 開始。
|
||||
:::
|
||||
|
||||
1. 在 TUI 中執行 `/connect` 指令,選擇 opencode,然後前往 [opencode.ai/auth](https://opencode.ai/auth)。
|
||||
1. 在 TUI 中執行 `/connect` 指令,選擇 `OpenCode Zen`,然後前往 [opencode.ai/auth](https://opencode.ai/zen)。
|
||||
|
||||
```txt
|
||||
/connect
|
||||
@@ -82,6 +82,37 @@ OpenCode Zen 是由 OpenCode 團隊提供的模型列表,這些模型已經過
|
||||
|
||||
---
|
||||
|
||||
## OpenCode Go
|
||||
|
||||
OpenCode Go 是一個低成本的訂閱計畫,提供對 OpenCode 團隊提供的流行開放編碼模型的可靠存取,這些模型已經過測試和驗證,能夠與 OpenCode 良好配合使用。
|
||||
|
||||
1. 在 TUI 中執行 `/connect` 指令,選擇 `OpenCode Go`,然後前往 [opencode.ai/auth](https://opencode.ai/zen)。
|
||||
|
||||
```txt
|
||||
/connect
|
||||
```
|
||||
|
||||
2. 登入後新增帳單資訊,然後複製您的 API 金鑰。
|
||||
|
||||
3. 貼上您的 API 金鑰。
|
||||
|
||||
```txt
|
||||
┌ API key
|
||||
│
|
||||
│
|
||||
└ enter
|
||||
```
|
||||
|
||||
4. 在 TUI 中執行 `/models` 查看我們推薦的模型列表。
|
||||
|
||||
```txt
|
||||
/models
|
||||
```
|
||||
|
||||
它的使用方式與 OpenCode 中的任何其他提供商相同,且完全可選。
|
||||
|
||||
---
|
||||
|
||||
## 目錄
|
||||
|
||||
下面我們來詳細了解一些提供商。如果您想將某個提供商新增到列表中,歡迎提交 PR。
|
||||
|
||||
@@ -61,11 +61,11 @@ OpenCode 自帶多個內建主題。
|
||||
|
||||
## 使用主題
|
||||
|
||||
您可以透過 `/theme` 指令調出主題選擇介面來選擇主題,也可以在[設定](/docs/config)檔案中直接指定。
|
||||
您可以透過 `/theme` 指令調出主題選擇介面來選擇主題,也可以在 `tui.json` 中直接指定。
|
||||
|
||||
```json title="opencode.json" {3}
|
||||
```json title="tui.json" {3}
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"$schema": "https://opencode.ai/tui.json",
|
||||
"theme": "tokyonight"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -352,24 +352,34 @@ How is auth handled in @packages/functions/src/api/index.ts?
|
||||
|
||||
## 設定
|
||||
|
||||
您可以透過 OpenCode 設定檔自訂 TUI 行為。
|
||||
您可以透過 `tui.json`(或 `tui.jsonc`)自訂 TUI 行為。
|
||||
|
||||
```json title="opencode.json"
|
||||
```json title="tui.json"
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"tui": {
|
||||
"scroll_speed": 3,
|
||||
"scroll_acceleration": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
"$schema": "https://opencode.ai/tui.json",
|
||||
"theme": "opencode",
|
||||
"keybinds": {
|
||||
"leader": "ctrl+x"
|
||||
},
|
||||
"scroll_speed": 3,
|
||||
"scroll_acceleration": {
|
||||
"enabled": true
|
||||
},
|
||||
"diff_style": "auto"
|
||||
}
|
||||
```
|
||||
|
||||
這與設定伺服器/執行時行為的 `opencode.json` 是分開的。
|
||||
|
||||
### 選項
|
||||
|
||||
- `scroll_acceleration` - 啟用 macOS 風格的捲動加速,實現平滑、自然的捲動體驗。啟用後,快速捲動時速度會增加,慢速移動時保持精確。**此設定優先於 `scroll_speed`,啟用時會覆蓋它。**
|
||||
- `scroll_speed` - 控制使用捲動指令時 TUI 的捲動速度(最小值:`1`)。預設為 `3`。**注意:如果 `scroll_acceleration.enabled` 設定為 `true`,則此設定會被忽略。**
|
||||
- `theme` - 設定您的 UI 主題。[了解更多](/docs/themes)。
|
||||
- `keybinds` - 自訂鍵盤快速鍵。[了解更多](/docs/keybinds)。
|
||||
- `scroll_acceleration.enabled` - 啟用 macOS 風格的捲動加速,實現平滑、自然的捲動體驗。啟用後,快速捲動時速度會增加,慢速移動時保持精確。**此設定優先於 `scroll_speed`,啟用時會覆蓋它。**
|
||||
- `scroll_speed` - 控制使用捲動指令時 TUI 的捲動速度(最小值:`0.001`,支援小數值)。預設為 `3`。**注意:如果 `scroll_acceleration.enabled` 設定為 `true`,則此設定會被忽略。**
|
||||
- `diff_style` - 控制差異呈現方式。`"auto"` 根據終端機寬度自適應,`"stacked"` 始終顯示單列。
|
||||
|
||||
使用 `OPENCODE_TUI_CONFIG` 載入自訂 TUI 設定路徑。
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ OpenCode Zen 的工作方式與 OpenCode 中的任何其他供應商相同。
|
||||
|
||||
| 模型 | 模型 ID | 端點 | AI SDK 套件 |
|
||||
| ------------------ | ------------------ | -------------------------------------------------- | --------------------------- |
|
||||
| GPT 5.3 Codex | gpt-5.3-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.2 | gpt-5.2 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.2 Codex | gpt-5.2-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5.1 | gpt-5.1 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
@@ -64,13 +65,15 @@ OpenCode Zen 的工作方式與 OpenCode 中的任何其他供應商相同。
|
||||
| GPT 5 | gpt-5 | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5 Codex | gpt-5-codex | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| GPT 5 Nano | gpt-5-nano | `https://opencode.ai/zen/v1/responses` | `@ai-sdk/openai` |
|
||||
| Claude Opus 4.6 | claude-opus-4-6 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Opus 4.5 | claude-opus-4-5 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Opus 4.1 | claude-opus-4-1 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Sonnet 4.6 | claude-sonnet-4-6 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Sonnet 4.5 | claude-sonnet-4-5 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Sonnet 4 | claude-sonnet-4 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Haiku 4.5 | claude-haiku-4-5 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Haiku 3.5 | claude-3-5-haiku | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Opus 4.6 | claude-opus-4-6 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Opus 4.5 | claude-opus-4-5 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Claude Opus 4.1 | claude-opus-4-1 | `https://opencode.ai/zen/v1/messages` | `@ai-sdk/anthropic` |
|
||||
| Gemini 3.1 Pro | gemini-3.1-pro | `https://opencode.ai/zen/v1/models/gemini-3.1-pro` | `@ai-sdk/google` |
|
||||
| Gemini 3 Pro | gemini-3-pro | `https://opencode.ai/zen/v1/models/gemini-3-pro` | `@ai-sdk/google` |
|
||||
| Gemini 3 Flash | gemini-3-flash | `https://opencode.ai/zen/v1/models/gemini-3-flash` | `@ai-sdk/google` |
|
||||
| MiniMax M2.5 | minimax-m2.5 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
@@ -80,7 +83,6 @@ OpenCode Zen 的工作方式與 OpenCode 中的任何其他供應商相同。
|
||||
| GLM 4.7 | glm-4.7 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
| GLM 4.6 | glm-4.6 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
| Kimi K2.5 | kimi-k2.5 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
| Kimi K2.5 Free | kimi-k2.5-free | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
| Kimi K2 Thinking | kimi-k2-thinking | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
| Kimi K2 | kimi-k2 | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
| Qwen3 Coder 480B | qwen3-coder | `https://opencode.ai/zen/v1/chat/completions` | `@ai-sdk/openai-compatible` |
|
||||
@@ -113,24 +115,28 @@ https://opencode.ai/zen/v1/models
|
||||
| GLM 5 | $1.00 | $3.20 | $0.20 | - |
|
||||
| GLM 4.7 | $0.60 | $2.20 | $0.10 | - |
|
||||
| GLM 4.6 | $0.60 | $2.20 | $0.10 | - |
|
||||
| Kimi K2.5 Free | 免費 | 免費 | 免費 | - |
|
||||
| Kimi K2.5 | $0.60 | $3.00 | $0.08 | - |
|
||||
| Kimi K2 Thinking | $0.40 | $2.50 | - | - |
|
||||
| Kimi K2 | $0.40 | $2.50 | - | - |
|
||||
| Qwen3 Coder 480B | $0.45 | $1.50 | - | - |
|
||||
| Claude Opus 4.6 (≤ 200K Token) | $5.00 | $25.00 | $0.50 | $6.25 |
|
||||
| Claude Opus 4.6 (> 200K Token) | $10.00 | $37.50 | $1.00 | $12.50 |
|
||||
| Claude Opus 4.5 | $5.00 | $25.00 | $0.50 | $6.25 |
|
||||
| Claude Opus 4.1 | $15.00 | $75.00 | $1.50 | $18.75 |
|
||||
| Claude Sonnet 4.6 (≤ 200K Token) | $3.00 | $15.00 | $0.30 | $3.75 |
|
||||
| Claude Sonnet 4.6 (> 200K Token) | $6.00 | $22.50 | $0.60 | $7.50 |
|
||||
| Claude Sonnet 4.5 (≤ 200K Token) | $3.00 | $15.00 | $0.30 | $3.75 |
|
||||
| Claude Sonnet 4.5 (> 200K Token) | $6.00 | $22.50 | $0.60 | $7.50 |
|
||||
| Claude Sonnet 4 (≤ 200K Token) | $3.00 | $15.00 | $0.30 | $3.75 |
|
||||
| Claude Sonnet 4 (> 200K Token) | $6.00 | $22.50 | $0.60 | $7.50 |
|
||||
| Claude Haiku 4.5 | $1.00 | $5.00 | $0.10 | $1.25 |
|
||||
| Claude Haiku 3.5 | $0.80 | $4.00 | $0.08 | $1.00 |
|
||||
| Claude Opus 4.6 (≤ 200K Token) | $5.00 | $25.00 | $0.50 | $6.25 |
|
||||
| Claude Opus 4.6 (> 200K Token) | $10.00 | $37.50 | $1.00 | $12.50 |
|
||||
| Claude Opus 4.5 | $5.00 | $25.00 | $0.50 | $6.25 |
|
||||
| Claude Opus 4.1 | $15.00 | $75.00 | $1.50 | $18.75 |
|
||||
| Gemini 3.1 Pro (≤ 200K Token) | $2.00 | $12.00 | $0.20 | - |
|
||||
| Gemini 3.1 Pro (> 200K Token) | $4.00 | $18.00 | $0.40 | - |
|
||||
| Gemini 3 Pro (≤ 200K Token) | $2.00 | $12.00 | $0.20 | - |
|
||||
| Gemini 3 Pro (> 200K Token) | $4.00 | $18.00 | $0.40 | - |
|
||||
| Gemini 3 Flash | $0.50 | $3.00 | $0.05 | - |
|
||||
| GPT 5.3 Codex | $1.75 | $14.00 | $0.175 | - |
|
||||
| GPT 5.2 | $1.75 | $14.00 | $0.175 | - |
|
||||
| GPT 5.2 Codex | $1.75 | $14.00 | $0.175 | - |
|
||||
| GPT 5.1 | $1.07 | $8.50 | $0.107 | - |
|
||||
@@ -149,7 +155,6 @@ https://opencode.ai/zen/v1/models
|
||||
|
||||
免費模型說明:
|
||||
|
||||
- Kimi K2.5 Free 在 OpenCode 上限時免費提供。團隊正在利用這段時間收集回饋並改進模型。
|
||||
- MiniMax M2.5 Free 在 OpenCode 上限時免費提供。團隊正在利用這段時間收集回饋並改進模型。
|
||||
- Big Pickle 是一個隱身模型,在 OpenCode 上限時免費提供。團隊正在利用這段時間收集回饋並改進模型。
|
||||
|
||||
@@ -178,7 +183,6 @@ https://opencode.ai/zen/v1/models
|
||||
我們所有的模型都託管在美國。我們的供應商遵循零保留政策,不會將你的資料用於模型訓練,但以下情況除外:
|
||||
|
||||
- Big Pickle:在免費期間,收集的資料可能會被用於改進模型。
|
||||
- Kimi K2.5 Free:在免費期間,收集的資料可能會被用於改進模型。
|
||||
- MiniMax M2.5 Free:在免費期間,收集的資料可能會被用於改進模型。
|
||||
- OpenAI API:請求會根據 [OpenAI 資料政策](https://platform.openai.com/docs/guides/your-data)保留 30 天。
|
||||
- Anthropic API:請求會根據 [Anthropic 資料政策](https://docs.anthropic.com/en/docs/claude-code/data-usage)保留 30 天。
|
||||
|
||||
Reference in New Issue
Block a user