coding-tool-x 3.7.9 → 3.7.10

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.
@@ -5,7 +5,7 @@
5
5
  <link rel="icon" href="/favicon.ico">
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>coding-tool-x · AI 编程工作台</title>
8
- <script type="module" crossorigin src="/assets/index-CCP7sRMP.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-LYvv7wtx.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/markdown-BNJfEgCA.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/vue-vendor-B5RqjEjQ.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/naive-ui-BALVpMgd.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coding-tool-x",
3
- "version": "3.7.9",
3
+ "version": "3.7.10",
4
4
  "description": "Vibe Coding 增强工作助手 - 智能会话管理、动态渠道切换、全局搜索、实时监控",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -356,9 +356,18 @@ module.exports = () => {
356
356
  if (!providerKey) {
357
357
  return res.status(400).json({ error: 'providerKey is required' });
358
358
  }
359
+ const requestedModelIds = uniqueModels([
360
+ req.body?.model,
361
+ req.body?.speedTestModel,
362
+ ...(Array.isArray(req.body?.allowedModels) ? req.body.allowedModels : []),
363
+ ...(Array.isArray(req.body?.models)
364
+ ? req.body.models.map(model => typeof model === 'string' ? model : (model?.id || model?.name))
365
+ : [])
366
+ ]);
359
367
  const rawModels = getOmpCatalogModels(providerKey, {
360
368
  forceCatalogRefresh: req.body?.forceRefresh === true,
361
- catalogTimeout: 5000
369
+ catalogTimeout: 5000,
370
+ requestedModelIds
362
371
  });
363
372
  const normalizedCatalog = normalizeCatalogModelList(rawModels);
364
373
  const models = normalizedCatalog.models.map(model => redactSensitiveFields(model));
@@ -170,7 +170,10 @@ function normalizeModels(channel = {}, options = {}) {
170
170
  }
171
171
 
172
172
  function readOmpCatalogModels(command, providerId, options = {}) {
173
- const cacheKey = `${command}\u0000${providerId}`;
173
+ const requestedModelIds = uniqueStrings(options.requestedModelIds);
174
+ const requested = new Set(requestedModelIds.map(modelId => modelId.toLowerCase()));
175
+ const useFullCatalog = requested.size > 0;
176
+ const cacheKey = `${command}\u0000${useFullCatalog ? `requested:${providerId}:${[...requested].sort().join(',')}` : providerId}`;
174
177
  const cached = ompCatalogCache.get(cacheKey);
175
178
  const now = Date.now();
176
179
  const cacheTtl = cached?.failed ? OMP_CATALOG_FAILURE_CACHE_TTL_MS : OMP_CATALOG_CACHE_TTL_MS;
@@ -178,7 +181,8 @@ function readOmpCatalogModels(command, providerId, options = {}) {
178
181
  return cached.models.map(model => ({ ...model }));
179
182
  }
180
183
  const runner = options.catalogRunner || options.modelsRunner || spawnSync;
181
- const result = runner(command, ['models', providerId, '--json'], {
184
+ const args = useFullCatalog ? ['models', '--json'] : ['models', providerId, '--json'];
185
+ const result = runner(command, args, {
182
186
  encoding: 'utf8',
183
187
  env: {
184
188
  ...process.env,
@@ -194,7 +198,22 @@ function readOmpCatalogModels(command, providerId, options = {}) {
194
198
  }
195
199
  try {
196
200
  const parsed = JSON.parse(normalizeCommandOutput(result?.stdout).trim() || '{}');
197
- const models = Array.isArray(parsed.models) ? parsed.models : [];
201
+ const rawModels = Array.isArray(parsed.models) ? parsed.models : [];
202
+ let models = rawModels;
203
+ if (useFullCatalog) {
204
+ const providerCandidates = new Set([providerId, `${MANAGED_PROVIDER_PREFIX}${providerId}`]);
205
+ const selected = new Map();
206
+ for (const model of rawModels) {
207
+ const id = String(model?.id || '').trim().toLowerCase();
208
+ if (!requested.has(id)) continue;
209
+ const provider = normalizeProviderId(model?.provider || '');
210
+ const previous = selected.get(id);
211
+ if (!previous || (providerCandidates.has(provider) && !providerCandidates.has(normalizeProviderId(previous.provider || '')))) {
212
+ selected.set(id, model);
213
+ }
214
+ }
215
+ models = [...selected.values()];
216
+ }
198
217
  ompCatalogCache.set(cacheKey, { cachedAt: now, models, failed: false });
199
218
  return models.map(model => ({ ...model }));
200
219
  } catch {
@@ -203,6 +222,7 @@ function readOmpCatalogModels(command, providerId, options = {}) {
203
222
  }
204
223
  }
205
224
 
225
+
206
226
  function getOmpCatalogModels(providerId, options = {}) {
207
227
  const normalizedProviderId = normalizeProviderId(providerId);
208
228
  if (!normalizedProviderId) return [];