ai-account-switch 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +672 -671
- package/README_EN.md +1191 -0
- package/package.json +1 -1
- package/src/commands/account.js +116 -3
- package/src/config.js +195 -8
- package/src/ui-server.js +46 -0
- package/CHANGELOG-v1.7.0.md +0 -176
- package/README_ZH.md +0 -1192
package/README.md
CHANGED
|
@@ -1,227 +1,281 @@
|
|
|
1
1
|
# AI Account Switch (ais)
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- **Claude Code
|
|
14
|
-
- **
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
3
|
+
简体中文 | [English](README_EN.md)
|
|
4
|
+
|
|
5
|
+
一个跨平台的命令行工具,用于管理和切换不同项目的 Claude/Codex/Droids 账户配置。
|
|
6
|
+
|
|
7
|
+
## 特性
|
|
8
|
+
|
|
9
|
+
- **跨平台支持**:在 macOS、Linux 和 Windows 上无缝运行
|
|
10
|
+
- **多账户管理**:存储和管理多个 AI 服务账户
|
|
11
|
+
- **项目级配置**:每个项目可以使用不同的账户
|
|
12
|
+
- **智能目录检测**:在项目的任何子目录中都能工作(类似 git)
|
|
13
|
+
- **Claude Code 集成**:自动生成 `.claude/settings.local.json` 配置文件
|
|
14
|
+
- **Web UI 管理界面**:
|
|
15
|
+
- 🎨 现代化单页面应用,支持深色/浅色主题
|
|
16
|
+
- 🌍 中英文双语支持,一键切换
|
|
17
|
+
- ⚙️ 可视化管理账号:增删改查一目了然
|
|
18
|
+
- 📤 导入/导出功能:批量管理账号配置
|
|
19
|
+
- 🔍 实时搜索过滤账号
|
|
20
|
+
- 💾 自定义环境变量配置
|
|
21
|
+
- 🎯 主题自动跟随系统设置
|
|
22
|
+
- **MCP Web UI 管理**:完整的 MCP (Model Context Protocol) 服务器管理
|
|
23
|
+
- 🖥️ 直观的界面添加、编辑、删除 MCP 服务器
|
|
24
|
+
- 🔌 支持 stdio、sse、http 三种服务器类型
|
|
25
|
+
- 🧪 测试 MCP 服务器连接
|
|
26
|
+
- ⚡ 一键启用/禁用项目级服务器
|
|
27
|
+
- 🔍 搜索和筛选功能
|
|
28
|
+
- 🌐 完整的中英文支持
|
|
29
|
+
- **安全存储**:账户凭证仅存储在本地
|
|
30
|
+
- **交互式命令行**:所有操作都有易用的交互式提示
|
|
31
|
+
- **多种账户类型**:支持 Claude、Codex、CCR (Claude Code Router)、Droids 和其他 AI 服务
|
|
32
|
+
|
|
33
|
+
## 安装
|
|
34
|
+
|
|
35
|
+
### npm 安装(推荐)
|
|
29
36
|
|
|
30
37
|
```bash
|
|
31
38
|
npm install -g ai-account-switch
|
|
32
39
|
```
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
安装后,`ais` 命令将在全局可用。
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
**故障排除**:如果安装后提示"命令未找到":
|
|
37
44
|
|
|
38
45
|
```bash
|
|
39
|
-
#
|
|
46
|
+
# 查看 npm 全局 bin 路径
|
|
40
47
|
npm config get prefix
|
|
41
48
|
|
|
42
|
-
#
|
|
49
|
+
# 添加到 PATH (Linux/macOS)
|
|
43
50
|
export PATH="$PATH:$(npm config get prefix)/bin"
|
|
44
51
|
|
|
45
|
-
#
|
|
52
|
+
# Windows 上,添加到系统 PATH:%APPDATA%\npm
|
|
46
53
|
```
|
|
47
54
|
|
|
48
|
-
###
|
|
55
|
+
### 从源码安装
|
|
49
56
|
|
|
50
57
|
```bash
|
|
51
|
-
#
|
|
58
|
+
# 克隆仓库
|
|
52
59
|
git clone https://github.com/yourusername/ai-agent-user-swith.git
|
|
53
60
|
cd ai-agent-user-swith
|
|
54
61
|
|
|
55
|
-
#
|
|
62
|
+
# 安装依赖
|
|
56
63
|
npm install
|
|
57
64
|
|
|
58
|
-
#
|
|
65
|
+
# 全局链接 CLI 工具
|
|
59
66
|
npm link
|
|
60
67
|
```
|
|
61
68
|
|
|
62
|
-
##
|
|
63
|
-
|
|
64
|
-
###
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
| `ais add [name]` | - |
|
|
69
|
-
| `ais list` | `ls` |
|
|
70
|
-
| `ais use [name]` | - |
|
|
71
|
-
| `ais info` | - |
|
|
72
|
-
| `ais current` | - |
|
|
73
|
-
| `ais remove [name]` | `rm` |
|
|
74
|
-
| `ais model list` | `ls` |
|
|
75
|
-
| `ais model add [name]` | - |
|
|
76
|
-
| `ais model use <name>` | - |
|
|
77
|
-
| `ais model remove [name]` | `rm` |
|
|
78
|
-
| `ais model show [name]` | - |
|
|
79
|
-
| `ais mcp add [name]` | - |
|
|
80
|
-
| `ais mcp list` | `ls` |
|
|
81
|
-
| `ais mcp show [name]` | - |
|
|
82
|
-
| `ais mcp update [name]` | - |
|
|
83
|
-
| `ais mcp remove [name]` | `rm` |
|
|
84
|
-
| `ais mcp enable [name]` | - |
|
|
85
|
-
| `ais mcp disable [name]` | - |
|
|
86
|
-
| `ais mcp enabled` | - |
|
|
87
|
-
| `ais mcp sync` | - |
|
|
88
|
-
| `ais ui` | - |
|
|
89
|
-
| `ais paths` | - |
|
|
90
|
-
| `ais doctor` | - |
|
|
91
|
-
| `ais export <name>` | - |
|
|
92
|
-
| `ais help` | - |
|
|
93
|
-
| `ais --version` | - |
|
|
94
|
-
|
|
95
|
-
###
|
|
96
|
-
|
|
97
|
-
#### 1.
|
|
98
|
-
|
|
99
|
-
|
|
69
|
+
## 使用方法
|
|
70
|
+
|
|
71
|
+
### 命令概览
|
|
72
|
+
|
|
73
|
+
| 命令 | 别名 | 描述 |
|
|
74
|
+
|------|------|------|
|
|
75
|
+
| `ais add [name]` | - | 添加新的账户配置 |
|
|
76
|
+
| `ais list` | `ls` | 列出所有可用账户 |
|
|
77
|
+
| `ais use [name]` | - | 为当前项目设置账户 |
|
|
78
|
+
| `ais info` | - | 显示当前项目的账户信息 |
|
|
79
|
+
| `ais current` | - | 显示当前账户名称 |
|
|
80
|
+
| `ais remove [name]` | `rm` | 删除账户 |
|
|
81
|
+
| `ais model list` | `ls` | 列出当前账户的所有模型组 |
|
|
82
|
+
| `ais model add [name]` | - | 添加新的模型组 |
|
|
83
|
+
| `ais model use <name>` | - | 切换到不同的模型组 |
|
|
84
|
+
| `ais model remove [name]` | `rm` | 删除模型组 |
|
|
85
|
+
| `ais model show [name]` | - | 显示模型组配置 |
|
|
86
|
+
| `ais mcp add [name]` | - | 添加新的 MCP 服务器 |
|
|
87
|
+
| `ais mcp list` | `ls` | 列出所有 MCP 服务器 |
|
|
88
|
+
| `ais mcp show [name]` | - | 显示 MCP 服务器详情 |
|
|
89
|
+
| `ais mcp update [name]` | - | 更新 MCP 服务器配置 |
|
|
90
|
+
| `ais mcp remove [name]` | `rm` | 删除 MCP 服务器 |
|
|
91
|
+
| `ais mcp enable [name]` | - | 为当前项目启用 MCP 服务器 |
|
|
92
|
+
| `ais mcp disable [name]` | - | 为当前项目禁用 MCP 服务器 |
|
|
93
|
+
| `ais mcp enabled` | - | 显示已启用的 MCP 服务器 |
|
|
94
|
+
| `ais mcp sync` | - | 同步 MCP 配置到 Claude Code |
|
|
95
|
+
| `ais ui` | - | 启动 Web UI 管理界面 |
|
|
96
|
+
| `ais paths` | - | 显示配置文件路径 |
|
|
97
|
+
| `ais doctor` | - | 诊断 Claude Code 配置问题 |
|
|
98
|
+
| `ais export <name>` | - | 导出账户为 JSON 格式 |
|
|
99
|
+
| `ais help` | - | 显示帮助信息 |
|
|
100
|
+
| `ais --version` | - | 显示版本号 |
|
|
101
|
+
|
|
102
|
+
### 快速开始
|
|
103
|
+
|
|
104
|
+
#### 1. 添加账户
|
|
105
|
+
|
|
106
|
+
交互式添加第一个账户:
|
|
100
107
|
|
|
101
108
|
```bash
|
|
102
109
|
ais add
|
|
103
110
|
```
|
|
104
111
|
|
|
105
|
-
|
|
112
|
+
或直接指定名称:
|
|
106
113
|
|
|
107
114
|
```bash
|
|
108
115
|
ais add my-claude-account
|
|
109
116
|
```
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
-
|
|
118
|
+
系统将提示你输入:
|
|
119
|
+
- 账户类型(Claude、Codex、CCR、Droids、其他)
|
|
113
120
|
- API Key
|
|
114
|
-
- API URL
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
121
|
-
- Press Enter without input to finish adding variables
|
|
121
|
+
- API URL(可选)
|
|
122
|
+
- Email(可选)
|
|
123
|
+
- 描述(可选)
|
|
124
|
+
- 自定义环境变量(可选)
|
|
125
|
+
- 使用 `KEY=VALUE` 格式输入(例如:`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
|
|
126
|
+
- 工具会在完成前显示所有已添加的变量
|
|
127
|
+
- 直接按回车(不输入)即可完成添加
|
|
122
128
|
|
|
123
|
-
#### 2.
|
|
129
|
+
#### 2. 列出所有账户
|
|
124
130
|
|
|
125
|
-
|
|
131
|
+
查看所有已配置的账户:
|
|
126
132
|
|
|
127
133
|
```bash
|
|
128
134
|
ais list
|
|
129
|
-
#
|
|
135
|
+
# 或
|
|
130
136
|
ais ls
|
|
131
137
|
```
|
|
132
138
|
|
|
133
|
-
|
|
139
|
+
当前项目激活的账户将用绿色圆点标记。
|
|
134
140
|
|
|
135
|
-
#### 3.
|
|
141
|
+
#### 3. 为当前项目切换账户
|
|
136
142
|
|
|
137
|
-
|
|
143
|
+
设置当前项目使用的账户:
|
|
138
144
|
|
|
139
145
|
```bash
|
|
140
146
|
ais use my-claude-account
|
|
141
147
|
```
|
|
142
148
|
|
|
143
|
-
|
|
149
|
+
或交互式选择:
|
|
144
150
|
|
|
145
151
|
```bash
|
|
146
152
|
ais use
|
|
147
153
|
```
|
|
148
154
|
|
|
149
|
-
|
|
150
|
-
|
|
155
|
+
**注意**:此命令会自动生成 `.claude/settings.local.json` 文件用于 Claude Code CLI 集成。
|
|
156
|
+
如果检测到当前项目是 Git 仓库,还会自动将配置文件添加到 `.gitignore` 中,避免将敏感信息提交到版本控制。
|
|
157
|
+
你可以在项目的任何子目录中运行此命令 - 它会自动找到项目根目录。
|
|
151
158
|
|
|
152
|
-
#### 4.
|
|
159
|
+
#### 4. 查看当前项目信息
|
|
153
160
|
|
|
154
|
-
|
|
161
|
+
查看当前项目激活的账户:
|
|
155
162
|
|
|
156
163
|
```bash
|
|
157
164
|
ais info
|
|
158
165
|
```
|
|
159
166
|
|
|
160
|
-
|
|
167
|
+
或仅显示账户名称:
|
|
161
168
|
|
|
162
169
|
```bash
|
|
163
170
|
ais current
|
|
164
171
|
```
|
|
165
172
|
|
|
166
|
-
|
|
173
|
+
**注意**:这些命令可以在项目的任何子目录中使用,类似 git 命令的工作方式。
|
|
167
174
|
|
|
168
|
-
#### 5.
|
|
175
|
+
#### 5. 使用 Web UI 管理界面
|
|
176
|
+
|
|
177
|
+
启动可视化管理界面:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
ais ui
|
|
181
|
+
```
|
|
169
182
|
|
|
170
|
-
|
|
183
|
+
这将在浏览器中打开 Web UI,服务器会自动使用一个随机的高位端口(49152-65535)。如果端口被占用,会自动尝试其他端口,提供以下功能:
|
|
184
|
+
|
|
185
|
+
**界面特性:**
|
|
186
|
+
- **账号管理**: 可视化的卡片界面,显示所有账号信息
|
|
187
|
+
- **添加/编辑账号**: 友好的表单界面,支持所有配置项
|
|
188
|
+
- **删除账号**: 一键删除,带确认提示
|
|
189
|
+
- **搜索过滤**: 实时搜索账号名称、邮箱或类型
|
|
190
|
+
- **批量操作**:
|
|
191
|
+
- 导出所有账号为 JSON 文件
|
|
192
|
+
- 从 JSON 文件导入账号(支持覆盖选项)
|
|
193
|
+
- **主题切换**:
|
|
194
|
+
- iOS 风格的 Switch 开关
|
|
195
|
+
- 支持浅色和深色主题
|
|
196
|
+
- 默认跟随系统主题设置
|
|
197
|
+
- **多语言支持**:
|
|
198
|
+
- 中文/英文一键切换
|
|
199
|
+
- 界面默认使用中文
|
|
200
|
+
- 语言设置自动保存
|
|
201
|
+
|
|
202
|
+
**UI 使用提示:**
|
|
203
|
+
- 所有修改实时同步到本地配置
|
|
204
|
+
- 关闭浏览器窗口不影响数据
|
|
205
|
+
- 按 `Ctrl+C` 停止 Web 服务器
|
|
206
|
+
- 支持在任何浏览器中使用
|
|
207
|
+
|
|
208
|
+
#### 6. 删除账户
|
|
209
|
+
|
|
210
|
+
删除不再需要的账户:
|
|
171
211
|
|
|
172
212
|
```bash
|
|
173
213
|
ais remove old-account
|
|
174
|
-
#
|
|
214
|
+
# 或
|
|
175
215
|
ais rm
|
|
176
216
|
```
|
|
177
217
|
|
|
178
|
-
###
|
|
218
|
+
### 高级用法
|
|
179
219
|
|
|
180
|
-
####
|
|
220
|
+
#### 显示配置路径
|
|
181
221
|
|
|
182
|
-
|
|
222
|
+
查看配置文件的存储位置:
|
|
183
223
|
|
|
184
224
|
```bash
|
|
185
225
|
ais paths
|
|
186
226
|
```
|
|
187
227
|
|
|
188
|
-
####
|
|
228
|
+
#### 诊断配置问题
|
|
189
229
|
|
|
190
|
-
|
|
230
|
+
如果 Claude Code 使用了错误的账户,运行诊断:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
ais doctor
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
此命令会检查:
|
|
237
|
+
- 当前目录和项目根目录
|
|
238
|
+
- AIS 项目配置
|
|
239
|
+
- Claude Code 配置
|
|
240
|
+
- 全局 Claude 配置
|
|
241
|
+
- 提供解决建议
|
|
242
|
+
|
|
243
|
+
#### 导出账户配置
|
|
244
|
+
|
|
245
|
+
以 JSON 格式导出账户配置:
|
|
191
246
|
|
|
192
247
|
```bash
|
|
193
248
|
ais export my-claude-account
|
|
194
249
|
```
|
|
195
250
|
|
|
196
|
-
##
|
|
251
|
+
## 配置
|
|
197
252
|
|
|
198
|
-
###
|
|
253
|
+
### 全局配置
|
|
199
254
|
|
|
200
|
-
|
|
255
|
+
所有账户都存储在用户主目录的全局配置中:
|
|
201
256
|
|
|
202
257
|
- **macOS/Linux**: `~/.ai-account-switch/config.json`
|
|
203
258
|
- **Windows**: `%USERPROFILE%\.ai-account-switch\config.json`
|
|
204
259
|
|
|
205
|
-
###
|
|
260
|
+
### 项目配置
|
|
206
261
|
|
|
207
|
-
|
|
262
|
+
每个项目将其活动账户引用存储在:
|
|
208
263
|
|
|
209
264
|
```
|
|
210
265
|
./.ais-project-config
|
|
211
266
|
```
|
|
212
267
|
|
|
213
|
-
|
|
268
|
+
此文件在运行 `ais use` 时自动创建,应添加到 `.gitignore` 中。
|
|
214
269
|
|
|
215
|
-
### Claude Code
|
|
270
|
+
### Claude Code 集成
|
|
216
271
|
|
|
217
|
-
|
|
272
|
+
运行 `ais use` 时,工具会自动创建 `.claude/settings.local.json`,结构如下:
|
|
218
273
|
|
|
219
274
|
```json
|
|
220
275
|
{
|
|
221
276
|
"env": {
|
|
222
277
|
"ANTHROPIC_AUTH_TOKEN": "your-api-key",
|
|
223
278
|
"ANTHROPIC_BASE_URL": "your-api-url",
|
|
224
|
-
"ANTHROPIC_ORGANIZATION_ID": "your-org-id",
|
|
225
279
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1"
|
|
226
280
|
},
|
|
227
281
|
"permissions": {
|
|
@@ -232,15 +286,15 @@ When you run `ais use`, the tool automatically creates `.claude/settings.local.j
|
|
|
232
286
|
}
|
|
233
287
|
```
|
|
234
288
|
|
|
235
|
-
|
|
289
|
+
这确保 Claude Code CLI 自动使用项目的正确账户。
|
|
236
290
|
|
|
237
|
-
### Codex
|
|
291
|
+
### Codex 集成
|
|
238
292
|
|
|
239
|
-
|
|
293
|
+
当你添加 **Codex** 类型账户并运行 `ais use` 时,工具会自动在 `~/.codex/config.toml` 中创建 profile,并在项目目录中创建 `.codex-profile` 文件。
|
|
240
294
|
|
|
241
|
-
####
|
|
295
|
+
#### 添加 Codex 账户
|
|
242
296
|
|
|
243
|
-
|
|
297
|
+
添加 Codex 账户时,你会看到有用的配置提示:
|
|
244
298
|
|
|
245
299
|
```bash
|
|
246
300
|
ais add my-codex-account
|
|
@@ -256,44 +310,44 @@ ais add my-codex-account
|
|
|
256
310
|
? Enter API URL (e.g., https://api.example.com or https://api.example.com/v1): https://zone.veloera.org
|
|
257
311
|
```
|
|
258
312
|
|
|
259
|
-
|
|
260
|
-
- AIS
|
|
261
|
-
-
|
|
262
|
-
-
|
|
313
|
+
**重要说明:**
|
|
314
|
+
- AIS 会自动为 API URL 添加 `/v1` 路径(如果缺少)
|
|
315
|
+
- 配置使用 `wire_api = "chat"`(OpenAI 兼容格式)
|
|
316
|
+
- 这可以防止常见的 Cloudflare 400 错误
|
|
263
317
|
|
|
264
|
-
####
|
|
318
|
+
#### 在项目中使用 Codex
|
|
265
319
|
|
|
266
|
-
|
|
320
|
+
使用 Codex 账户运行 `ais use` 后:
|
|
267
321
|
|
|
268
322
|
```bash
|
|
269
323
|
cd ~/my-project
|
|
270
324
|
ais use my-codex-account
|
|
271
325
|
|
|
272
|
-
#
|
|
326
|
+
# 输出:
|
|
273
327
|
# ✓ Switched to account 'my-codex-account' for current project.
|
|
274
328
|
# ✓ Codex profile created: ais_my-project
|
|
275
329
|
# Use: codex --profile ais_my-project [prompt]
|
|
276
330
|
```
|
|
277
331
|
|
|
278
|
-
|
|
279
|
-
1.
|
|
280
|
-
2.
|
|
332
|
+
工具会创建:
|
|
333
|
+
1. **全局 Profile**:`~/.codex/config.toml` 包含你的账户配置
|
|
334
|
+
2. **项目引用**:`.codex-profile` 包含 profile 名称
|
|
281
335
|
|
|
282
|
-
####
|
|
336
|
+
#### 运行 Codex
|
|
283
337
|
|
|
284
|
-
|
|
338
|
+
使用生成的 profile 运行 Codex:
|
|
285
339
|
|
|
286
340
|
```bash
|
|
287
|
-
#
|
|
341
|
+
# 在项目目录中
|
|
288
342
|
codex --profile ais_my-project "your prompt here"
|
|
289
343
|
|
|
290
|
-
#
|
|
344
|
+
# 或使用 .codex-profile 中的 profile 名称
|
|
291
345
|
codex --profile $(cat .codex-profile) "your prompt"
|
|
292
346
|
```
|
|
293
347
|
|
|
294
|
-
#### Codex
|
|
348
|
+
#### Codex 配置结构
|
|
295
349
|
|
|
296
|
-
|
|
350
|
+
在 `~/.codex/config.toml` 中生成的配置:
|
|
297
351
|
|
|
298
352
|
```toml
|
|
299
353
|
# AIS Profile for project: /path/to/your/project
|
|
@@ -307,61 +361,61 @@ wire_api = "chat"
|
|
|
307
361
|
http_headers = { "Authorization" = "Bearer sk-xxx..." }
|
|
308
362
|
```
|
|
309
363
|
|
|
310
|
-
####
|
|
364
|
+
#### 在不同项目间切换
|
|
311
365
|
|
|
312
|
-
|
|
366
|
+
每个项目可以使用不同的 Codex 账户:
|
|
313
367
|
|
|
314
368
|
```bash
|
|
315
|
-
#
|
|
369
|
+
# 项目 A
|
|
316
370
|
cd ~/project-a
|
|
317
371
|
ais use codex-account-1
|
|
318
372
|
codex --profile ais_project-a "implement feature X"
|
|
319
373
|
|
|
320
|
-
#
|
|
374
|
+
# 项目 B
|
|
321
375
|
cd ~/project-b
|
|
322
376
|
ais use codex-account-2
|
|
323
377
|
codex --profile ais_project-b "fix bug Y"
|
|
324
378
|
```
|
|
325
379
|
|
|
326
|
-
####
|
|
380
|
+
#### Codex 故障排除
|
|
327
381
|
|
|
328
|
-
|
|
329
|
-
-
|
|
330
|
-
-
|
|
382
|
+
**错误:"duplicate key" in TOML**
|
|
383
|
+
- 这是因为 profile 没有正确清理
|
|
384
|
+
- 解决方案:再次运行 `ais use <account>` 重新生成配置
|
|
331
385
|
|
|
332
|
-
|
|
333
|
-
-
|
|
334
|
-
-
|
|
335
|
-
-
|
|
386
|
+
**错误:"400 Bad Request" from Cloudflare**
|
|
387
|
+
- 这通常意味着 API URL 不正确
|
|
388
|
+
- 解决方案:确保 API URL 包含 `/v1` 或让 AIS 自动添加
|
|
389
|
+
- 运行 `ais use <account>` 使用正确的配置重新生成
|
|
336
390
|
|
|
337
|
-
|
|
391
|
+
**检查 Codex 配置**
|
|
338
392
|
```bash
|
|
339
|
-
#
|
|
393
|
+
# 查看你的 Codex profile
|
|
340
394
|
cat .codex-profile
|
|
341
395
|
|
|
342
|
-
#
|
|
396
|
+
# 检查配置
|
|
343
397
|
grep -A 10 "$(cat .codex-profile)" ~/.codex/config.toml
|
|
344
398
|
|
|
345
|
-
#
|
|
399
|
+
# 或使用 doctor 命令
|
|
346
400
|
ais doctor
|
|
347
401
|
```
|
|
348
402
|
|
|
349
|
-
### CCR (Claude Code Router)
|
|
403
|
+
### CCR (Claude Code Router) 集成
|
|
350
404
|
|
|
351
|
-
[Claude Code Router](https://github.com/musistudio/claude-code-router)
|
|
405
|
+
[Claude Code Router](https://github.com/musistudio/claude-code-router) 是一个强大的 Claude Code 路由层,允许你无缝使用多个 AI 提供商和模型。
|
|
352
406
|
|
|
353
|
-
|
|
354
|
-
1.
|
|
355
|
-
2.
|
|
356
|
-
3.
|
|
407
|
+
当你添加 **CCR** 类型账户并运行 `ais use` 时,工具会自动:
|
|
408
|
+
1. 更新 `~/.claude-code-router/config.json` 中的 Provider 和 Router 配置
|
|
409
|
+
2. 生成指向本地 CCR Router 的 `.claude/settings.local.json`
|
|
410
|
+
3. 自动重启 CCR Router 以应用更改
|
|
357
411
|
|
|
358
|
-
|
|
359
|
-
-
|
|
360
|
-
-
|
|
412
|
+
**前提条件:**
|
|
413
|
+
- 安装 Claude Code Router:`npm install -g @musistudio/claude-code-router`
|
|
414
|
+
- 启动 CCR Router:`ccr start`
|
|
361
415
|
|
|
362
|
-
####
|
|
416
|
+
#### 添加 CCR 账户
|
|
363
417
|
|
|
364
|
-
|
|
418
|
+
添加 CCR 账户时,你会看到有用的配置提示:
|
|
365
419
|
|
|
366
420
|
```bash
|
|
367
421
|
ais add my-ccr-account
|
|
@@ -381,20 +435,20 @@ ais add my-ccr-account
|
|
|
381
435
|
? Enter think model: gemini-2.5-pro
|
|
382
436
|
```
|
|
383
437
|
|
|
384
|
-
|
|
385
|
-
-
|
|
386
|
-
-
|
|
387
|
-
-
|
|
438
|
+
**重要说明:**
|
|
439
|
+
- 默认 API URL 是 `http://localhost:3000/v1/chat/completions`
|
|
440
|
+
- 你需要指定三个模型:default、background 和 think
|
|
441
|
+
- 模型会在 Provider 配置中自动去重
|
|
388
442
|
|
|
389
|
-
####
|
|
443
|
+
#### 在项目中使用 CCR
|
|
390
444
|
|
|
391
|
-
|
|
445
|
+
使用 CCR 账户运行 `ais use` 后:
|
|
392
446
|
|
|
393
447
|
```bash
|
|
394
448
|
cd ~/my-project
|
|
395
449
|
ais use my-ccr-account
|
|
396
450
|
|
|
397
|
-
#
|
|
451
|
+
# 输出:
|
|
398
452
|
# ✓ Switched to account 'my-ccr-account' for current project.
|
|
399
453
|
# 🔄 Restarting CCR Router...
|
|
400
454
|
# ✓ CCR Router restarted successfully
|
|
@@ -407,27 +461,27 @@ ais use my-ccr-account
|
|
|
407
461
|
# Claude Code will use CCR Router to route requests
|
|
408
462
|
```
|
|
409
463
|
|
|
410
|
-
|
|
411
|
-
1.
|
|
412
|
-
2.
|
|
413
|
-
3.
|
|
414
|
-
4.
|
|
464
|
+
工具会:
|
|
465
|
+
1. **更新 CCR 配置**:在 `~/.claude-code-router/config.json` 中添加/更新 Provider
|
|
466
|
+
2. **更新 Router**:设置 default、background 和 think 模型
|
|
467
|
+
3. **生成 Claude 配置**:创建 `.claude/settings.local.json`,`ANTHROPIC_BASE_URL` 指向 CCR Router
|
|
468
|
+
4. **重启 CCR**:自动运行 `ccr restart` 以应用更改
|
|
415
469
|
|
|
416
|
-
####
|
|
470
|
+
#### 使用 CCR 运行 Claude
|
|
417
471
|
|
|
418
|
-
|
|
472
|
+
启动 Claude 交互会话:
|
|
419
473
|
|
|
420
474
|
```bash
|
|
421
|
-
#
|
|
475
|
+
# 在项目目录中
|
|
422
476
|
claude
|
|
423
477
|
|
|
424
|
-
# Claude Code
|
|
425
|
-
#
|
|
478
|
+
# Claude Code 会自动使用 CCR Router
|
|
479
|
+
# 请求会根据你的 CCR 配置进行路由
|
|
426
480
|
```
|
|
427
481
|
|
|
428
|
-
#### CCR
|
|
482
|
+
#### CCR 配置结构
|
|
429
483
|
|
|
430
|
-
|
|
484
|
+
在 `~/.claude-code-router/config.json` 中生成的配置:
|
|
431
485
|
|
|
432
486
|
```json
|
|
433
487
|
{
|
|
@@ -448,7 +502,7 @@ The generated configuration in `~/.claude-code-router/config.json`:
|
|
|
448
502
|
}
|
|
449
503
|
```
|
|
450
504
|
|
|
451
|
-
|
|
505
|
+
在 `.claude/settings.local.json` 中生成的配置:
|
|
452
506
|
|
|
453
507
|
```json
|
|
454
508
|
{
|
|
@@ -459,57 +513,57 @@ The generated configuration in `.claude/settings.local.json`:
|
|
|
459
513
|
}
|
|
460
514
|
```
|
|
461
515
|
|
|
462
|
-
####
|
|
516
|
+
#### 在不同项目间切换
|
|
463
517
|
|
|
464
|
-
|
|
518
|
+
每个项目可以使用不同的 CCR 配置:
|
|
465
519
|
|
|
466
520
|
```bash
|
|
467
|
-
#
|
|
521
|
+
# 项目 A
|
|
468
522
|
cd ~/project-a
|
|
469
523
|
ais use ccr-account-1
|
|
470
524
|
claude
|
|
471
525
|
|
|
472
|
-
#
|
|
526
|
+
# 项目 B
|
|
473
527
|
cd ~/project-b
|
|
474
528
|
ais use ccr-account-2
|
|
475
529
|
claude
|
|
476
530
|
```
|
|
477
531
|
|
|
478
|
-
####
|
|
532
|
+
#### CCR 故障排除
|
|
479
533
|
|
|
480
|
-
|
|
534
|
+
**检查 CCR 配置**
|
|
481
535
|
```bash
|
|
482
|
-
#
|
|
536
|
+
# 查看你的 CCR 配置
|
|
483
537
|
cat ~/.claude-code-router/config.json
|
|
484
538
|
|
|
485
|
-
#
|
|
539
|
+
# 查看 Claude 配置
|
|
486
540
|
cat .claude/settings.local.json
|
|
487
541
|
|
|
488
|
-
#
|
|
542
|
+
# 或使用 doctor 命令
|
|
489
543
|
ais doctor
|
|
490
544
|
```
|
|
491
545
|
|
|
492
|
-
**CCR Router
|
|
493
|
-
-
|
|
494
|
-
-
|
|
546
|
+
**CCR Router 未安装**
|
|
547
|
+
- 从 npm 安装:`npm install -g @musistudio/claude-code-router`
|
|
548
|
+
- 访问项目页面:https://github.com/musistudio/claude-code-router
|
|
495
549
|
|
|
496
|
-
**CCR Router
|
|
497
|
-
-
|
|
498
|
-
-
|
|
499
|
-
-
|
|
550
|
+
**CCR Router 未重启**
|
|
551
|
+
- 确保 CCR CLI 已安装并在 PATH 中可用
|
|
552
|
+
- 如果自动重启失败,手动运行 `ccr restart`
|
|
553
|
+
- 检查 CCR Router 是否运行:`ccr status`
|
|
500
554
|
|
|
501
|
-
**Claude
|
|
502
|
-
-
|
|
503
|
-
-
|
|
504
|
-
-
|
|
555
|
+
**Claude 未使用 CCR Router**
|
|
556
|
+
- 验证 `.claude/settings.local.json` 中的 `ANTHROPIC_BASE_URL` 指向正确的端口
|
|
557
|
+
- 检查 CCR Router 是否在配置的端口上运行
|
|
558
|
+
- 配置更改后重启 Claude Code
|
|
505
559
|
|
|
506
|
-
### Droids
|
|
560
|
+
### Droids 集成
|
|
507
561
|
|
|
508
|
-
|
|
562
|
+
当你添加 **Droids** 类型账户并运行 `ais use` 时,工具会自动在项目目录中创建 `.droids/config.json` 配置文件。
|
|
509
563
|
|
|
510
|
-
####
|
|
564
|
+
#### 添加 Droids 账户
|
|
511
565
|
|
|
512
|
-
|
|
566
|
+
添加 Droids 账户时,你会看到有用的配置提示:
|
|
513
567
|
|
|
514
568
|
```bash
|
|
515
569
|
ais add my-droids-account
|
|
@@ -527,15 +581,15 @@ ais add my-droids-account
|
|
|
527
581
|
? Enter model name: droids-model-v1
|
|
528
582
|
```
|
|
529
583
|
|
|
530
|
-
####
|
|
584
|
+
#### 在项目中使用 Droids
|
|
531
585
|
|
|
532
|
-
|
|
586
|
+
使用 Droids 账户运行 `ais use` 后:
|
|
533
587
|
|
|
534
588
|
```bash
|
|
535
589
|
cd ~/my-project
|
|
536
590
|
ais use my-droids-account
|
|
537
591
|
|
|
538
|
-
#
|
|
592
|
+
# 输出:
|
|
539
593
|
# ✓ Switched to account 'my-droids-account' for current project.
|
|
540
594
|
# ✓ Droids configuration generated at: .droids/config.json
|
|
541
595
|
#
|
|
@@ -545,23 +599,23 @@ ais use my-droids-account
|
|
|
545
599
|
# Droids will automatically use the configuration from .droids/config.json
|
|
546
600
|
```
|
|
547
601
|
|
|
548
|
-
|
|
549
|
-
-
|
|
602
|
+
工具会创建:
|
|
603
|
+
- **项目配置**:`.droids/config.json` 包含你的账户设置
|
|
550
604
|
|
|
551
|
-
####
|
|
605
|
+
#### 运行 Droids
|
|
552
606
|
|
|
553
|
-
|
|
607
|
+
启动 Droids 交互会话:
|
|
554
608
|
|
|
555
609
|
```bash
|
|
556
|
-
#
|
|
610
|
+
# 在项目目录中
|
|
557
611
|
droid
|
|
558
612
|
|
|
559
|
-
# Droids
|
|
613
|
+
# Droids 会自动从 .droids/config.json 加载配置
|
|
560
614
|
```
|
|
561
615
|
|
|
562
|
-
#### Droids
|
|
616
|
+
#### Droids 配置结构
|
|
563
617
|
|
|
564
|
-
|
|
618
|
+
在 `.droids/config.json` 中生成的配置:
|
|
565
619
|
|
|
566
620
|
```json
|
|
567
621
|
{
|
|
@@ -574,42 +628,42 @@ The generated configuration in `.droids/config.json`:
|
|
|
574
628
|
}
|
|
575
629
|
```
|
|
576
630
|
|
|
577
|
-
####
|
|
631
|
+
#### 在不同项目间切换
|
|
578
632
|
|
|
579
|
-
|
|
633
|
+
每个项目可以使用不同的 Droids 账户:
|
|
580
634
|
|
|
581
635
|
```bash
|
|
582
|
-
#
|
|
636
|
+
# 项目 A
|
|
583
637
|
cd ~/project-a
|
|
584
638
|
ais use droids-account-1
|
|
585
639
|
droid
|
|
586
640
|
|
|
587
|
-
#
|
|
641
|
+
# 项目 B
|
|
588
642
|
cd ~/project-b
|
|
589
643
|
ais use droids-account-2
|
|
590
644
|
droid
|
|
591
645
|
```
|
|
592
646
|
|
|
593
|
-
####
|
|
647
|
+
#### Droids 故障排除
|
|
594
648
|
|
|
595
|
-
|
|
649
|
+
**检查 Droids 配置**
|
|
596
650
|
```bash
|
|
597
|
-
#
|
|
651
|
+
# 查看你的 Droids 配置
|
|
598
652
|
cat .droids/config.json
|
|
599
653
|
|
|
600
|
-
#
|
|
654
|
+
# 或使用 doctor 命令
|
|
601
655
|
ais doctor
|
|
602
656
|
```
|
|
603
657
|
|
|
604
|
-
**Droids CLI
|
|
605
|
-
-
|
|
606
|
-
-
|
|
658
|
+
**Droids CLI 未找到**
|
|
659
|
+
- 确保 Droids CLI 已安装并在 PATH 中可用
|
|
660
|
+
- 运行 `droid --version` 验证安装
|
|
607
661
|
|
|
608
|
-
####
|
|
662
|
+
#### 自定义环境变量
|
|
609
663
|
|
|
610
|
-
|
|
664
|
+
在创建账户时可以添加自定义环境变量。在提示时,使用 `KEY=VALUE` 格式输入:
|
|
611
665
|
|
|
612
|
-
|
|
666
|
+
**输入格式:**
|
|
613
667
|
```
|
|
614
668
|
? Environment variable (KEY=VALUE format): CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
|
|
615
669
|
✓ Added: CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
|
|
@@ -620,572 +674,519 @@ You can add custom environment variables when creating an account. When prompted
|
|
|
620
674
|
? Add another environment variable? (y/N)
|
|
621
675
|
```
|
|
622
676
|
|
|
623
|
-
|
|
624
|
-
- `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` -
|
|
625
|
-
- `HTTP_PROXY=http://proxy.example.com:8080` -
|
|
626
|
-
- `HTTPS_PROXY=https://proxy.example.com:8080` -
|
|
627
|
-
-
|
|
628
|
-
|
|
629
|
-
**Features:**
|
|
630
|
-
- One-line input format (`KEY=VALUE`)
|
|
631
|
-
- Real-time display of added variables
|
|
632
|
-
- Press Enter without input to finish
|
|
633
|
-
- Variables are automatically included in `.claude/settings.local.json`
|
|
634
|
-
|
|
635
|
-
### MCP (Model Context Protocol) Integration
|
|
636
|
-
|
|
637
|
-
AIS supports managing MCP servers globally and enabling them per project. MCP servers extend Claude Code with additional tools and capabilities.
|
|
638
|
-
|
|
639
|
-
You can manage MCP servers through both **CLI commands** and **Web UI**.
|
|
640
|
-
|
|
641
|
-
#### Web UI Management (Recommended)
|
|
642
|
-
|
|
643
|
-
The easiest way to manage MCP servers is through the Web UI:
|
|
644
|
-
|
|
645
|
-
```bash
|
|
646
|
-
ais ui
|
|
647
|
-
```
|
|
648
|
-
|
|
649
|
-
Then click on the **"MCP 服务器" (MCP Servers)** tab to:
|
|
650
|
-
|
|
651
|
-
**Features:**
|
|
652
|
-
- ✅ **Add MCP Servers**: Click "+ 添加 MCP 服务器" to add new servers
|
|
653
|
-
- Choose server type: stdio, sse, or http
|
|
654
|
-
- Fill in configuration (command, URL, environment variables, etc.)
|
|
655
|
-
- Add description for easy identification
|
|
656
|
-
- ✅ **Edit Servers**: Click "编辑" to modify existing server configurations
|
|
657
|
-
- ✅ **Test Connection**: Click "测试连接" to verify server availability
|
|
658
|
-
- ✅ **Enable/Disable**: Toggle servers for the current project with one click
|
|
659
|
-
- ✅ **Search & Filter**: Quickly find servers by name or type
|
|
660
|
-
- ✅ **Delete Servers**: Remove servers you no longer need
|
|
661
|
-
- ✅ **Sync Configuration**: Click "同步配置" to sync to Claude Code
|
|
662
|
-
|
|
663
|
-
**Benefits:**
|
|
664
|
-
- Intuitive visual interface
|
|
665
|
-
- Real-time validation
|
|
666
|
-
- No need to remember command syntax
|
|
667
|
-
- See all servers at a glance
|
|
668
|
-
- Status indicators (enabled/disabled)
|
|
669
|
-
- Supports Chinese and English
|
|
670
|
-
|
|
671
|
-
**Example Workflow:**
|
|
672
|
-
1. Start Web UI: `ais ui`
|
|
673
|
-
2. Click "MCP 服务器" tab
|
|
674
|
-
3. Click "+ 添加 MCP 服务器"
|
|
675
|
-
4. Select type: "stdio"
|
|
676
|
-
5. Enter command: "npx"
|
|
677
|
-
6. Enter arguments: "@modelcontextprotocol/server-filesystem,/path"
|
|
678
|
-
7. Click "保存"
|
|
679
|
-
8. Click "测试连接" to verify
|
|
680
|
-
9. Click "启用" to enable for current project
|
|
681
|
-
|
|
682
|
-
#### CLI Management
|
|
683
|
-
|
|
684
|
-
You can also manage MCP servers through CLI commands:
|
|
685
|
-
|
|
686
|
-
##### Adding an MCP Server
|
|
687
|
-
|
|
688
|
-
Add a new MCP server interactively:
|
|
689
|
-
|
|
690
|
-
```bash
|
|
691
|
-
ais mcp add filesystem
|
|
692
|
-
```
|
|
693
|
-
|
|
694
|
-
You'll be prompted to configure:
|
|
695
|
-
- **Server type**: stdio, sse, or http
|
|
696
|
-
- **Command and arguments** (for stdio type)
|
|
697
|
-
- **URL** (for sse/http types)
|
|
698
|
-
- **Environment variables** (optional)
|
|
699
|
-
- **Headers** (optional for sse/http)
|
|
700
|
-
- **Description** (optional)
|
|
701
|
-
|
|
702
|
-
**Example: Adding a stdio MCP server**
|
|
703
|
-
```bash
|
|
704
|
-
$ ais mcp add filesystem
|
|
705
|
-
? Select MCP server type: stdio
|
|
706
|
-
? Enter command: npx
|
|
707
|
-
? Enter arguments (comma-separated): @modelcontextprotocol/server-filesystem,/Users/user/workspace
|
|
708
|
-
? Add environment variables? Yes
|
|
709
|
-
? Environment variable (KEY=VALUE): ALLOWED_PATHS=/Users/user/workspace
|
|
710
|
-
? Add another? No
|
|
711
|
-
? Enter description: File system access MCP server
|
|
712
|
-
✓ MCP server 'filesystem' added successfully!
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
##### Listing MCP Servers
|
|
716
|
-
|
|
717
|
-
View all configured MCP servers:
|
|
718
|
-
|
|
719
|
-
```bash
|
|
720
|
-
ais mcp list
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
Output shows server name, type, enabled status, and description.
|
|
724
|
-
|
|
725
|
-
##### Enabling MCP Servers for a Project
|
|
726
|
-
|
|
727
|
-
Enable an MCP server for the current project:
|
|
728
|
-
|
|
729
|
-
```bash
|
|
730
|
-
cd ~/my-project
|
|
731
|
-
ais mcp enable filesystem
|
|
732
|
-
```
|
|
733
|
-
|
|
734
|
-
This will:
|
|
735
|
-
1. Add the server to the project's enabled list
|
|
736
|
-
2. Update `.claude/settings.local.json` with the MCP configuration
|
|
737
|
-
3. Make the MCP server available to Claude Code in this project
|
|
738
|
-
|
|
739
|
-
##### Managing MCP Servers
|
|
740
|
-
|
|
741
|
-
```bash
|
|
742
|
-
# Show MCP server details
|
|
743
|
-
ais mcp show filesystem
|
|
744
|
-
|
|
745
|
-
# Update MCP server configuration
|
|
746
|
-
ais mcp update filesystem
|
|
747
|
-
|
|
748
|
-
# Disable MCP server for current project
|
|
749
|
-
ais mcp disable filesystem
|
|
750
|
-
|
|
751
|
-
# Show enabled MCP servers for current project
|
|
752
|
-
ais mcp enabled
|
|
753
|
-
|
|
754
|
-
# Sync MCP configuration to Claude Code
|
|
755
|
-
ais mcp sync
|
|
756
|
-
|
|
757
|
-
# Remove an MCP server
|
|
758
|
-
ais mcp remove filesystem
|
|
759
|
-
```
|
|
760
|
-
|
|
761
|
-
#### MCP Configuration Structure
|
|
762
|
-
|
|
763
|
-
MCP servers are stored globally in `~/.ai-account-switch/config.json`:
|
|
764
|
-
|
|
765
|
-
```json
|
|
766
|
-
{
|
|
767
|
-
"accounts": { ... },
|
|
768
|
-
"mcpServers": {
|
|
769
|
-
"filesystem": {
|
|
770
|
-
"name": "filesystem",
|
|
771
|
-
"type": "stdio",
|
|
772
|
-
"command": "npx",
|
|
773
|
-
"args": ["@modelcontextprotocol/server-filesystem", "/Users/user/workspace"],
|
|
774
|
-
"env": {
|
|
775
|
-
"ALLOWED_PATHS": "/Users/user/workspace"
|
|
776
|
-
},
|
|
777
|
-
"description": "File system access MCP server",
|
|
778
|
-
"createdAt": "2025-01-03T00:00:00.000Z",
|
|
779
|
-
"updatedAt": "2025-01-03T00:00:00.000Z"
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
```
|
|
784
|
-
|
|
785
|
-
Project-level enabled servers are stored in `.ais-project-config`:
|
|
786
|
-
|
|
787
|
-
```json
|
|
788
|
-
{
|
|
789
|
-
"activeAccount": "my-account",
|
|
790
|
-
"projectPath": "/path/to/project",
|
|
791
|
-
"setAt": "2025-01-03T00:00:00.000Z",
|
|
792
|
-
"enabledMcpServers": ["filesystem"]
|
|
793
|
-
}
|
|
794
|
-
```
|
|
795
|
-
|
|
796
|
-
When enabled, MCP servers are automatically added to `.claude/settings.local.json`:
|
|
797
|
-
|
|
798
|
-
```json
|
|
799
|
-
{
|
|
800
|
-
"env": { ... },
|
|
801
|
-
"permissions": { ... },
|
|
802
|
-
"mcpServers": {
|
|
803
|
-
"filesystem": {
|
|
804
|
-
"command": "npx",
|
|
805
|
-
"args": ["@modelcontextprotocol/server-filesystem", "/Users/user/workspace"],
|
|
806
|
-
"env": {
|
|
807
|
-
"ALLOWED_PATHS": "/Users/user/workspace"
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
```
|
|
813
|
-
|
|
814
|
-
#### MCP Server Types
|
|
815
|
-
|
|
816
|
-
**stdio**: Communicates via standard input/output
|
|
817
|
-
- Requires: `command`, `args`
|
|
818
|
-
- Optional: `env`
|
|
819
|
-
|
|
820
|
-
**sse**: Server-Sent Events
|
|
821
|
-
- Requires: `url`
|
|
822
|
-
- Optional: `headers`
|
|
677
|
+
**常见示例:**
|
|
678
|
+
- `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` - 禁用非必要网络流量
|
|
679
|
+
- `HTTP_PROXY=http://proxy.example.com:8080` - 设置 HTTP 代理
|
|
680
|
+
- `HTTPS_PROXY=https://proxy.example.com:8080` - 设置 HTTPS 代理
|
|
681
|
+
- 其他你需要的环境变量
|
|
823
682
|
|
|
824
|
-
|
|
825
|
-
-
|
|
826
|
-
-
|
|
683
|
+
**功能特性:**
|
|
684
|
+
- 单行输入格式(`KEY=VALUE`)
|
|
685
|
+
- 实时显示已添加的变量
|
|
686
|
+
- 直接按回车即可完成
|
|
687
|
+
- 变量会自动包含在 `.claude/settings.local.json` 文件中
|
|
827
688
|
|
|
828
|
-
##
|
|
689
|
+
## 使用示例
|
|
829
690
|
|
|
830
|
-
###
|
|
691
|
+
### 示例 1:设置多个账户
|
|
831
692
|
|
|
832
693
|
```bash
|
|
833
|
-
#
|
|
694
|
+
# 添加个人 Claude 账户
|
|
834
695
|
ais add personal-claude
|
|
835
696
|
|
|
836
|
-
#
|
|
697
|
+
# 添加工作 Claude 账户
|
|
837
698
|
ais add work-claude
|
|
838
699
|
|
|
839
|
-
#
|
|
700
|
+
# 添加 Codex 账户
|
|
840
701
|
ais add codex-dev
|
|
841
702
|
|
|
842
|
-
#
|
|
703
|
+
# 添加 Droids 账户
|
|
843
704
|
ais add droids-dev
|
|
844
705
|
|
|
845
|
-
#
|
|
706
|
+
# 列出所有账户
|
|
846
707
|
ais list
|
|
847
708
|
```
|
|
848
709
|
|
|
849
|
-
###
|
|
710
|
+
### 示例 2:为不同项目使用不同账户
|
|
850
711
|
|
|
851
712
|
```bash
|
|
852
|
-
#
|
|
713
|
+
# 在个人项目中
|
|
853
714
|
cd ~/my-personal-project
|
|
854
715
|
ais use personal-claude
|
|
855
716
|
|
|
856
|
-
#
|
|
717
|
+
# 在工作项目中
|
|
857
718
|
cd ~/work/company-project
|
|
858
719
|
ais use work-claude
|
|
859
720
|
|
|
860
|
-
#
|
|
721
|
+
# 检查激活的账户
|
|
861
722
|
ais info
|
|
862
723
|
```
|
|
863
724
|
|
|
864
|
-
###
|
|
725
|
+
### 示例 3:管理账户
|
|
865
726
|
|
|
866
727
|
```bash
|
|
867
|
-
#
|
|
728
|
+
# 查看所有账户
|
|
868
729
|
ais list
|
|
869
730
|
|
|
870
|
-
#
|
|
731
|
+
# 检查当前账户
|
|
871
732
|
ais current
|
|
872
733
|
|
|
873
|
-
#
|
|
734
|
+
# 导出账户配置
|
|
874
735
|
ais export personal-claude
|
|
875
736
|
|
|
876
|
-
#
|
|
737
|
+
# 删除旧账户
|
|
877
738
|
ais remove old-account
|
|
878
739
|
|
|
879
|
-
#
|
|
740
|
+
# 查看配置位置
|
|
880
741
|
ais paths
|
|
881
742
|
```
|
|
882
743
|
|
|
883
|
-
|
|
744
|
+
### 示例 4:诊断问题
|
|
884
745
|
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
746
|
+
```bash
|
|
747
|
+
# 如果 Claude Code 使用了错误的账户
|
|
748
|
+
cd ~/your-project
|
|
749
|
+
ais doctor
|
|
750
|
+
|
|
751
|
+
# 根据诊断建议操作
|
|
752
|
+
# 然后重新设置账户
|
|
753
|
+
ais use correct-account
|
|
754
|
+
```
|
|
755
|
+
|
|
756
|
+
## 安全注意事项
|
|
890
757
|
|
|
891
|
-
|
|
758
|
+
- API 密钥仅存储在本地机器上
|
|
759
|
+
- 全局配置文件包含敏感凭证
|
|
760
|
+
- `ais use` 命令会自动将配置文件添加到 `.gitignore` (如果项目是 Git 仓库)
|
|
761
|
+
- 始终验证 `.gitignore` 包含以下文件:
|
|
762
|
+
- `.ais-project-config`
|
|
763
|
+
- `.claude/settings.local.json`
|
|
764
|
+
- 切勿将账户凭证提交到版本控制
|
|
765
|
+
- 显示 API 密钥时会进行掩码处理(仅显示前 4 位和后 4 位字符)
|
|
892
766
|
|
|
893
|
-
|
|
894
|
-
|----------|--------|-------|
|
|
895
|
-
| macOS | ✅ Fully Supported | Tested on macOS 10.15+ |
|
|
896
|
-
| Linux | ✅ Fully Supported | Tested on Ubuntu 20.04+ |
|
|
897
|
-
| Windows | ✅ Fully Supported | Tested on Windows 10+ |
|
|
767
|
+
## 平台兼容性
|
|
898
768
|
|
|
899
|
-
|
|
769
|
+
| 平台 | 状态 | 备注 |
|
|
770
|
+
|------|------|------|
|
|
771
|
+
| macOS | ✅ 完全支持 | 已在 macOS 10.15+ 上测试 |
|
|
772
|
+
| Linux | ✅ 完全支持 | 已在 Ubuntu 20.04+ 上测试 |
|
|
773
|
+
| Windows | ✅ 完全支持 | 已在 Windows 10+ 上测试 |
|
|
774
|
+
|
|
775
|
+
## 系统要求
|
|
900
776
|
|
|
901
777
|
- **Node.js**: >= 16.0.0
|
|
902
778
|
- **npm**: >= 7.0.0
|
|
903
779
|
|
|
904
|
-
|
|
780
|
+
**注意**: 此工具需要 Node.js 16 或更高版本(因为 commander@11.x 依赖要求)。你可以使用以下命令检查当前版本:
|
|
905
781
|
```bash
|
|
906
782
|
node --version
|
|
907
783
|
npm --version
|
|
908
784
|
```
|
|
909
785
|
|
|
910
|
-
|
|
786
|
+
如果需要升级 Node.js,请访问 [nodejs.org](https://nodejs.org/) 或使用版本管理器如 [nvm](https://github.com/nvm-sh/nvm)。
|
|
911
787
|
|
|
912
|
-
##
|
|
788
|
+
## 项目结构
|
|
913
789
|
|
|
914
790
|
```
|
|
915
791
|
ai-agent-user-swith/
|
|
916
792
|
├── bin/
|
|
917
|
-
│ └── ais.js #
|
|
793
|
+
│ └── ais.js # 可执行入口点
|
|
918
794
|
├── src/
|
|
919
|
-
│ ├── index.js #
|
|
920
|
-
│ ├── commands.js #
|
|
921
|
-
│ └── config.js #
|
|
795
|
+
│ ├── index.js # 主 CLI 程序
|
|
796
|
+
│ ├── commands.js # 命令实现
|
|
797
|
+
│ └── config.js # 配置管理器
|
|
798
|
+
├── .github/
|
|
799
|
+
│ └── workflows/
|
|
800
|
+
│ └── release.yml # GitHub Actions 自动发布
|
|
922
801
|
├── package.json
|
|
923
802
|
├── .gitignore
|
|
924
|
-
|
|
803
|
+
├── .npmignore
|
|
804
|
+
├── README.md # 英文文档
|
|
805
|
+
├── README_ZH.md # 中文文档
|
|
806
|
+
├── NPM_PUBLISH.md # npm 发布指南
|
|
807
|
+
└── RELEASE.md # 发布指南
|
|
925
808
|
```
|
|
926
809
|
|
|
927
|
-
##
|
|
810
|
+
## 故障排除
|
|
928
811
|
|
|
929
|
-
###
|
|
812
|
+
### 命令未找到:ais
|
|
930
813
|
|
|
931
|
-
|
|
814
|
+
如果安装后出现此错误,确保已链接包:
|
|
932
815
|
|
|
933
816
|
```bash
|
|
934
817
|
npm link
|
|
935
818
|
```
|
|
936
819
|
|
|
937
|
-
###
|
|
820
|
+
### 权限被拒绝
|
|
938
821
|
|
|
939
|
-
|
|
822
|
+
在 Unix 系统上,确保 bin 文件可执行:
|
|
940
823
|
|
|
941
824
|
```bash
|
|
942
825
|
chmod +x bin/ais.js
|
|
943
826
|
```
|
|
944
827
|
|
|
945
|
-
###
|
|
828
|
+
### 未找到账户
|
|
946
829
|
|
|
947
|
-
|
|
830
|
+
确保你已添加至少一个账户:
|
|
948
831
|
|
|
949
832
|
```bash
|
|
950
833
|
ais add
|
|
951
834
|
```
|
|
952
835
|
|
|
953
|
-
### Claude Code
|
|
836
|
+
### Claude Code 使用了错误的账户
|
|
954
837
|
|
|
955
|
-
|
|
838
|
+
如果 Claude Code 使用了非预期的账户:
|
|
956
839
|
|
|
957
|
-
1.
|
|
840
|
+
1. 运行诊断:
|
|
958
841
|
```bash
|
|
959
842
|
ais doctor
|
|
960
843
|
```
|
|
961
844
|
|
|
962
|
-
2.
|
|
963
|
-
-
|
|
964
|
-
-
|
|
845
|
+
2. 检查全局 Claude 配置是否覆盖了项目配置:
|
|
846
|
+
- 如果 `~/.claude/settings.json` 包含 `env.ANTHROPIC_AUTH_TOKEN`,可能会冲突
|
|
847
|
+
- **解决方案**:从全局配置中删除 `env` 部分,或仅保留 `permissions`
|
|
965
848
|
|
|
966
|
-
3.
|
|
849
|
+
3. 确保从项目目录或子目录启动 Claude Code
|
|
967
850
|
|
|
968
|
-
4.
|
|
851
|
+
4. 重新生成项目配置:
|
|
969
852
|
```bash
|
|
970
|
-
ais use
|
|
853
|
+
ais use <你的账户名>
|
|
971
854
|
```
|
|
972
855
|
|
|
973
|
-
###
|
|
856
|
+
### 在子目录中未找到项目配置
|
|
974
857
|
|
|
975
|
-
|
|
858
|
+
工具应该在任何子目录中工作。如果不行:
|
|
976
859
|
|
|
977
860
|
```bash
|
|
978
|
-
#
|
|
861
|
+
# 确保你在已配置的项目中
|
|
979
862
|
cd /path/to/your/project
|
|
980
863
|
ais use <account>
|
|
981
864
|
|
|
982
|
-
#
|
|
865
|
+
# 然后从子目录尝试
|
|
983
866
|
cd src/
|
|
984
|
-
ais current #
|
|
867
|
+
ais current # 应该显示你的账户
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
### MCP (Model Context Protocol) 集成
|
|
871
|
+
|
|
872
|
+
AIS 支持全局管理 MCP 服务器并按项目启用。MCP 服务器为 Claude Code 扩展额外的工具和功能。
|
|
873
|
+
|
|
874
|
+
你可以通过 **CLI 命令**和 **Web UI** 两种方式管理 MCP 服务器。
|
|
875
|
+
|
|
876
|
+
#### Web UI 管理(推荐)
|
|
877
|
+
|
|
878
|
+
管理 MCP 服务器最简单的方式是通过 Web UI:
|
|
879
|
+
|
|
880
|
+
```bash
|
|
881
|
+
ais ui
|
|
882
|
+
```
|
|
883
|
+
|
|
884
|
+
然后点击 **"MCP 服务器"** 标签页:
|
|
885
|
+
|
|
886
|
+
**功能:**
|
|
887
|
+
- ✅ **添加 MCP 服务器**:点击"+ 添加 MCP 服务器"添加新服务器
|
|
888
|
+
- 选择服务器类型:stdio、sse 或 http
|
|
889
|
+
- 填写配置(命令、URL、环境变量等)
|
|
890
|
+
- 添加描述便于识别
|
|
891
|
+
- ✅ **编辑服务器**:点击"编辑"修改现有服务器配置
|
|
892
|
+
- ✅ **测试连接**:点击"测试连接"验证服务器可用性
|
|
893
|
+
- ✅ **启用/禁用**:一键切换当前项目的服务器状态
|
|
894
|
+
- ✅ **搜索和筛选**:快速按名称或类型查找服务器
|
|
895
|
+
- ✅ **删除服务器**:删除不再需要的服务器
|
|
896
|
+
- ✅ **同步配置**:点击"同步配置"同步到 Claude Code
|
|
897
|
+
|
|
898
|
+
**优势:**
|
|
899
|
+
- 直观的可视化界面
|
|
900
|
+
- 实时验证
|
|
901
|
+
- 无需记忆命令语法
|
|
902
|
+
- 一目了然查看所有服务器
|
|
903
|
+
- 状态指示器(已启用/未启用)
|
|
904
|
+
- 支持中英文
|
|
905
|
+
|
|
906
|
+
**示例工作流程:**
|
|
907
|
+
1. 启动 Web UI:`ais ui`
|
|
908
|
+
2. 点击"MCP 服务器"标签页
|
|
909
|
+
3. 点击"+ 添加 MCP 服务器"
|
|
910
|
+
4. 选择类型:"stdio"
|
|
911
|
+
5. 输入命令:"npx"
|
|
912
|
+
6. 输入参数:"@modelcontextprotocol/server-filesystem,/path"
|
|
913
|
+
7. 点击"保存"
|
|
914
|
+
8. 点击"测试连接"验证
|
|
915
|
+
9. 点击"启用"为当前项目启用
|
|
916
|
+
|
|
917
|
+
#### CLI 管理
|
|
918
|
+
|
|
919
|
+
你也可以通过 CLI 命令管理 MCP 服务器:
|
|
920
|
+
|
|
921
|
+
##### 添加 MCP 服务器
|
|
922
|
+
|
|
923
|
+
交互式添加新的 MCP 服务器:
|
|
924
|
+
|
|
925
|
+
```bash
|
|
926
|
+
ais mcp add filesystem
|
|
927
|
+
```
|
|
928
|
+
|
|
929
|
+
你将被提示配置:
|
|
930
|
+
- **服务器类型**:stdio、sse 或 http
|
|
931
|
+
- **命令和参数**(stdio 类型)
|
|
932
|
+
- **URL**(sse/http 类型)
|
|
933
|
+
- **环境变量**(可选)
|
|
934
|
+
- **请求头**(sse/http 可选)
|
|
935
|
+
- **描述**(可选)
|
|
936
|
+
|
|
937
|
+
**示例:添加 stdio MCP 服务器**
|
|
938
|
+
```bash
|
|
939
|
+
$ ais mcp add filesystem
|
|
940
|
+
? 选择 MCP 服务器类型: stdio
|
|
941
|
+
? 输入命令: npx
|
|
942
|
+
? 输入参数(逗号分隔): @modelcontextprotocol/server-filesystem,/Users/user/workspace
|
|
943
|
+
? 添加环境变量? 是
|
|
944
|
+
? 环境变量 (KEY=VALUE): ALLOWED_PATHS=/Users/user/workspace
|
|
945
|
+
? 添加另一个? 否
|
|
946
|
+
? 输入描述: 文件系统访问 MCP 服务器
|
|
947
|
+
✓ MCP 服务器 'filesystem' 添加成功!
|
|
948
|
+
```
|
|
949
|
+
|
|
950
|
+
##### 列出 MCP 服务器
|
|
951
|
+
|
|
952
|
+
查看所有配置的 MCP 服务器:
|
|
953
|
+
|
|
954
|
+
```bash
|
|
955
|
+
ais mcp list
|
|
956
|
+
```
|
|
957
|
+
|
|
958
|
+
输出显示服务器名称、类型、启用状态和描述。
|
|
959
|
+
|
|
960
|
+
##### 为项目启用 MCP 服务器
|
|
961
|
+
|
|
962
|
+
为当前项目启用 MCP 服务器:
|
|
963
|
+
|
|
964
|
+
```bash
|
|
965
|
+
cd ~/my-project
|
|
966
|
+
ais mcp enable filesystem
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
这将:
|
|
970
|
+
1. 将服务器添加到项目的启用列表
|
|
971
|
+
2. 更新 `.claude/settings.local.json` 的 MCP 配置
|
|
972
|
+
3. 使 MCP 服务器在此项目中对 Claude Code 可用
|
|
973
|
+
|
|
974
|
+
##### 管理 MCP 服务器
|
|
975
|
+
|
|
976
|
+
```bash
|
|
977
|
+
# 显示 MCP 服务器详情
|
|
978
|
+
ais mcp show filesystem
|
|
979
|
+
|
|
980
|
+
# 更新 MCP 服务器配置
|
|
981
|
+
ais mcp update filesystem
|
|
982
|
+
|
|
983
|
+
# 为当前项目禁用 MCP 服务器
|
|
984
|
+
ais mcp disable filesystem
|
|
985
|
+
|
|
986
|
+
# 显示当前项目已启用的 MCP 服务器
|
|
987
|
+
ais mcp enabled
|
|
988
|
+
|
|
989
|
+
# 同步 MCP 配置到 Claude Code
|
|
990
|
+
ais mcp sync
|
|
991
|
+
|
|
992
|
+
# 删除 MCP 服务器
|
|
993
|
+
ais mcp remove filesystem
|
|
985
994
|
```
|
|
986
995
|
|
|
987
|
-
##
|
|
996
|
+
## 贡献
|
|
988
997
|
|
|
989
|
-
|
|
990
|
-
-
|
|
991
|
-
-
|
|
992
|
-
-
|
|
998
|
+
欢迎贡献!你可以:
|
|
999
|
+
- 报告 bug
|
|
1000
|
+
- 建议新功能
|
|
1001
|
+
- 提交 pull request
|
|
993
1002
|
|
|
994
|
-
##
|
|
1003
|
+
## 许可证
|
|
995
1004
|
|
|
996
|
-
MIT License -
|
|
1005
|
+
MIT License - 欢迎在你的项目中使用此工具!
|
|
997
1006
|
|
|
998
|
-
##
|
|
1007
|
+
## 更新日志
|
|
999
1008
|
|
|
1000
1009
|
### v1.7.0
|
|
1001
|
-
- **MCP Web UI
|
|
1002
|
-
-
|
|
1003
|
-
-
|
|
1004
|
-
-
|
|
1005
|
-
-
|
|
1006
|
-
-
|
|
1007
|
-
-
|
|
1008
|
-
-
|
|
1009
|
-
-
|
|
1010
|
-
- **MCP CLI
|
|
1011
|
-
-
|
|
1012
|
-
-
|
|
1013
|
-
-
|
|
1014
|
-
-
|
|
1015
|
-
-
|
|
1016
|
-
-
|
|
1017
|
-
-
|
|
1018
|
-
-
|
|
1019
|
-
- **Bug
|
|
1020
|
-
-
|
|
1021
|
-
-
|
|
1022
|
-
-
|
|
1023
|
-
-
|
|
1024
|
-
-
|
|
1025
|
-
-
|
|
1026
|
-
-
|
|
1027
|
-
- 32
|
|
1010
|
+
- **MCP Web UI 管理**:
|
|
1011
|
+
- 通过 Web UI 完整管理 MCP 服务器
|
|
1012
|
+
- 标签页导航系统(账号管理 / MCP 服务器)
|
|
1013
|
+
- 直观界面添加、编辑、删除 MCP 服务器
|
|
1014
|
+
- 测试 MCP 服务器连接
|
|
1015
|
+
- 一键启用/禁用项目级服务器
|
|
1016
|
+
- 搜索和筛选功能
|
|
1017
|
+
- 实时验证和状态指示器
|
|
1018
|
+
- 完整的中英文支持
|
|
1019
|
+
- **MCP CLI 集成**:
|
|
1020
|
+
- 使用 `ais mcp` 命令全局管理 MCP 服务器
|
|
1021
|
+
- 项目级 MCP 服务器启用/禁用功能
|
|
1022
|
+
- 支持 stdio、sse 和 http MCP 服务器类型
|
|
1023
|
+
- 自动生成 Claude Code 的 MCP 配置
|
|
1024
|
+
- 命令:`ais mcp add`、`ais mcp list`、`ais mcp show`、`ais mcp update`、`ais mcp remove`
|
|
1025
|
+
- 项目命令:`ais mcp enable`、`ais mcp disable`、`ais mcp enabled`、`ais mcp sync`
|
|
1026
|
+
- 交互式 MCP 服务器配置,带验证
|
|
1027
|
+
- 支持 MCP 服务器的环境变量和请求头
|
|
1028
|
+
- **Bug 修复**:
|
|
1029
|
+
- 修复添加标签页后账号数据不显示的问题
|
|
1030
|
+
- 修复 "switchTab is not defined" 错误
|
|
1031
|
+
- 修复搜索结果提示信息不正确的问题
|
|
1032
|
+
- **改进**:
|
|
1033
|
+
- 更好的用户体验,提示信息更清晰
|
|
1034
|
+
- 现代 JavaScript 实践(事件监听器)
|
|
1035
|
+
- 改进代码质量和可维护性
|
|
1036
|
+
- 32 个自动化测试全部通过
|
|
1028
1037
|
|
|
1029
1038
|
### v1.6.0
|
|
1030
|
-
- **CCR (Claude Code Router)
|
|
1031
|
-
-
|
|
1032
|
-
-
|
|
1033
|
-
- Provider
|
|
1034
|
-
-
|
|
1035
|
-
- Claude Code
|
|
1036
|
-
-
|
|
1037
|
-
- **Web UI
|
|
1038
|
-
-
|
|
1039
|
-
-
|
|
1040
|
-
-
|
|
1041
|
-
-
|
|
1042
|
-
-
|
|
1043
|
-
-
|
|
1044
|
-
- CCR
|
|
1045
|
-
-
|
|
1046
|
-
-
|
|
1047
|
-
|
|
1048
|
-
### v1.5.8
|
|
1049
|
-
- **Bilingual Support (双语支持)**:
|
|
1050
|
-
- All CLI commands now display both English and Chinese text (所有 CLI 命令现在同时显示中英文)
|
|
1051
|
-
- Help messages, prompts, and output messages are bilingual (帮助信息、提示和输出消息都支持双语)
|
|
1052
|
-
- Better user experience for Chinese-speaking users (为中文用户提供更好的使用体验)
|
|
1053
|
-
- No configuration needed - works out of the box (无需配置 - 开箱即用)
|
|
1054
|
-
- Uses parentheses format for better clarity: `English text (中文)` (使用括号格式更清晰)
|
|
1039
|
+
- **CCR (Claude Code Router) 集成**:
|
|
1040
|
+
- 完整支持 Claude Code Router
|
|
1041
|
+
- 自动生成 `~/.claude-code-router/config.json` 配置
|
|
1042
|
+
- Provider 和 Router 配置管理
|
|
1043
|
+
- 配置更改后自动重启 CCR Router
|
|
1044
|
+
- Claude Code 与本地 CCR Router 端点集成
|
|
1045
|
+
- 支持 default、background 和 think 模型路由
|
|
1046
|
+
- **Web UI 增强**:
|
|
1047
|
+
- 添加账户状态检查,带颜色指示器(绿色:可用,橙色:不稳定,红色:不可用)
|
|
1048
|
+
- 状态结果会保存并在页面加载时显示
|
|
1049
|
+
- 实时状态检查,带"状态检查"按钮
|
|
1050
|
+
- 改进账户卡片布局,状态显示在右上角
|
|
1051
|
+
- 状态检查期间增强视觉反馈
|
|
1052
|
+
- **配置改进**:
|
|
1053
|
+
- CCR 账户自动生成 CCR 和 Claude 两种配置
|
|
1054
|
+
- 从 CCR 配置动态读取端口用于 Claude 集成
|
|
1055
|
+
- 更好的错误处理和用户反馈
|
|
1055
1056
|
|
|
1056
1057
|
### v1.5.7
|
|
1057
|
-
- **Droids
|
|
1058
|
-
-
|
|
1059
|
-
-
|
|
1060
|
-
-
|
|
1061
|
-
-
|
|
1062
|
-
-
|
|
1063
|
-
- **UI
|
|
1064
|
-
-
|
|
1065
|
-
-
|
|
1066
|
-
-
|
|
1067
|
-
-
|
|
1068
|
-
-
|
|
1069
|
-
-
|
|
1070
|
-
- Claude:
|
|
1071
|
-
- Codex/Droids:
|
|
1072
|
-
-
|
|
1073
|
-
-
|
|
1074
|
-
-
|
|
1075
|
-
-
|
|
1076
|
-
-
|
|
1058
|
+
- **Droids 集成**:
|
|
1059
|
+
- 完整支持 Droids AI 助手
|
|
1060
|
+
- 自动生成 `.droids/config.json` 配置文件
|
|
1061
|
+
- Droids 账户的简单模型配置
|
|
1062
|
+
- 交互会话命令:`droid`
|
|
1063
|
+
- 增强 `ais doctor` 命令,支持 Droids 配置检测
|
|
1064
|
+
- **UI 增强**:
|
|
1065
|
+
- 添加类型筛选下拉框,快速过滤账户
|
|
1066
|
+
- 按类型为账户卡片着色(Claude: 蓝色,Codex: 紫色,Droids: 绿色,Other: 橙色)
|
|
1067
|
+
- 账户卡片左侧边框颜色指示器
|
|
1068
|
+
- 改进视觉层次和用户体验
|
|
1069
|
+
- **模型配置改进**:
|
|
1070
|
+
- 为不同账户类型分离模型配置
|
|
1071
|
+
- Claude: 复杂的模型组,支持多个模型设置
|
|
1072
|
+
- Codex/Droids: 简单的模型字段,配置更直观
|
|
1073
|
+
- 所有模型设置移至可折叠的"高级配置"区域
|
|
1074
|
+
- **更好的用户指引**:
|
|
1075
|
+
- 增强 `ais use` 命令,提供清晰的下一步操作说明
|
|
1076
|
+
- 为每个 AI 助手提供特定类型的使用示例
|
|
1077
|
+
- 交互模式提示而非一次性命令示例
|
|
1077
1078
|
|
|
1078
1079
|
### v1.5.1
|
|
1079
|
-
- **Codex
|
|
1080
|
-
-
|
|
1081
|
-
-
|
|
1082
|
-
-
|
|
1083
|
-
-
|
|
1084
|
-
-
|
|
1085
|
-
-
|
|
1086
|
-
-
|
|
1087
|
-
-
|
|
1088
|
-
-
|
|
1089
|
-
-
|
|
1090
|
-
-
|
|
1091
|
-
- **Bug
|
|
1092
|
-
-
|
|
1093
|
-
-
|
|
1094
|
-
-
|
|
1095
|
-
-
|
|
1096
|
-
-
|
|
1097
|
-
-
|
|
1098
|
-
-
|
|
1080
|
+
- **Codex 集成增强**:
|
|
1081
|
+
- 完整支持 Codex CLI 的 profile 配置
|
|
1082
|
+
- 自动为 Codex 账户生成 `~/.codex/config.toml` profiles
|
|
1083
|
+
- 项目级 `.codex-profile` 文件方便引用 profile
|
|
1084
|
+
- 智能 API URL 处理:自动添加 `/v1` 路径(如果缺少)
|
|
1085
|
+
- 使用 OpenAI 兼容的 `wire_api = "chat"` 格式
|
|
1086
|
+
- 通过正确配置防止 Cloudflare 400 错误
|
|
1087
|
+
- **用户体验改进**:
|
|
1088
|
+
- 添加 Codex 账户时显示配置提示
|
|
1089
|
+
- 账户创建后显示使用说明
|
|
1090
|
+
- 增强 `ais doctor` 命令,支持 Codex 配置检测
|
|
1091
|
+
- 改进 TOML 文件中的重复 profile 清理
|
|
1092
|
+
- **Bug 修复**:
|
|
1093
|
+
- 修复 Codex 配置中的重复 profile key 错误
|
|
1094
|
+
- 改进 profile 删除的正则表达式模式
|
|
1095
|
+
- 分离 Claude 和 Codex 配置生成逻辑
|
|
1096
|
+
- **文档更新**:
|
|
1097
|
+
- README 中添加全面的 Codex 集成指南
|
|
1098
|
+
- 常见 Codex 问题的故障排除部分
|
|
1099
|
+
- 多项目 Codex 使用示例
|
|
1099
1100
|
|
|
1100
1101
|
### v1.5.0
|
|
1101
|
-
-
|
|
1102
|
-
-
|
|
1103
|
-
-
|
|
1104
|
-
-
|
|
1105
|
-
-
|
|
1106
|
-
- `ais model list/ls` -
|
|
1107
|
-
- `ais model add [name]` -
|
|
1108
|
-
- `ais model use <name>` -
|
|
1109
|
-
- `ais model remove/rm [name]` -
|
|
1110
|
-
- `ais model show [name]` -
|
|
1111
|
-
-
|
|
1112
|
-
-
|
|
1113
|
-
- Web UI
|
|
1114
|
-
-
|
|
1115
|
-
-
|
|
1116
|
-
- DEFAULT_MODEL
|
|
1117
|
-
-
|
|
1118
|
-
-
|
|
1119
|
-
-
|
|
1102
|
+
- **模型组管理系统**:
|
|
1103
|
+
- 重构模型配置为灵活的模型组(Model Groups)系统
|
|
1104
|
+
- 每个账户可以拥有多个不同配置的模型组
|
|
1105
|
+
- 快速切换模型组,自动更新 Claude 配置
|
|
1106
|
+
- **新增 CLI 命令**:
|
|
1107
|
+
- `ais model list/ls` - 列出当前账户的所有模型组
|
|
1108
|
+
- `ais model add [name]` - 创建新的模型组
|
|
1109
|
+
- `ais model use <name>` - 切换到不同的模型组
|
|
1110
|
+
- `ais model remove/rm [name]` - 删除模型组
|
|
1111
|
+
- `ais model show [name]` - 显示模型组配置详情
|
|
1112
|
+
- **功能增强**:
|
|
1113
|
+
- 增强账户创建流程,支持模型组配置
|
|
1114
|
+
- Web UI 更新,支持可折叠的模型组管理界面
|
|
1115
|
+
- 修复切换账户时模型配置不更新的问题
|
|
1116
|
+
- 优化 CLI 输出颜色一致性
|
|
1117
|
+
- DEFAULT_MODEL 自动填充其他未设置的模型配置
|
|
1118
|
+
- **向后兼容**:
|
|
1119
|
+
- 保持对旧 modelConfig 结构的支持
|
|
1120
|
+
- 现有账户无需迁移即可继续使用
|
|
1120
1121
|
|
|
1121
1122
|
### v1.4.0
|
|
1122
|
-
-
|
|
1123
|
-
-
|
|
1124
|
-
-
|
|
1125
|
-
-
|
|
1126
|
-
-
|
|
1127
|
-
-
|
|
1128
|
-
-
|
|
1129
|
-
-
|
|
1130
|
-
- iOS
|
|
1131
|
-
-
|
|
1132
|
-
- UI
|
|
1133
|
-
-
|
|
1134
|
-
-
|
|
1135
|
-
-
|
|
1136
|
-
-
|
|
1137
|
-
-
|
|
1138
|
-
-
|
|
1139
|
-
-
|
|
1123
|
+
- **添加 Web UI 管理界面**:
|
|
1124
|
+
- 现代化单页面应用,支持深色/浅色主题
|
|
1125
|
+
- 中英文双语支持,默认中文
|
|
1126
|
+
- 可视化账号管理:增删改查一目了然
|
|
1127
|
+
- 导入/导出功能:批量管理账号配置
|
|
1128
|
+
- 实时搜索过滤账号
|
|
1129
|
+
- 自定义环境变量配置
|
|
1130
|
+
- 主题自动跟随系统设置
|
|
1131
|
+
- iOS 风格的主题切换开关
|
|
1132
|
+
- **端口优化**:
|
|
1133
|
+
- UI 服务器使用随机高位端口(49152-65535)
|
|
1134
|
+
- 自动检测端口冲突并重试
|
|
1135
|
+
- **界面改进**:
|
|
1136
|
+
- 修复账号卡片按钮位置不一致问题
|
|
1137
|
+
- 按钮始终固定在卡片底部
|
|
1138
|
+
- **移除组织 ID 配置**:
|
|
1139
|
+
- 简化账号配置流程
|
|
1140
|
+
- 移除 CLI 和 UI 中的组织 ID 选项
|
|
1140
1141
|
|
|
1141
1142
|
### v1.3.0
|
|
1142
|
-
-
|
|
1143
|
-
-
|
|
1144
|
-
-
|
|
1145
|
-
-
|
|
1146
|
-
-
|
|
1147
|
-
-
|
|
1143
|
+
- **改进自定义环境变量输入**:
|
|
1144
|
+
- 支持单行 `KEY=VALUE` 格式输入(例如:`CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1`)
|
|
1145
|
+
- 配置过程中实时显示已添加的变量
|
|
1146
|
+
- 直接按回车即可完成变量添加
|
|
1147
|
+
- 更清晰的错误提示和用户指引
|
|
1148
|
+
- 增强文档,添加详细的示例和使用说明
|
|
1148
1149
|
|
|
1149
1150
|
### v1.2.0
|
|
1150
|
-
-
|
|
1151
|
-
-
|
|
1152
|
-
-
|
|
1153
|
-
-
|
|
1154
|
-
-
|
|
1155
|
-
-
|
|
1151
|
+
- 添加账户自定义环境变量支持
|
|
1152
|
+
- 添加 `ais doctor` 命令用于配置诊断
|
|
1153
|
+
- 增强 `ais help` 显示所有新功能
|
|
1154
|
+
- 更新安装文档(npm 作为推荐安装方式)
|
|
1155
|
+
- 改进 PATH 配置说明
|
|
1156
|
+
- 在 `ais list` 和 `ais info` 中显示自定义环境变量
|
|
1156
1157
|
|
|
1157
1158
|
### v1.1.0
|
|
1158
|
-
-
|
|
1159
|
-
-
|
|
1160
|
-
-
|
|
1161
|
-
-
|
|
1159
|
+
- 添加智能目录检测(在任何子目录中工作)
|
|
1160
|
+
- 自动生成 Claude Code `.claude/settings.local.json` 配置
|
|
1161
|
+
- 在 `ais info` 命令中显示项目根目录
|
|
1162
|
+
- 改进跨平台兼容性
|
|
1162
1163
|
|
|
1163
1164
|
### v1.0.0
|
|
1164
|
-
-
|
|
1165
|
-
-
|
|
1166
|
-
-
|
|
1167
|
-
-
|
|
1168
|
-
-
|
|
1169
|
-
-
|
|
1170
|
-
|
|
1171
|
-
##
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
-
|
|
1175
|
-
-
|
|
1176
|
-
-
|
|
1177
|
-
-
|
|
1178
|
-
-
|
|
1179
|
-
-
|
|
1180
|
-
-
|
|
1181
|
-
|
|
1182
|
-
##
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
1.
|
|
1186
|
-
2.
|
|
1187
|
-
3.
|
|
1165
|
+
- 初始版本
|
|
1166
|
+
- 基本账户管理(添加、列出、删除)
|
|
1167
|
+
- 项目级账户切换
|
|
1168
|
+
- 跨平台支持
|
|
1169
|
+
- 交互式 CLI 提示
|
|
1170
|
+
- 账户导出功能
|
|
1171
|
+
|
|
1172
|
+
## 未来增强
|
|
1173
|
+
|
|
1174
|
+
未来版本的潜在功能:
|
|
1175
|
+
- 账户验证
|
|
1176
|
+
- 批量导入/导出
|
|
1177
|
+
- 账户模板
|
|
1178
|
+
- 环境变量导出
|
|
1179
|
+
- 账户共享(加密)
|
|
1180
|
+
- 云同步支持
|
|
1181
|
+
- 账户使用统计
|
|
1182
|
+
|
|
1183
|
+
## 支持
|
|
1184
|
+
|
|
1185
|
+
如果遇到任何问题或有疑问:
|
|
1186
|
+
1. 查看故障排除部分
|
|
1187
|
+
2. 查看现有 issues
|
|
1188
|
+
3. 创建新 issue 并提供详细信息
|
|
1188
1189
|
|
|
1189
1190
|
---
|
|
1190
1191
|
|
|
1191
|
-
|
|
1192
|
+
**祝你与 AI 助手编码愉快!** 🤖
|