dgxay-code-cli 1.0.0 → 1.1.0

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.
@@ -16,20 +16,20 @@ const { actionFirst } = require('../cli/args');
16
16
  const sessions = require('../core/sessions');
17
17
 
18
18
  const options = [
19
- { name: 'format', type: 'string', valueName: 'md|json', desc: '输出格式:markdown(默认)/ json' },
20
- { name: 'output', alias: 'o', type: 'string', valueName: 'file', desc: '写入文件而不是打印' }
19
+ { name: 'format', type: 'string', valueName: 'md|json', desc: 'Output format: markdown (default) / json' },
20
+ { name: 'output', alias: 'o', type: 'string', valueName: 'file', desc: 'Write to a file instead of printing' }
21
21
  ];
22
22
 
23
23
  function toMarkdown(chat) {
24
24
  const lines = [];
25
25
  const date = new Date(chat.createdAt || Date.now());
26
- lines.push(`# ${chat.title || '新对话'}`);
26
+ lines.push(`# ${chat.title || 'New conversation'}`);
27
27
  lines.push('');
28
- lines.push(`> ${date.toLocaleString()} · ${chat.mode === 'work' ? '工作模式' : '对话模式'}${chat.skill ? ` · 技能 ${chat.skill}` : ''}`);
28
+ lines.push(`> ${date.toLocaleString()} · ${chat.mode === 'work' ? 'Work mode' : 'Chat mode'}${chat.skill ? ` · Skill ${chat.skill}` : ''}`);
29
29
  lines.push('');
30
30
  for (const message of chat.messages) {
31
31
  if (message.role === 'user') {
32
- lines.push('## 用户');
32
+ lines.push('## User');
33
33
  lines.push('');
34
34
  lines.push(message.content || '');
35
35
  lines.push('');
@@ -39,17 +39,17 @@ function toMarkdown(chat) {
39
39
  lines.push(message.content || '');
40
40
  lines.push('');
41
41
  if (message.toolLog?.length) {
42
- lines.push('<details><summary>工具调用</summary>');
42
+ lines.push('<details><summary>Tool calls</summary>');
43
43
  lines.push('');
44
44
  for (const tool of message.toolLog) {
45
- lines.push(`- \`${tool.name}\` ${tool.ok ? '成功' : '失败'}${tool.review?.reason ? ` · ${tool.review.reason}` : ''}`);
45
+ lines.push(`- \`${tool.name}\` ${tool.ok ? 'ok' : 'failed'}${tool.review?.reason ? ` · ${tool.review.reason}` : ''}`);
46
46
  }
47
47
  lines.push('');
48
48
  lines.push('</details>');
49
49
  lines.push('');
50
50
  }
51
51
  } else if (message.role === 'terminal') {
52
- lines.push('## 终端');
52
+ lines.push('## Terminal');
53
53
  lines.push('');
54
54
  lines.push('```');
55
55
  lines.push(`$ ${message.command}`);
@@ -66,12 +66,12 @@ async function run({ argv }) {
66
66
  const ref = action || rest[0] || '';
67
67
  const chats = sessions.listChats();
68
68
  if (!chats.length) {
69
- print.warn('还没有可以导出的会话');
69
+ print.warn('No conversation to export yet');
70
70
  return 1;
71
71
  }
72
72
  const chat = ref ? sessions.resolveChat(ref, chats) : chats[0];
73
73
  if (!chat) {
74
- print.fail(`找不到会话:${ref}`);
74
+ print.fail(`Conversation not found: ${ref}`);
75
75
  return 1;
76
76
  }
77
77
  const format = String(opts.format || 'md').toLowerCase();
@@ -84,7 +84,7 @@ async function run({ argv }) {
84
84
  const target = path.resolve(opts.output);
85
85
  fs.mkdirSync(path.dirname(target), { recursive: true });
86
86
  fs.writeFileSync(target, content, 'utf8');
87
- print.ok(`已导出「${chat.title}」到 ${target}`);
87
+ print.ok(`Exported "${chat.title}" to ${target}`);
88
88
  return 0;
89
89
  }
90
90
  process.stdout.write(content.endsWith('\n') ? content : `${content}\n`);
@@ -94,8 +94,8 @@ async function run({ argv }) {
94
94
  module.exports = {
95
95
  name: 'export',
96
96
  aliases: ['dump'],
97
- summary: '导出会话为 Markdown / JSON',
98
- usage: 'dgxay export [序号|ID] [--format md|json] [-o 文件]',
97
+ summary: 'Export a conversation as Markdown / JSON',
98
+ usage: 'dgxay export [n|id] [--format md|json] [-o file]',
99
99
  options,
100
100
  examples: ['dgxay export', 'dgxay export 2 -o chat.md', 'dgxay export -o chats.json --format json'],
101
101
  run
@@ -22,32 +22,32 @@ const cfg = require('../services/config');
22
22
  const { ask } = require('../services/input');
23
23
 
24
24
  const options = [
25
- { name: 'name', type: 'string', valueName: 'text', desc: '显示名称' },
26
- { name: 'command', type: 'string', valueName: 'cmd', desc: '启动命令(如 npx / uvx)' },
27
- { name: 'args', type: 'string', valueName: 'text', desc: '命令参数' },
28
- { name: 'env', type: 'list', valueName: 'K=V', desc: '环境变量,可重复' },
29
- { name: 'cwd', type: 'string', valueName: 'dir', desc: '工作目录' },
30
- { name: 'follow', alias: 'f', type: 'boolean', desc: 'logs:持续输出' },
31
- { name: 'yes', alias: 'y', type: 'boolean', desc: '跳过确认' }
25
+ { name: 'name', type: 'string', valueName: 'text', desc: 'Display name' },
26
+ { name: 'command', type: 'string', valueName: 'cmd', desc: 'Start command (e.g. npx / uvx)' },
27
+ { name: 'args', type: 'string', valueName: 'text', desc: 'Command arguments' },
28
+ { name: 'env', type: 'list', valueName: 'K=V', desc: 'Environment variables, repeatable' },
29
+ { name: 'cwd', type: 'string', valueName: 'dir', desc: 'Working directory' },
30
+ { name: 'follow', alias: 'f', type: 'boolean', desc: 'logs: keep streaming output' },
31
+ { name: 'yes', alias: 'y', type: 'boolean', desc: 'Skip confirmation' }
32
32
  ];
33
33
 
34
34
  function statusText(status) {
35
- if (status === 'running') return COLORS.green('运行中');
36
- if (status === 'error') return COLORS.red('异常');
37
- if (status === 'stopping') return COLORS.yellow('停止中');
38
- return COLORS.faint('已停止');
35
+ if (status === 'running') return COLORS.green('running');
36
+ if (status === 'error') return COLORS.red('error');
37
+ if (status === 'stopping') return COLORS.yellow('stopping');
38
+ return COLORS.faint('stopped');
39
39
  }
40
40
 
41
41
  function list() {
42
42
  const servers = mcp.listServers();
43
43
  print.blank();
44
44
  if (!servers.length) {
45
- print.hint(`还没有 MCP Server(配置保存在 ${cfg.MCP_PATH})`);
46
- print.hint('添加:dgxay mcp add --name filesystem --command npx --args "-y @modelcontextprotocol/server-filesystem ."');
45
+ print.hint(`No MCP servers yet (config is stored in ${cfg.MCP_PATH})`);
46
+ print.hint('Add: dgxay mcp add --name filesystem --command npx --args "-y @modelcontextprotocol/server-filesystem ."');
47
47
  print.blank();
48
48
  return 0;
49
49
  }
50
- print.heading(`MCP Server(${servers.length})`);
50
+ print.heading(`MCP servers (${servers.length})`);
51
51
  const rows = servers.map((server, index) => [
52
52
  String(index + 1),
53
53
  server.name,
@@ -59,17 +59,17 @@ function list() {
59
59
  print.table(
60
60
  [
61
61
  { title: '#', max: 3 },
62
- { title: '名称', max: 20 },
63
- { title: '状态', max: 8 },
62
+ { title: 'Name', max: 20 },
63
+ { title: 'Status', max: 8 },
64
64
  { title: 'PID', max: 7 },
65
- { title: '命令', max: 50 },
66
- { title: '工作目录', max: 30 }
65
+ { title: 'Command', max: 50 },
66
+ { title: 'Working dir', max: 30 }
67
67
  ],
68
68
  rows
69
69
  );
70
70
  print.blank();
71
- print.hint('MCP 不会随应用启动而自动运行;每次启动后需要手动 start');
72
- print.hint('当前版本只管理进程,尚未把 MCP 工具接入模型');
71
+ print.hint('MCP servers do not start with the app; run start manually each time');
72
+ print.hint('This version only manages processes; MCP tools are not yet exposed to the model');
73
73
  print.blank();
74
74
  return 0;
75
75
  }
@@ -77,7 +77,7 @@ function list() {
77
77
  function resolve(ref) {
78
78
  const server = mcp.findServer(ref);
79
79
  if (!server) {
80
- print.fail(`找不到 MCP:${ref}`);
80
+ print.fail(`MCP not found: ${ref}`);
81
81
  return null;
82
82
  }
83
83
  return server;
@@ -86,10 +86,10 @@ function resolve(ref) {
86
86
  async function add(opts) {
87
87
  let name = opts.name;
88
88
  let command = opts.command;
89
- if (!name && process.stdin.isTTY) name = String((await ask('名称: ')) || '').trim();
90
- if (!command && process.stdin.isTTY) command = String((await ask('启动命令(如 npx): ')) || '').trim();
89
+ if (!name && process.stdin.isTTY) name = String((await ask('Name: ')) || '').trim();
90
+ if (!command && process.stdin.isTTY) command = String((await ask('Start command (e.g. npx): ')) || '').trim();
91
91
  if (!name || !command) {
92
- throw Object.assign(new Error('用法:dgxay mcp add --name <名称> --command <命令> [--args "..."]'), {
92
+ throw Object.assign(new Error('Usage: dgxay mcp add --name <name> --command <command> [--args "..."]'), {
93
93
  userError: true
94
94
  });
95
95
  }
@@ -100,8 +100,8 @@ async function add(opts) {
100
100
  env: (opts.env || []).join('\n'),
101
101
  cwd: opts.cwd || ''
102
102
  });
103
- print.ok(`已保存 MCP「${server.name}」(${server.id})`);
104
- print.hint(`启动:dgxay mcp start ${server.name}`);
103
+ print.ok(`Saved MCP server "${server.name}" (${server.id})`);
104
+ print.hint(`Start: dgxay mcp start ${server.name}`);
105
105
  return 0;
106
106
  }
107
107
 
@@ -110,9 +110,9 @@ function start(ref) {
110
110
  if (!server) return 1;
111
111
  try {
112
112
  const result = mcp.startServer(server.id);
113
- if (result.status === 'running' && result.pid) print.ok(`已启动 ${server.name}(pid ${result.pid})`);
114
- else print.ok(`${server.name} 已在运行`);
115
- print.hint(`查看日志:dgxay mcp logs ${server.name}`);
113
+ if (result.status === 'running' && result.pid) print.ok(`Started ${server.name} (pid ${result.pid})`);
114
+ else print.ok(`${server.name} is already running`);
115
+ print.hint(`View logs: dgxay mcp logs ${server.name}`);
116
116
  return 0;
117
117
  } catch (err) {
118
118
  print.fail(err.message);
@@ -124,8 +124,8 @@ function stop(ref) {
124
124
  const server = resolve(ref);
125
125
  if (!server) return 1;
126
126
  const ok = mcp.stopServer(server.id);
127
- if (ok) print.ok(`已停止 ${server.name}`);
128
- else print.warn(`${server.name} 当前没有运行`);
127
+ if (ok) print.ok(`Stopped ${server.name}`);
128
+ else print.warn(`${server.name} is not running`);
129
129
  return 0;
130
130
  }
131
131
 
@@ -144,10 +144,10 @@ async function logs(ref, opts) {
144
144
  };
145
145
  printLogs();
146
146
  if (!opts.follow) {
147
- if (!shown.size) print.hint('暂无日志');
147
+ if (!shown.size) print.hint('No logs yet');
148
148
  return 0;
149
149
  }
150
- print.hint('持续输出中,Ctrl+C 退出');
150
+ print.hint('Streaming; press Ctrl+C to exit');
151
151
  mcp.setNotifier((event) => {
152
152
  if (event.type === 'log' && event.id === server.id) {
153
153
  print.write(event.stream === 'stderr' ? COLORS.red(event.text) : event.text);
@@ -163,14 +163,14 @@ async function remove(ref, opts) {
163
163
  const server = resolve(ref);
164
164
  if (!server) return 1;
165
165
  if (!opts.yes && process.stdin.isTTY) {
166
- const answer = await ask(`删除 MCP「${server.name}」并停止进程?[y/N] `);
166
+ const answer = await ask(`Delete MCP server "${server.name}" and stop its process? [y/N] `);
167
167
  if (!/^y/i.test(String(answer || '').trim())) {
168
- print.hint('已取消');
168
+ print.hint('Cancelled');
169
169
  return 1;
170
170
  }
171
171
  }
172
172
  mcp.removeServer(server.id);
173
- print.ok(`已删除 ${server.name}`);
173
+ print.ok(`Deleted ${server.name}`);
174
174
  return 0;
175
175
  }
176
176
 
@@ -189,8 +189,8 @@ function updateEnv(ref, opts) {
189
189
  env,
190
190
  cwd: server.cwd
191
191
  });
192
- print.ok(`已更新 ${server.name} 的环境变量(${Object.keys(env).length} 项)`);
193
- print.warn('重启后生效:dgxay mcp stop ' + server.name + ' && dgxay mcp start ' + server.name);
192
+ print.ok(`Updated environment variables for ${server.name} (${Object.keys(env).length} entries)`);
193
+ print.warn('Takes effect after restart: dgxay mcp stop ' + server.name + ' && dgxay mcp start ' + server.name);
194
194
  return 0;
195
195
  }
196
196
 
@@ -212,22 +212,22 @@ async function run({ argv }) {
212
212
  return add(opts);
213
213
  case 'start':
214
214
  case 'run':
215
- if (!ref) throw Object.assign(new Error('用法:dgxay mcp start <名称|ID>'), { userError: true });
215
+ if (!ref) throw Object.assign(new Error('Usage: dgxay mcp start <name|id>'), { userError: true });
216
216
  return start(ref);
217
217
  case 'stop':
218
- if (!ref) throw Object.assign(new Error('用法:dgxay mcp stop <名称|ID>'), { userError: true });
218
+ if (!ref) throw Object.assign(new Error('Usage: dgxay mcp stop <name|id>'), { userError: true });
219
219
  return stop(ref);
220
220
  case 'logs':
221
221
  case 'log':
222
- if (!ref) throw Object.assign(new Error('用法:dgxay mcp logs <名称|ID> [-f]'), { userError: true });
222
+ if (!ref) throw Object.assign(new Error('Usage: dgxay mcp logs <name|id> [-f]'), { userError: true });
223
223
  return logs(ref, opts);
224
224
  case 'rm':
225
225
  case 'remove':
226
226
  case 'delete':
227
- if (!ref) throw Object.assign(new Error('用法:dgxay mcp rm <名称|ID>'), { userError: true });
227
+ if (!ref) throw Object.assign(new Error('Usage: dgxay mcp rm <name|id>'), { userError: true });
228
228
  return remove(ref, opts);
229
229
  case 'env':
230
- if (!ref) throw Object.assign(new Error('用法:dgxay mcp env <名称|ID> --env "KEY=value"'), { userError: true });
230
+ if (!ref) throw Object.assign(new Error('Usage: dgxay mcp env <name|id> --env "KEY=value"'), { userError: true });
231
231
  return updateEnv(ref, opts);
232
232
  default:
233
233
  return 1;
@@ -236,17 +236,17 @@ async function run({ argv }) {
236
236
 
237
237
  module.exports = {
238
238
  name: 'mcp',
239
- summary: 'MCP Server 管理',
239
+ summary: 'Manage MCP servers',
240
240
  usage: 'dgxay mcp <list|add|start|stop|logs|rm|env>',
241
241
  options,
242
242
  subcommands: [
243
- ['list', '列出 MCP Server'],
244
- ['add', '新增配置'],
245
- ['start <名称>', '启动进程'],
246
- ['stop <名称>', '停止进程'],
247
- ['logs <名称> [-f]', '查看日志'],
248
- ['rm <名称>', '删除'],
249
- ['env <名称> --env K=V', '更新环境变量']
243
+ ['list', 'List MCP servers'],
244
+ ['add', 'Add a server'],
245
+ ['start <name>', 'Start the process'],
246
+ ['stop <name>', 'Stop the process'],
247
+ ['logs <name> [-f]', 'View logs'],
248
+ ['rm <name>', 'Delete'],
249
+ ['env <name> --env K=V', 'Update environment variables']
250
250
  ],
251
251
  examples: [
252
252
  'dgxay mcp add --name filesystem --command npx --args "-y @modelcontextprotocol/server-filesystem ."',
@@ -18,26 +18,26 @@ const sessions = require('../core/sessions');
18
18
  const { askSecret } = require('../services/input');
19
19
 
20
20
  const options = [
21
- { name: 'provider', alias: 'p', type: 'string', valueName: 'name', desc: '指定供应商(默认当前供应商)' },
22
- { name: 'name', type: 'string', valueName: 'text', desc: '显示名称' },
23
- { name: 'context-window', type: 'number', valueName: 'n', desc: '上下文窗口' },
24
- { name: 'base-url', type: 'string', valueName: 'url', desc: '拉取列表时使用该地址' },
25
- { name: 'api-key', type: 'string', valueName: 'key', desc: '拉取列表时使用该密钥' },
26
- { name: 'add', type: 'list', valueName: 'id', desc: '拉取后把指定模型加入供应商' }
21
+ { name: 'provider', alias: 'p', type: 'string', valueName: 'name', desc: 'Target provider (default: active provider)' },
22
+ { name: 'name', type: 'string', valueName: 'text', desc: 'Display name' },
23
+ { name: 'context-window', type: 'number', valueName: 'n', desc: 'Context window' },
24
+ { name: 'base-url', type: 'string', valueName: 'url', desc: 'Use this base URL when fetching the list' },
25
+ { name: 'api-key', type: 'string', valueName: 'key', desc: 'Use this key when fetching the list' },
26
+ { name: 'add', type: 'list', valueName: 'id', desc: 'Add the given models to the provider after fetching' }
27
27
  ];
28
28
 
29
29
  function list(providerRef) {
30
30
  const config = settings.readConfig();
31
31
  const provider = providerRef ? settings.findProvider(providerRef) : settings.activeProvider(config);
32
32
  if (!provider) {
33
- print.warn('还没有供应商,运行 dgxay config init');
33
+ print.warn('No providers yet, run dgxay config init');
34
34
  return 1;
35
35
  }
36
36
  const models = provider.models || [];
37
37
  print.blank();
38
- print.heading(`${provider.name} 的模型(${models.length})`);
38
+ print.heading(`Models for ${provider.name} (${models.length})`);
39
39
  if (!models.length) {
40
- print.hint(' 还没有模型,运行 dgxay model add <id>');
40
+ print.hint(' No models yet, run dgxay model add <id>');
41
41
  print.blank();
42
42
  return 0;
43
43
  }
@@ -47,16 +47,16 @@ function list(providerRef) {
47
47
  model.id === active ? COLORS.accent('❯') : ' ',
48
48
  model.name || model.id,
49
49
  model.id,
50
- model.contextWindow ? sessions.formatTokens(model.contextWindow) : COLORS.faint('按协议默认'),
51
- provider.reviewModelId === model.id ? '审查' : ''
50
+ model.contextWindow ? sessions.formatTokens(model.contextWindow) : COLORS.faint('protocol default'),
51
+ provider.reviewModelId === model.id ? 'review' : ''
52
52
  ]);
53
53
  print.table(
54
54
  [
55
55
  { title: '#', max: 3 },
56
56
  { title: '', max: 1 },
57
- { title: '名称', max: 26 },
57
+ { title: 'Name', max: 26 },
58
58
  { title: 'ID', max: 32 },
59
- { title: '上下文', max: 10 },
59
+ { title: 'Context', max: 10 },
60
60
  { title: '', max: 4 }
61
61
  ],
62
62
  rows
@@ -73,7 +73,7 @@ async function fetchList(opts) {
73
73
  const secret = await askSecret('API Key: ');
74
74
  apiKey = secret || '';
75
75
  }
76
- process.stdout.write(`${COLORS.faint('正在拉取模型列表…')}`);
76
+ process.stdout.write(`${COLORS.faint('Fetching model list...')}`);
77
77
  try {
78
78
  let models;
79
79
  if (opts.baseUrl) {
@@ -83,22 +83,22 @@ async function fetchList(opts) {
83
83
  protocol: opts.protocol || provider?.protocol || 'openai'
84
84
  });
85
85
  } else {
86
- if (!provider) throw new Error('没有可用的供应商');
86
+ if (!provider) throw new Error('No provider available');
87
87
  models = await settings.fetchModels({ providerRef: provider.id, apiKey });
88
88
  }
89
89
  process.stdout.write('\r\x1b[2K');
90
- print.ok(`拉到 ${models.length} 个模型`);
90
+ print.ok(`Fetched ${models.length} model(s)`);
91
91
  const existing = new Set((provider?.models || []).map((m) => m.id));
92
92
  for (const id of models) {
93
93
  print.write(` ${existing.has(id) ? COLORS.green('✓') : ' '} ${id}`);
94
94
  }
95
95
  print.blank();
96
- print.hint('用 dgxay model add <id> 加入供应商;拉取失败时也可以直接手动填写模型 ID');
96
+ print.hint('Use dgxay model add <id> to add to the provider; if fetching fails you can type the model ID manually');
97
97
  return 0;
98
98
  } catch (err) {
99
99
  process.stdout.write('\r\x1b[2K');
100
- print.fail(`拉取失败:${err.message}`);
101
- print.hint('部分网关不支持 /models 接口,可以直接用 dgxay model add <id> 手动添加');
100
+ print.fail(`Fetch failed: ${err.message}`);
101
+ print.hint('Some gateways do not support the /models endpoint; add models manually with dgxay model add <id>');
102
102
  return 1;
103
103
  }
104
104
  }
@@ -107,12 +107,12 @@ function addModel(id, opts) {
107
107
  const config = settings.readConfig();
108
108
  const provider = opts.provider ? settings.findProvider(opts.provider) : settings.activeProvider(config);
109
109
  if (!provider) {
110
- print.warn('还没有供应商,运行 dgxay config init');
110
+ print.warn('No providers yet, run dgxay config init');
111
111
  return 1;
112
112
  }
113
113
  const models = (provider.models || []).slice();
114
114
  if (models.some((m) => m.id === id)) {
115
- print.warn(`模型 ${id} 已存在`);
115
+ print.warn(`Model ${id} already exists`);
116
116
  return 1;
117
117
  }
118
118
  models.push({
@@ -124,7 +124,7 @@ function addModel(id, opts) {
124
124
  const patch = { providers: next };
125
125
  if (provider.id === config.activeProviderId && !config.activeModelId) patch.activeModelId = id;
126
126
  settings.saveConfig(patch);
127
- print.ok(`已添加模型 ${id}`);
127
+ print.ok(`Model added: ${id}`);
128
128
  return 0;
129
129
  }
130
130
 
@@ -132,16 +132,16 @@ function removeModel(id, opts) {
132
132
  const config = settings.readConfig();
133
133
  const provider = opts.provider ? settings.findProvider(opts.provider) : settings.activeProvider(config);
134
134
  if (!provider) {
135
- print.warn('还没有供应商');
135
+ print.warn('No providers yet');
136
136
  return 1;
137
137
  }
138
138
  const models = (provider.models || []).filter((m) => m.id !== id);
139
139
  if (models.length === (provider.models || []).length) {
140
- print.fail(`供应商 ${provider.name} 下没有模型 ${id}`);
140
+ print.fail(`Provider ${provider.name} has no model ${id}`);
141
141
  return 1;
142
142
  }
143
143
  if (!models.length) {
144
- print.fail('不能删除最后一个模型,请先添加其他模型');
144
+ print.fail('Cannot delete the last model; add another model first');
145
145
  return 1;
146
146
  }
147
147
  const reviewModelId = models.some((m) => m.id === provider.reviewModelId)
@@ -153,7 +153,7 @@ function removeModel(id, opts) {
153
153
  const patch = { providers: next };
154
154
  if (config.activeModelId === id) patch.activeModelId = models[0].id;
155
155
  settings.saveConfig(patch);
156
- print.ok(`已删除模型 ${id}`);
156
+ print.ok(`Model deleted: ${id}`);
157
157
  return 0;
158
158
  }
159
159
 
@@ -161,7 +161,7 @@ function useModel(ref, opts) {
161
161
  const config = settings.readConfig();
162
162
  const provider = opts.provider ? settings.findProvider(opts.provider) : settings.activeProvider(config);
163
163
  if (!provider) {
164
- print.warn('还没有供应商');
164
+ print.warn('No providers yet');
165
165
  return 1;
166
166
  }
167
167
  const models = provider.models || [];
@@ -171,11 +171,11 @@ function useModel(ref, opts) {
171
171
  models.find((m) => m.id === ref) ||
172
172
  models.find((m) => m.id.includes(ref));
173
173
  if (!target) {
174
- print.fail(`找不到模型:${ref}`);
174
+ print.fail(`Model not found: ${ref}`);
175
175
  return 1;
176
176
  }
177
177
  settings.setActiveModel(provider.id, target.id);
178
- print.ok(`当前模型:${target.name || target.id}(${provider.name})`);
178
+ print.ok(`Active model: ${target.name || target.id} (${provider.name})`);
179
179
  return 0;
180
180
  }
181
181
 
@@ -185,17 +185,17 @@ async function run({ argv }) {
185
185
 
186
186
  // model add deepseek-chat gpt-4o 支持多个
187
187
  if (action === 'add') {
188
- if (!rest.length) throw Object.assign(new Error('用法:dgxay model add <id> [<id>…]'), { userError: true });
188
+ if (!rest.length) throw Object.assign(new Error('Usage: dgxay model add <id> [<id>...]'), { userError: true });
189
189
  let code = 0;
190
190
  for (const id of rest) code = Math.max(code, addModel(id, opts));
191
191
  return code;
192
192
  }
193
193
  if (action === 'rm' || action === 'remove' || action === 'delete') {
194
- if (!rest[0]) throw Object.assign(new Error('用法:dgxay model rm <id>'), { userError: true });
194
+ if (!rest[0]) throw Object.assign(new Error('Usage: dgxay model rm <id>'), { userError: true });
195
195
  return removeModel(rest[0], opts);
196
196
  }
197
197
  if (action === 'use' || action === 'set') {
198
- if (!rest[0]) throw Object.assign(new Error('用法:dgxay model use <id|序号>'), { userError: true });
198
+ if (!rest[0]) throw Object.assign(new Error('Usage: dgxay model use <id|index>'), { userError: true });
199
199
  return useModel(rest[0], opts);
200
200
  }
201
201
  if (action === 'fetch' || action === 'ls-remote') return fetchList(opts);
@@ -208,15 +208,15 @@ async function run({ argv }) {
208
208
  module.exports = {
209
209
  name: 'model',
210
210
  aliases: ['models'],
211
- summary: '模型管理:列表、切换、增删、拉取',
211
+ summary: 'Model management: list, switch, add/remove, fetch',
212
212
  usage: 'dgxay model <list|use|add|rm|fetch>',
213
213
  options,
214
214
  subcommands: [
215
- ['list', '列出模型'],
216
- ['use <id|序号>', '切换当前模型'],
217
- ['add <id>', '添加模型'],
218
- ['rm <id>', '删除模型'],
219
- ['fetch', '从供应商接口拉取模型列表']
215
+ ['list', 'List models'],
216
+ ['use <id|index>', 'Switch the active model'],
217
+ ['add <id>', 'Add a model'],
218
+ ['rm <id>', 'Delete a model'],
219
+ ['fetch', 'Fetch the model list from the provider API']
220
220
  ],
221
221
  examples: ['dgxay model list', 'dgxay model use 2', 'dgxay model add gpt-4o --name GPT-4o', 'dgxay model fetch'],
222
222
  run