yingclaw 2.5.17 → 2.5.18

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/bin/cli.js CHANGED
@@ -32,6 +32,7 @@ const {
32
32
  checkDesktopGatewayStatus,
33
33
  createGatewayServer,
34
34
  ensureDesktopGatewayConfig,
35
+ isDesktopChatModel,
35
36
  } = require('../lib/gateway');
36
37
  const { runDoctorChecks, summarize, STATUS_OK, STATUS_FAIL, STATUS_WARN, STATUS_INFO } = require('../lib/doctor');
37
38
 
@@ -151,6 +152,15 @@ async function promptModelFromChoices({ chalk, choices, message, backLabel = '
151
152
  }).then(v => v.trim());
152
153
  }
153
154
 
155
+ function getChatModelChoices(models) {
156
+ return models.filter(isDesktopChatModel).map(id => ({ name: id, value: id }));
157
+ }
158
+
159
+ function formatFetchedModelCount(chalk, total, chatCount) {
160
+ if (total === chatCount) return chalk.green(`已获取 ${chatCount} 个可用聊天模型`);
161
+ return chalk.green(`已获取 ${total} 个模型,其中 ${chatCount} 个可用于 Claude/桌面聊天`);
162
+ }
163
+
154
164
  async function promptManualModel(chalk, message, defaultValue) {
155
165
  return input({
156
166
  message: chalk.cyan(message),
@@ -185,8 +195,12 @@ async function configureCustomProvider({ chalk, ora, existingConfig }) {
185
195
  const onlineResult = await fetchModelsFromBaseUrl('custom', apiKey, baseUrl);
186
196
  if (onlineResult) {
187
197
  modelsUrl = onlineResult.modelsUrl;
188
- fetchSpinner.succeed(chalk.green(`已获取 ${onlineResult.models.length} 个可用模型`));
189
- modelChoices = onlineResult.models.map(id => ({ name: id, value: id }));
198
+ modelChoices = getChatModelChoices(onlineResult.models);
199
+ if (modelChoices.length > 0) {
200
+ fetchSpinner.succeed(formatFetchedModelCount(chalk, onlineResult.models.length, modelChoices.length));
201
+ } else {
202
+ fetchSpinner.warn(chalk.yellow(`已获取 ${onlineResult.models.length} 个模型,但没有可用于 Claude/桌面聊天的模型`));
203
+ }
190
204
  } else {
191
205
  fetchSpinner.warn(chalk.yellow('无法自动获取模型列表,改为手动输入模型'));
192
206
  }
@@ -338,9 +352,15 @@ async function runConfigFlow({ writeCodeEnv = false } = {}) {
338
352
  const onlineModels = await fetchModels(providerKey, apiKey);
339
353
  let modelChoices;
340
354
  if (onlineModels && onlineModels.length > 0) {
341
- fetchSpinner.succeed(chalk.green(`已获取 ${onlineModels.length} 个可用模型`));
342
- modelChoices = onlineModels.map(id => ({ name: id, value: id }));
343
- availableModels = onlineModels;
355
+ modelChoices = getChatModelChoices(onlineModels);
356
+ if (modelChoices.length > 0) {
357
+ fetchSpinner.succeed(formatFetchedModelCount(chalk, onlineModels.length, modelChoices.length));
358
+ availableModels = onlineModels;
359
+ } else {
360
+ fetchSpinner.warn(chalk.yellow(`已获取 ${onlineModels.length} 个模型,但没有可用于 Claude/桌面聊天的模型,使用内置默认列表`));
361
+ modelChoices = provider.models;
362
+ availableModels = provider.models.map(m => m.value);
363
+ }
344
364
  } else {
345
365
  fetchSpinner.warn(chalk.yellow('无法获取在线列表,使用内置默认列表'));
346
366
  modelChoices = provider.models;
@@ -644,9 +664,15 @@ program
644
664
  let modelChoices;
645
665
  let availableModels;
646
666
  if (onlineModels && onlineModels.length > 0) {
647
- fetchSpinner.succeed(chalk.green(`已获取 ${onlineModels.length} 个可用模型`));
648
- modelChoices = onlineModels.map(id => ({ name: id, value: id }));
649
- availableModels = onlineModels;
667
+ modelChoices = getChatModelChoices(onlineModels);
668
+ if (modelChoices.length > 0) {
669
+ fetchSpinner.succeed(formatFetchedModelCount(chalk, onlineModels.length, modelChoices.length));
670
+ availableModels = onlineModels;
671
+ } else {
672
+ fetchSpinner.warn(chalk.yellow(`已获取 ${onlineModels.length} 个模型,但没有可用于 Claude/桌面聊天的模型,使用内置默认列表`));
673
+ modelChoices = provider.models;
674
+ availableModels = provider.models.map(m => m.value);
675
+ }
650
676
  } else {
651
677
  fetchSpinner.warn(chalk.yellow('无法获取在线列表,使用内置默认列表'));
652
678
  modelChoices = provider.models;
package/lib/gateway.js CHANGED
@@ -59,8 +59,9 @@ function desktopRouteLabel(routeId) {
59
59
  }
60
60
 
61
61
  function isDesktopChatModel(model) {
62
- return !/(^|[-_])(tts|voice|voiceclone|voicedesign|speech|audio|image|video|embedding|embed|rerank|moderation)([-_]|$)/i
63
- .test(String(model || ''));
62
+ const value = String(model || '');
63
+ return !/(^|[-_])(tts|voice|voiceclone|voicedesign|speech|audio|image|video|embedding|embed|rerank|moderation)([-_]|$)/i.test(value)
64
+ && !/(cogview|cogvideo|wanx|flux|sdxl|stable-diffusion)/i.test(value);
64
65
  }
65
66
 
66
67
  function buildDesktopGatewayRoutes(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yingclaw",
3
- "version": "2.5.17",
3
+ "version": "2.5.18",
4
4
  "description": "Claude Code × 国产大模型一键接入:DeepSeek、Kimi、Qwen、MiniMax、GLM、MiMo",
5
5
  "main": "index.js",
6
6
  "bin": {