languageModels.ts ×8

Frontier kind: Joint frontier

unlabeled · c_4cdd323d3e01

1 test · 32426 LOC · 158 files · introduces 1 test · 63 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges63 lines · 1 files
Tests
1 test

Contains — complete concept membership

All code (extent)
3317 ranges32426 lines · 158 files · Browse complete extent
All tests (intent)
1 testBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

1 test introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 63 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/languageModels.ts 63 introduced LOC · 8 ranges

Open complete file

1439
1440 async setModelConfiguration(modelId: string, values: IStringDictionary<unknown>): Promise<void> {
1441 > const metadata = this._modelCache.get(modelId); languageModels.ts
1442 > if (!metadata) {
1443 return;
1444 }
1446 > // Find the group from the configuration service (source of truth)
1447 > const allGroups = this._languageModelsConfigurationService.getLanguageModelsProviderGroups();
1448 > let group: ILanguageModelsProviderGroup | undefined;
1449 >
1450 > // First try to find a group that already has config for this model.
1451 > group = allGroups.find(g => g.vendor === metadata.vendor && g.settings?.[metadata.id] !== undefined);
1452 >
1453 > // Otherwise find the group that actually *defines* this model. Several
1454 > // groups can share the same `vendor` (e.g. multiple `customendpoint`
1455 > // providers like DeepSeek and MyCustom), so matching by vendor alone would
1456 > // write the config to the first group of that vendor — not the one the
1457 > // model belongs to. Resolve via the model→group map instead. See #322872.
1458 > if (!group) {
1459 > const vendorGroups = this._modelsGroups.get(metadata.vendor);
1460 > const containingGroup = vendorGroups?.find(vg => vg.modelIdentifiers.includes(modelId) && vg.group)?.group;
1461 > if (containingGroup) {
1462 > group = allGroups.find(g => g.vendor === containingGroup.vendor && g.name === containingGroup.name) ?? containingGroup;
1463 > }
1464 > }
1465 >
1466 > // As a last resort (model not yet resolved into any group), fall back to
1467 > // any group for this vendor.
1468 > if (!group) {
1469 group = allGroups.find(g => g.vendor === metadata.vendor);
1470 }
1472 > // Merge new values into existing config, removing properties set to their schema default
1473 > const existingConfig = this._modelConfigurations.get(modelId) ?? {};
1474 > const updatedConfig = { ...existingConfig, ...values };
1475 > const schema = metadata.configurationSchema;
1476 > if (schema?.properties) {
1477 > for (const [key, value] of Object.entries(updatedConfig)) {
1478 > const propSchema = schema.properties[key];
1479 > if (propSchema?.default !== undefined && propSchema.default === value) {
1480 delete updatedConfig[key];
1481 }
1483 > }
1484 >
1485 > if (group) {
1486 > const existingSettings = (group.settings as IStringDictionary<IStringDictionary<unknown>> | undefined) ?? {};
1487 > let updatedSettings: IStringDictionary<IStringDictionary<unknown>>;
1488 > if (Object.keys(updatedConfig).length === 0) {
1489 updatedSettings = { ...existingSettings };
1490 delete updatedSettings[metadata.id];
1491 > } else { languageModels.ts
1492 > updatedSettings = { ...existingSettings, [metadata.id]: updatedConfig };
1493 > }
1494 > const updatedGroup: ILanguageModelsProviderGroup = {
1495 > ...group,
1496 > settings: Object.keys(updatedSettings).length > 0 ? updatedSettings : undefined
1497 > };
1498 > if (!updatedGroup.settings && Object.keys(updatedGroup).filter(k => k !== 'name' && k !== 'vendor' && k !== 'range' && k !== 'modelsRange' && k !== 'settings').length === 0) {
1499 // Remove the group entirely if it only had model config
1500 await this._languageModelsConfigurationService.removeLanguageModelsProviderGroup(group);
1501 > } else { languageModels.ts
1502 > await this._languageModelsConfigurationService.updateLanguageModelsProviderGroup(group, updatedGroup);
1503 > }
1504 > } else if (Object.keys(updatedConfig).length > 0) {
1505 // Only create a new group if there's non-default config
1506 // Use _vendors directly instead of getVendors() which filters by `when` clause,
1517 await this._languageModelsConfigurationService.addLanguageModelsProviderGroup(newGroup);
1518 }
1520 > // Update the in-memory cache
1521 > if (Object.keys(updatedConfig).length > 0) {
1522 > this._modelConfigurations.set(modelId, updatedConfig);
1523 > } else {
1524 this._modelConfigurations.delete(modelId);
1525 }
1527 > // Notify listeners so UI (e.g., model picker label) updates
1528 > this._onLanguageModelChange.fire(metadata.vendor);
1529 > }
1530
1531 getModelConfigurationActions(modelId: string): IAction[] {