@ww_nero/mini-cli 1.0.99 → 1.0.101

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 CHANGED
@@ -9,12 +9,12 @@
9
9
 
10
10
  ## 常用启动参数
11
11
  - `mini -i "你好"`:启动后立即发送首条问题。
12
- - `mini -m <model>`:指定默认模型(等同于会话内的 `/model <name>`)。
12
+ - `mini -m <model>`:指定本次启动使用的模型,不改写 `chat.json` 中的默认顺序。
13
13
  - `mini --resume`:启动时自动恢复当前工作目录最近一次对话。
14
14
  - `mini --help`:查看全部参数说明。
15
15
 
16
16
  ## 对话内快捷命令
17
- - `/model`:查看或切换模型。
17
+ - `/model`:查看或切换模型,并将切换结果写回 `chat.json` 默认顺序。
18
18
  - `/clear`:清空上下文。
19
19
  - `/resume [序号]`:列出或恢复历史会话。
20
20
  - `/exit`:退出对话。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ww_nero/mini-cli",
3
- "version": "1.0.99",
3
+ "version": "1.0.101",
4
4
  "description": "极简的 AI 命令行助手",
5
5
  "bin": {
6
6
  "mini": "bin/mini.js"
package/src/chat.js CHANGED
@@ -208,7 +208,7 @@ const getReadableErrorMessage = (error) => {
208
208
  const buildEmptyAssistantResponseNotice = (usage) => {
209
209
  const usageText = formatUsageTokens(usage);
210
210
  const usageSuffix = usageText ? `(${usageText})` : '';
211
- return `本次请求已结束,但模型未返回可显示内容${usageSuffix}。可能是接口返回空响应、只返回了空白内容,或流式输出在正文前结束。请重试,必要时检查模型服务日志。`;
211
+ return `本次请求已结束,但模型未返回可显示内容${usageSuffix}。`;
212
212
  };
213
213
 
214
214
  const indentToolResult = (text = '') => splitDisplayLines(text)
@@ -1,6 +1,6 @@
1
1
  const CLI_OPTIONS = [
2
2
  { flags: '-i, --input <text>', description: '启动后先发送一条问题' },
3
- { flags: '-m, --model <name>', description: '指定启动模型名称(等同于运行 /model <name>)' },
3
+ { flags: '-m, --model <name>', description: '指定本次启动使用的模型(不修改 chat.json)' },
4
4
  { flags: '-r, --resume', description: '启动时自动恢复最近一条历史会话' }
5
5
  ];
6
6
 
@@ -72,7 +72,13 @@ const createModelManager = (endpoints, { configPath } = {}) => {
72
72
  return true;
73
73
  };
74
74
 
75
- const applyModelByName = (rawName, { source = 'command', announceSuccess = true, showError = true } = {}) => {
75
+ const applyModelByName = (rawName, options = {}) => {
76
+ const {
77
+ source = 'command',
78
+ announceSuccess = true,
79
+ showError = true,
80
+ updateDefault = source !== 'cli'
81
+ } = options;
76
82
  const normalizedInput = normalizeModelInput(rawName || '');
77
83
  if (!normalizedInput) {
78
84
  if (showError) {
@@ -89,7 +95,7 @@ const createModelManager = (endpoints, { configPath } = {}) => {
89
95
  return false;
90
96
  }
91
97
  const announcePrefix = source === 'cli' ? '已应用启动' : '已切换至';
92
- setActiveModel(index, { updateDefault: true, announce: announceSuccess, announcePrefix });
98
+ setActiveModel(index, { updateDefault, announce: announceSuccess, announcePrefix, persistConfig: updateDefault });
93
99
  return true;
94
100
  };
95
101