@theia/ai-ide 1.76.0-next.4 → 1.76.0-next.42
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/lib/browser/ai-configuration/ai-configuration-detail-widget.d.ts +10 -4
- package/lib/browser/ai-configuration/ai-configuration-detail-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-detail-widget.js +12 -7
- package/lib/browser/ai-configuration/ai-configuration-detail-widget.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-detail-widget.spec.js +14 -14
- package/lib/browser/ai-configuration/ai-configuration-detail-widget.spec.js.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-tree-widget.d.ts +6 -0
- package/lib/browser/ai-configuration/ai-configuration-tree-widget.d.ts.map +1 -1
- package/lib/browser/ai-configuration/ai-configuration-tree-widget.js +9 -0
- package/lib/browser/ai-configuration/ai-configuration-tree-widget.js.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.js +2 -1
- package/lib/browser/ai-configuration/categories/agent-capabilities-settings.js.map +1 -1
- package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.d.ts +8 -0
- package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.js +27 -8
- package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.js.map +1 -1
- package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.spec.js +38 -2
- package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.spec.js.map +1 -1
- package/lib/browser/ai-configuration/categories/models-configuration-category.d.ts +13 -2
- package/lib/browser/ai-configuration/categories/models-configuration-category.d.ts.map +1 -1
- package/lib/browser/ai-configuration/categories/models-configuration-category.js +41 -2
- package/lib/browser/ai-configuration/categories/models-configuration-category.js.map +1 -1
- package/lib/browser/ai-configuration/categories/models-configuration-category.spec.js +32 -2
- package/lib/browser/ai-configuration/categories/models-configuration-category.spec.js.map +1 -1
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.d.ts +26 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.d.ts.map +1 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.js +212 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.js.map +1 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.spec.d.ts +2 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.spec.d.ts.map +1 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.spec.js +423 -0
- package/lib/browser/ai-configuration/categories/provider-model-discovery-section.spec.js.map +1 -0
- package/lib/browser/ai-configuration/language-model-renderer.d.ts.map +1 -1
- package/lib/browser/ai-configuration/language-model-renderer.js +10 -3
- package/lib/browser/ai-configuration/language-model-renderer.js.map +1 -1
- package/lib/browser/ai-getting-started-commands.d.ts +10 -0
- package/lib/browser/ai-getting-started-commands.d.ts.map +1 -0
- package/lib/browser/ai-getting-started-commands.js +34 -0
- package/lib/browser/ai-getting-started-commands.js.map +1 -0
- package/lib/browser/ai-getting-started-contribution.d.ts +20 -0
- package/lib/browser/ai-getting-started-contribution.d.ts.map +1 -0
- package/lib/browser/ai-getting-started-contribution.js +70 -0
- package/lib/browser/ai-getting-started-contribution.js.map +1 -0
- package/lib/browser/ai-getting-started-walkthrough.d.ts +41 -0
- package/lib/browser/ai-getting-started-walkthrough.d.ts.map +1 -0
- package/lib/browser/ai-getting-started-walkthrough.js +225 -0
- package/lib/browser/ai-getting-started-walkthrough.js.map +1 -0
- package/lib/browser/ai-getting-started-walkthrough.spec.d.ts +2 -0
- package/lib/browser/ai-getting-started-walkthrough.spec.d.ts.map +1 -0
- package/lib/browser/ai-getting-started-walkthrough.spec.js +124 -0
- package/lib/browser/ai-getting-started-walkthrough.spec.js.map +1 -0
- package/lib/browser/ai-walkthrough-context-keys.d.ts +55 -0
- package/lib/browser/ai-walkthrough-context-keys.d.ts.map +1 -0
- package/lib/browser/ai-walkthrough-context-keys.js +145 -0
- package/lib/browser/ai-walkthrough-context-keys.js.map +1 -0
- package/lib/browser/ai-walkthrough-context-keys.spec.d.ts +2 -0
- package/lib/browser/ai-walkthrough-context-keys.spec.d.ts.map +1 -0
- package/lib/browser/ai-walkthrough-context-keys.spec.js +166 -0
- package/lib/browser/ai-walkthrough-context-keys.spec.js.map +1 -0
- package/lib/browser/frontend-module.d.ts.map +1 -1
- package/lib/browser/frontend-module.js +8 -0
- package/lib/browser/frontend-module.js.map +1 -1
- package/lib/browser/ide-chat-welcome-message-provider.d.ts +26 -28
- package/lib/browser/ide-chat-welcome-message-provider.d.ts.map +1 -1
- package/lib/browser/ide-chat-welcome-message-provider.js +61 -151
- package/lib/browser/ide-chat-welcome-message-provider.js.map +1 -1
- package/lib/browser/user-interaction-tool-renderer.d.ts +6 -0
- package/lib/browser/user-interaction-tool-renderer.d.ts.map +1 -1
- package/lib/browser/user-interaction-tool-renderer.js +36 -7
- package/lib/browser/user-interaction-tool-renderer.js.map +1 -1
- package/lib/browser/user-interaction-tool.d.ts +23 -1
- package/lib/browser/user-interaction-tool.d.ts.map +1 -1
- package/lib/browser/user-interaction-tool.js +56 -17
- package/lib/browser/user-interaction-tool.js.map +1 -1
- package/lib/browser/user-interaction-tool.spec.js +151 -2
- package/lib/browser/user-interaction-tool.spec.js.map +1 -1
- package/lib/common/command-prompt-template.js +1 -1
- package/lib/common/user-interaction-tool.d.ts +19 -1
- package/lib/common/user-interaction-tool.d.ts.map +1 -1
- package/lib/common/user-interaction-tool.js +100 -29
- package/lib/common/user-interaction-tool.js.map +1 -1
- package/lib/common/user-interaction-tool.spec.js +215 -174
- package/lib/common/user-interaction-tool.spec.js.map +1 -1
- package/package.json +26 -25
- package/src/browser/ai-configuration/ai-configuration-detail-widget.spec.ts +14 -14
- package/src/browser/ai-configuration/ai-configuration-detail-widget.tsx +12 -7
- package/src/browser/ai-configuration/ai-configuration-tree-widget.tsx +8 -0
- package/src/browser/ai-configuration/categories/agent-capabilities-settings.tsx +7 -8
- package/src/browser/ai-configuration/categories/model-aliases-configuration-category.spec.ts +40 -2
- package/src/browser/ai-configuration/categories/model-aliases-configuration-category.tsx +31 -10
- package/src/browser/ai-configuration/categories/models-configuration-category.spec.ts +47 -2
- package/src/browser/ai-configuration/categories/models-configuration-category.tsx +52 -5
- package/src/browser/ai-configuration/categories/provider-model-discovery-section.spec.tsx +451 -0
- package/src/browser/ai-configuration/categories/provider-model-discovery-section.tsx +341 -0
- package/src/browser/ai-configuration/language-model-renderer.tsx +11 -3
- package/src/browser/ai-getting-started-commands.ts +33 -0
- package/src/browser/ai-getting-started-contribution.ts +64 -0
- package/src/browser/ai-getting-started-walkthrough.spec.ts +146 -0
- package/src/browser/ai-getting-started-walkthrough.ts +249 -0
- package/src/browser/ai-walkthrough-context-keys.spec.ts +209 -0
- package/src/browser/ai-walkthrough-context-keys.ts +147 -0
- package/src/browser/frontend-module.ts +9 -0
- package/src/browser/ide-chat-welcome-message-provider.tsx +93 -230
- package/src/browser/style/index.css +1 -41
- package/src/browser/user-interaction-tool-renderer.tsx +38 -8
- package/src/browser/user-interaction-tool.spec.ts +201 -2
- package/src/browser/user-interaction-tool.ts +69 -18
- package/src/common/command-prompt-template.ts +1 -1
- package/src/common/user-interaction-tool.spec.ts +217 -161
- package/src/common/user-interaction-tool.ts +127 -32
package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.spec.js
CHANGED
|
@@ -26,8 +26,8 @@ disableJSDOM();
|
|
|
26
26
|
function alias(id, description = '') {
|
|
27
27
|
return { id, description, defaultModelIds: [] };
|
|
28
28
|
}
|
|
29
|
-
function readyModel(id) {
|
|
30
|
-
return { id, status: { status: 'ready' } };
|
|
29
|
+
function readyModel(id, released) {
|
|
30
|
+
return { id, released, status: { status: 'ready' } };
|
|
31
31
|
}
|
|
32
32
|
function unreadyModel(id) {
|
|
33
33
|
return { id, status: { status: 'unavailable', message: 'nope' } };
|
|
@@ -64,6 +64,42 @@ describe('ModelAliasesConfigurationCategory', () => {
|
|
|
64
64
|
(0, chai_1.expect)(children[1].status?.kind).to.equal('warn');
|
|
65
65
|
(0, chai_1.expect)(children[2].status?.kind).to.equal('error');
|
|
66
66
|
});
|
|
67
|
+
it('divides the models per provider, newest first, after the default-list entry', () => {
|
|
68
|
+
const category = createCategory([], new Map());
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
category.languageModels = [
|
|
71
|
+
readyModel('openai/gpt-5.5', Date.parse('2025-08-01')),
|
|
72
|
+
readyModel('anthropic/claude-haiku-4-5', Date.parse('2025-10-01')),
|
|
73
|
+
readyModel('openai/gpt-5.6-sol', Date.parse('2026-02-01')),
|
|
74
|
+
readyModel('anthropic/claude-opus-5', Date.parse('2026-04-01'))
|
|
75
|
+
];
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
77
|
+
const options = category.getModelOptions();
|
|
78
|
+
(0, chai_1.expect)(options[0].value).to.equal('');
|
|
79
|
+
// A rule between the providers rather than a heading: the select draws separators as plain lines.
|
|
80
|
+
(0, chai_1.expect)(options.slice(1).map(option => option.separator ? '---' : option.value)).to.deep.equal([
|
|
81
|
+
'---',
|
|
82
|
+
'anthropic/claude-opus-5',
|
|
83
|
+
'anthropic/claude-haiku-4-5',
|
|
84
|
+
'---',
|
|
85
|
+
'openai/gpt-5.6-sol',
|
|
86
|
+
'openai/gpt-5.5'
|
|
87
|
+
]);
|
|
88
|
+
});
|
|
89
|
+
it('keeps the provider rules when mapping the options onto the select', () => {
|
|
90
|
+
const category = createCategory([], new Map());
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
+
const mapped = category.toEnumOptions([
|
|
93
|
+
{ value: 'a', label: 'A', description: 'first' },
|
|
94
|
+
{ separator: true },
|
|
95
|
+
{ value: 'b' }
|
|
96
|
+
]);
|
|
97
|
+
// A rule that loses its `separator` becomes a selectable entry with no label that clears the alias.
|
|
98
|
+
(0, chai_1.expect)(mapped.map(option => option.separator ? '---' : option.value)).to.deep.equal(['a', '---', 'b']);
|
|
99
|
+
(0, chai_1.expect)(mapped[0].title).to.equal('first');
|
|
100
|
+
// Without a label of its own, an option falls back to its value rather than rendering empty.
|
|
101
|
+
(0, chai_1.expect)(mapped[2].label).to.equal('b');
|
|
102
|
+
});
|
|
67
103
|
it('indexes one search item per alias, navigating to the item', () => {
|
|
68
104
|
const category = createCategory([alias('default/code', 'Coding alias')], new Map());
|
|
69
105
|
const items = category.getSearchItems();
|
package/lib/browser/ai-configuration/categories/model-aliases-configuration-category.spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-aliases-configuration-category.spec.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/model-aliases-configuration-category.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AAEjC,uHAAiH;AACjH,wEAAiC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAE1C,+BAA8B;AAG9B,wHAAqH;AACrH,iGAA2F;AAE3F,YAAY,EAAE,CAAC;AAEf,SAAS,KAAK,CAAC,EAAU,EAAE,WAAW,GAAG,EAAE;IACvC,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,eAAe,EAAE,EAAE,EAAmC,CAAC;AACrF,CAAC;AAED,SAAS,UAAU,CAAC,EAAU;
|
|
1
|
+
{"version":3,"file":"model-aliases-configuration-category.spec.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories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KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2DAA2D,EAAE,GAAG,EAAE;QACjE,MAAM,QAAQ,GAAG,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACpF,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAC;QACxC,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAClC,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,qDAAyB,CAAC,aAAa,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;QACvH,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Emitter, Event } from '@theia/core';
|
|
1
|
+
import { CommandService, Emitter, Event } from '@theia/core';
|
|
2
2
|
import { DisposableCollection } from '@theia/core/lib/common';
|
|
3
3
|
import * as React from '@theia/core/shared/react';
|
|
4
4
|
import { AiConfigurationCategory, AiConfigurationRenderContext, AiConfigurationSearchItem, AiConfigurationSearchProvider, AiConfigurationTreeItem } from '@theia/ai-core-ui/lib/browser/ai-configuration/ai-configuration-category';
|
|
5
5
|
import { AiSettingsRowService } from '@theia/ai-core-ui/lib/browser/ai-configuration/components/ai-settings-row-service';
|
|
6
6
|
import { CollectionCategoryRenderer } from '@theia/ai-core-ui/lib/browser/ai-configuration/renderers/collection-category-renderer';
|
|
7
|
+
import { LanguageModel, LanguageModelRegistry } from '@theia/ai-core/lib/common';
|
|
8
|
+
import { FavoriteModelsService, ModelDiscoveryStatusService } from '@theia/ai-core/lib/browser';
|
|
7
9
|
interface ModelsSection {
|
|
8
10
|
readonly id: string;
|
|
9
11
|
readonly title: string;
|
|
@@ -28,14 +30,21 @@ export declare class ModelsConfigurationCategory extends CollectionCategoryRende
|
|
|
28
30
|
readonly order = 200;
|
|
29
31
|
readonly kind: "collection";
|
|
30
32
|
protected readonly settingsRowService: AiSettingsRowService;
|
|
33
|
+
protected readonly discoveryStatus: ModelDiscoveryStatusService;
|
|
34
|
+
protected readonly favoriteModels: FavoriteModelsService;
|
|
35
|
+
protected readonly commandService: CommandService;
|
|
36
|
+
protected readonly languageModelRegistry: LanguageModelRegistry;
|
|
31
37
|
protected readonly onDidChangeEmitter: Emitter<void>;
|
|
32
38
|
readonly onDidChange: Event<void>;
|
|
33
39
|
protected readonly toDispose: DisposableCollection;
|
|
40
|
+
/** Registered models, kept in sync so the provider detail can list them synchronously while rendering. */
|
|
41
|
+
protected models: LanguageModel[];
|
|
34
42
|
get renderer(): this;
|
|
35
43
|
protected get categoryId(): string;
|
|
36
44
|
getOwnedPreferenceIds(): string[];
|
|
37
45
|
get search(): AiConfigurationSearchProvider;
|
|
38
46
|
protected init(): void;
|
|
47
|
+
protected updateModels(): Promise<void>;
|
|
39
48
|
dispose(): void;
|
|
40
49
|
/**
|
|
41
50
|
* One tree child per discovered provider (the cross-provider model settings stay in the overview).
|
|
@@ -46,8 +55,10 @@ export declare class ModelsConfigurationCategory extends CollectionCategoryRende
|
|
|
46
55
|
protected getEmptyMessage(): string;
|
|
47
56
|
/** Shown above the provider cards: the cross-provider model settings, when any are registered. */
|
|
48
57
|
protected renderCategorySettings(ctx: AiConfigurationRenderContext): React.ReactNode;
|
|
49
|
-
/** Provider detail (node selected): that provider's settings. */
|
|
58
|
+
/** Provider detail (node selected): that provider's settings, followed by its model discovery. */
|
|
50
59
|
protected renderItemSections(item: AiConfigurationTreeItem, ctx: AiConfigurationRenderContext): React.ReactNode;
|
|
60
|
+
/** Only providers that participate in dynamic model discovery contribute this section. */
|
|
61
|
+
protected renderModelDiscovery(providerId: string): React.ReactNode;
|
|
51
62
|
protected renderPreferenceRow(ctx: AiConfigurationRenderContext, preferenceId: string): React.ReactNode;
|
|
52
63
|
/** Discovers the model-settings and provider sections from the registered preference schema. */
|
|
53
64
|
protected getSections(): ModelsSection[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-configuration-category.d.ts","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/models-configuration-category.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAO,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"models-configuration-category.d.ts","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/models-configuration-category.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,EAAO,MAAM,aAAa,CAAC;AAElE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAClD,OAAO,EACH,uBAAuB,EAGvB,4BAA4B,EAC5B,yBAAyB,EACzB,6BAA6B,EAC7B,uBAAuB,EAC1B,MAAM,0EAA0E,CAAC;AAClF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mFAAmF,CAAC;AAEzH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uFAAuF,CAAC;AAEnI,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AAYhG,UAAU,aAAa;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,CAA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GAAG,EAAE,4BAA4B,GAAG,KAAK,CAAC,SAAS;IAO7F,kGAAkG;IAClG,SAAS,CAAC,kBAAkB,CAAC,IAAI,EAAE,uBAAuB,EAAE,GAAG,EAAE,4BAA4B,GAAG,KAAK,CAAC,SAAS;IAa/G,0FAA0F;IAC1F,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS;IAiBnE,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS;IAWvG,gGAAgG;IAChG,SAAS,CAAC,WAAW,IAAI,aAAa,EAAE;IA+CxC;;;;;OAKG;IACH,SAAS,CAAC,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,MAAM;IAU/E,kHAAkH;IAClH,SAAS,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAIjD,kGAAkG;IAClG,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAQxD,0FAA0F;IAC1F,SAAS,CAAC,uBAAuB,IAAI,aAAa,GAAG,SAAS;IAI9D,qFAAqF;IACrF,SAAS,CAAC,mBAAmB,IAAI,aAAa,EAAE;IAIhD,cAAc,IAAI,yBAAyB,EAAE;CAqBhD"}
|
|
@@ -27,6 +27,9 @@ const ai_settings_row_service_1 = require("@theia/ai-core-ui/lib/browser/ai-conf
|
|
|
27
27
|
const ai_configuration_primitives_1 = require("@theia/ai-core-ui/lib/browser/ai-configuration/components/ai-configuration-primitives");
|
|
28
28
|
const collection_category_renderer_1 = require("@theia/ai-core-ui/lib/browser/ai-configuration/renderers/collection-category-renderer");
|
|
29
29
|
const ai_settings_row_1 = require("@theia/ai-core-ui/lib/browser/ai-configuration/components/ai-settings-row");
|
|
30
|
+
const common_2 = require("@theia/ai-core/lib/common");
|
|
31
|
+
const browser_2 = require("@theia/ai-core/lib/browser");
|
|
32
|
+
const provider_model_discovery_section_1 = require("./provider-model-discovery-section");
|
|
30
33
|
/** Prefix shared by every AI preference. */
|
|
31
34
|
const AI_FEATURES_PREFIX = 'ai-features.';
|
|
32
35
|
/** Id of the cross-provider "Model Settings" section (kept in the overview, not a provider node). */
|
|
@@ -56,6 +59,8 @@ let ModelsConfigurationCategory = class ModelsConfigurationCategory extends coll
|
|
|
56
59
|
this.onDidChangeEmitter = new core_1.Emitter();
|
|
57
60
|
this.onDidChange = this.onDidChangeEmitter.event;
|
|
58
61
|
this.toDispose = new common_1.DisposableCollection(this.onDidChangeEmitter);
|
|
62
|
+
/** Registered models, kept in sync so the provider detail can list them synchronously while rendering. */
|
|
63
|
+
this.models = [];
|
|
59
64
|
}
|
|
60
65
|
get renderer() {
|
|
61
66
|
return this;
|
|
@@ -71,6 +76,13 @@ let ModelsConfigurationCategory = class ModelsConfigurationCategory extends coll
|
|
|
71
76
|
}
|
|
72
77
|
init() {
|
|
73
78
|
this.toDispose.push(this.settingsRowService.onPreferenceChanged(() => this.onDidChangeEmitter.fire()));
|
|
79
|
+
this.toDispose.push(this.discoveryStatus.onDidChange(() => this.onDidChangeEmitter.fire()));
|
|
80
|
+
this.toDispose.push(this.languageModelRegistry.onChange(() => this.updateModels()));
|
|
81
|
+
this.updateModels();
|
|
82
|
+
}
|
|
83
|
+
async updateModels() {
|
|
84
|
+
this.models = await this.languageModelRegistry.getLanguageModels();
|
|
85
|
+
this.onDidChangeEmitter.fire();
|
|
74
86
|
}
|
|
75
87
|
dispose() {
|
|
76
88
|
this.toDispose.dispose();
|
|
@@ -97,13 +109,24 @@ let ModelsConfigurationCategory = class ModelsConfigurationCategory extends coll
|
|
|
97
109
|
const modelSettings = this.getModelSettingsSection();
|
|
98
110
|
return modelSettings && (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationSection, { title: modelSettings.title, children: modelSettings.preferenceIds.map(preferenceId => this.renderPreferenceRow(ctx, preferenceId)) });
|
|
99
111
|
}
|
|
100
|
-
/** Provider detail (node selected): that provider's settings. */
|
|
112
|
+
/** Provider detail (node selected): that provider's settings, followed by its model discovery. */
|
|
101
113
|
renderItemSections(item, ctx) {
|
|
102
114
|
const section = this.getProviderSections().find(candidate => candidate.id === item.id);
|
|
103
115
|
if (!section) {
|
|
104
116
|
return undefined;
|
|
105
117
|
}
|
|
106
|
-
return (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationSection, { title: core_1.nls.localizeByDefault('Settings'), children: section.preferenceIds.map(preferenceId => this.renderPreferenceRow(ctx, preferenceId)) });
|
|
118
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationSection, { title: core_1.nls.localizeByDefault('Settings'), children: section.preferenceIds.map(preferenceId => this.renderPreferenceRow(ctx, preferenceId)) }), this.renderModelDiscovery(item.id)] });
|
|
119
|
+
}
|
|
120
|
+
/** Only providers that participate in dynamic model discovery contribute this section. */
|
|
121
|
+
renderModelDiscovery(providerId) {
|
|
122
|
+
const status = this.discoveryStatus.getStatus(providerId);
|
|
123
|
+
if (!status) {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
// A provider's registered model ids may carry a prefix that differs from its preference segment
|
|
127
|
+
// (e.g. the `openAiOfficial` block registers `openai/…` models).
|
|
128
|
+
const prefix = `${status.modelIdPrefix ?? providerId}/`;
|
|
129
|
+
return (0, jsx_runtime_1.jsx)(provider_model_discovery_section_1.ProviderModelDiscoverySection, { status: status, models: this.models.filter(model => model.id.startsWith(prefix)), favorites: this.favoriteModels, onRefresh: () => this.discoveryStatus.refresh(providerId), onAction: action => this.commandService.executeCommand(action.commandId, ...(action.args ?? [])) });
|
|
107
130
|
}
|
|
108
131
|
renderPreferenceRow(ctx, preferenceId) {
|
|
109
132
|
return (0, jsx_runtime_1.jsx)(ai_settings_row_1.AiSettingsRow, { service: this.settingsRowService, preferenceId: preferenceId, scope: ctx.scope, control: this.settingsRowService.controlFor(preferenceId), onDidChange: () => ctx.update() }, preferenceId);
|
|
@@ -215,6 +238,22 @@ tslib_1.__decorate([
|
|
|
215
238
|
(0, inversify_1.inject)(ai_settings_row_service_1.AiSettingsRowService),
|
|
216
239
|
tslib_1.__metadata("design:type", ai_settings_row_service_1.AiSettingsRowService)
|
|
217
240
|
], ModelsConfigurationCategory.prototype, "settingsRowService", void 0);
|
|
241
|
+
tslib_1.__decorate([
|
|
242
|
+
(0, inversify_1.inject)(browser_2.ModelDiscoveryStatusService),
|
|
243
|
+
tslib_1.__metadata("design:type", browser_2.ModelDiscoveryStatusService)
|
|
244
|
+
], ModelsConfigurationCategory.prototype, "discoveryStatus", void 0);
|
|
245
|
+
tslib_1.__decorate([
|
|
246
|
+
(0, inversify_1.inject)(browser_2.FavoriteModelsService),
|
|
247
|
+
tslib_1.__metadata("design:type", browser_2.FavoriteModelsService)
|
|
248
|
+
], ModelsConfigurationCategory.prototype, "favoriteModels", void 0);
|
|
249
|
+
tslib_1.__decorate([
|
|
250
|
+
(0, inversify_1.inject)(core_1.CommandService),
|
|
251
|
+
tslib_1.__metadata("design:type", Object)
|
|
252
|
+
], ModelsConfigurationCategory.prototype, "commandService", void 0);
|
|
253
|
+
tslib_1.__decorate([
|
|
254
|
+
(0, inversify_1.inject)(common_2.LanguageModelRegistry),
|
|
255
|
+
tslib_1.__metadata("design:type", Object)
|
|
256
|
+
], ModelsConfigurationCategory.prototype, "languageModelRegistry", void 0);
|
|
218
257
|
tslib_1.__decorate([
|
|
219
258
|
(0, inversify_1.postConstruct)(),
|
|
220
259
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-configuration-category.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/models-configuration-category.tsx"],"names":[],"mappings":";;;;;AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,
|
|
1
|
+
{"version":3,"file":"models-configuration-category.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/models-configuration-category.tsx"],"names":[],"mappings":";;;;;AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAEhF,sCAAkE;AAClE,qDAAkD;AAClD,mDAA8D;AAC9D,4DAAiF;AAEjF,wHAQkF;AAClF,+HAAyH;AACzH,uIAA+H;AAC/H,wIAAmI;AACnI,+GAA0G;AAC1G,sDAAiF;AACjF,wDAAgG;AAChG,yFAAmF;AAEnF,4CAA4C;AAC5C,MAAM,kBAAkB,GAAG,cAAc,CAAC;AAE1C,qGAAqG;AACrG,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAE3C,yEAAyE;AACzE,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAS,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC;AAQhF;;;;;;;;;;GAUG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA4B,SAAQ,yDAA0B;IAApE;;QAEM,OAAE,GAAG,qDAAyB,CAAC,MAAM,CAAC;QACtC,UAAK,GAAG,UAAG,CAAC,QAAQ,CAAC,4CAA4C,EAAE,oBAAoB,CAAC,CAAC;QACzF,gBAAW,GAAG,UAAG,CAAC,QAAQ,CAAC,8CAA8C,EAC9E,wEAAwE,CAAC,CAAC;QACrE,cAAS,GAAG,IAAA,iBAAO,EAAC,OAAO,CAAC,CAAC;QAC7B,UAAK,GAAG,wDAA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E;wBACnB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;wBAC3C,SAAS,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE;qBACrC;oBACD,QAAQ,EAAE,GAAG,YAAY,IAAI,OAAO,CAAC,KAAK,EAAE;iBACX,CAAC;YAC1C,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AArPY,kEAA2B;AAWjB;IADlB,IAAA,kBAAM,EAAC,8CAAoB,CAAC;sCACU,8CAAoB;uEAAC;AAGzC;IADlB,IAAA,kBAAM,EAAC,qCAA2B,CAAC;sCACA,qCAA2B;oEAAC;AAG7C;IADlB,IAAA,kBAAM,EAAC,+BAAqB,CAAC;sCACK,+BAAqB;mEAAC;AAGtC;IADlB,IAAA,kBAAM,EAAC,qBAAc,CAAC;;mEAC2B;AAG/B;IADlB,IAAA,kBAAM,EAAC,8BAAqB,CAAC;;0EACkC;AA0BtD;IADT,IAAA,yBAAa,GAAE;;;;uDAMf;sCAtDQ,2BAA2B;IADvC,IAAA,sBAAU,GAAE;GACA,2BAA2B,CAqPvC"}
|
|
@@ -56,7 +56,7 @@ describe('ModelsConfigurationCategory', () => {
|
|
|
56
56
|
'ai-features.modelSettings.requestSettings',
|
|
57
57
|
'ai-features.reasoning.defaults',
|
|
58
58
|
'ai-features.anthropic.AnthropicApiKey',
|
|
59
|
-
'ai-features.anthropic.
|
|
59
|
+
'ai-features.anthropic.serverSideCompaction',
|
|
60
60
|
'ai-features.google.apiKey',
|
|
61
61
|
// must be ignored: owned by other categories / unrelated
|
|
62
62
|
'ai-features.chat.pinChatAgent',
|
|
@@ -71,7 +71,7 @@ describe('ModelsConfigurationCategory', () => {
|
|
|
71
71
|
const sections = category.getSections();
|
|
72
72
|
(0, chai_1.expect)(sections.map(s => s.id)).to.deep.equal(['model-settings', 'anthropic', 'google']);
|
|
73
73
|
(0, chai_1.expect)(sections[0].preferenceIds).to.have.members(['ai-features.modelSettings.requestSettings', 'ai-features.reasoning.defaults']);
|
|
74
|
-
(0, chai_1.expect)(sections[1].preferenceIds).to.deep.equal(['ai-features.anthropic.AnthropicApiKey', 'ai-features.anthropic.
|
|
74
|
+
(0, chai_1.expect)(sections[1].preferenceIds).to.deep.equal(['ai-features.anthropic.AnthropicApiKey', 'ai-features.anthropic.serverSideCompaction']);
|
|
75
75
|
(0, chai_1.expect)(sections[2].preferenceIds).to.deep.equal(['ai-features.google.apiKey']);
|
|
76
76
|
});
|
|
77
77
|
it('does not treat the agent settings store as a provider', () => {
|
|
@@ -141,5 +141,35 @@ describe('ModelsConfigurationCategory', () => {
|
|
|
141
141
|
highlight: { rowId: 'ai-features.anthropic.AnthropicApiKey' }
|
|
142
142
|
});
|
|
143
143
|
});
|
|
144
|
+
describe('model discovery section', () => {
|
|
145
|
+
function withDiscovery(statuses, modelIds) {
|
|
146
|
+
const category = createCategory([]);
|
|
147
|
+
const service = {
|
|
148
|
+
getStatus: (providerId) => statuses.find(status => status.providerId === providerId)
|
|
149
|
+
};
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
151
|
+
category.discoveryStatus = service;
|
|
152
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
153
|
+
category.models = modelIds.map(id => ({ id }));
|
|
154
|
+
return category;
|
|
155
|
+
}
|
|
156
|
+
function discoveredModelIds(category, providerId) {
|
|
157
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
|
+
const rendered = category.renderModelDiscovery(providerId);
|
|
159
|
+
return rendered && rendered.props.models.map(model => model.id);
|
|
160
|
+
}
|
|
161
|
+
it('renders nothing for a provider that does not participate in discovery', () => {
|
|
162
|
+
const category = withDiscovery([], ['anthropic/claude-opus-5']);
|
|
163
|
+
(0, chai_1.expect)(discoveredModelIds(category, 'anthropic')).to.equal(undefined);
|
|
164
|
+
});
|
|
165
|
+
it('lists the provider\'s own models, keyed by the provider id', () => {
|
|
166
|
+
const category = withDiscovery([{ providerId: 'anthropic', label: 'Anthropic', state: 'ready' }], ['anthropic/claude-opus-5', 'google/gemini-3.1-pro', 'anthropic-custom/foo']);
|
|
167
|
+
(0, chai_1.expect)(discoveredModelIds(category, 'anthropic')).to.deep.equal(['anthropic/claude-opus-5']);
|
|
168
|
+
});
|
|
169
|
+
it('honours a model-id prefix that differs from the provider id', () => {
|
|
170
|
+
const category = withDiscovery([{ providerId: 'openAiOfficial', label: 'OpenAI', modelIdPrefix: 'openai', state: 'ready' }], ['openai/gpt-5.5', 'openAiOfficial/gpt-5.5', 'openai-custom/local']);
|
|
171
|
+
(0, chai_1.expect)(discoveredModelIds(category, 'openAiOfficial')).to.deep.equal(['openai/gpt-5.5']);
|
|
172
|
+
});
|
|
173
|
+
});
|
|
144
174
|
});
|
|
145
175
|
//# sourceMappingURL=models-configuration-category.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-configuration-category.spec.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/models-configuration-category.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,8DAAiE;AACjE,IAAI,YAAY,GAAG,IAAA,mBAAW,GAAE,CAAC;AAEjC,uHAAiH;AACjH,wEAAiC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAE1C,+BAA8B;AAE9B,wHAAqH;
|
|
1
|
+
{"version":3,"file":"models-configuration-category.spec.js","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/models-configuration-category.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3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CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from '@theia/core/shared/react';
|
|
2
|
+
import { LanguageModel } from '@theia/ai-core/lib/common';
|
|
3
|
+
import { FavoriteModelsService } from '@theia/ai-core/lib/browser';
|
|
4
|
+
import { ModelDiscoveryAction, ModelDiscoveryStatus } from '@theia/ai-core/lib/common/model-discovery-status';
|
|
5
|
+
export interface ProviderModelDiscoverySectionProps {
|
|
6
|
+
readonly status: ModelDiscoveryStatus;
|
|
7
|
+
/** The provider's currently registered models. */
|
|
8
|
+
readonly models: LanguageModel[];
|
|
9
|
+
/** Decides which models the pickers offer, and takes the user's checks. */
|
|
10
|
+
readonly favorites: FavoriteModelsService;
|
|
11
|
+
readonly onRefresh: () => void;
|
|
12
|
+
/** Runs what the provider offers to do about the current state, e.g. signing in to GitHub Copilot. */
|
|
13
|
+
readonly onAction: (action: ModelDiscoveryAction) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Renders a provider's model-discovery state (fetching / ready / cached / error / no credentials /
|
|
17
|
+
* awaiting consent / manual), a manual refresh, and the discovered models, below the provider's
|
|
18
|
+
* settings in the Models category. This is the provider-level surface that per-model status cannot
|
|
19
|
+
* give: fetching progress and failure of the list call itself.
|
|
20
|
+
*
|
|
21
|
+
* The list holds everything the provider offers, one entry per release included, which is more than
|
|
22
|
+
* a model picker can carry. Which of them the pickers offer is shown and controlled here, by the
|
|
23
|
+
* star on each row.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ProviderModelDiscoverySection: React.FC<ProviderModelDiscoverySectionProps>;
|
|
26
|
+
//# sourceMappingURL=provider-model-discovery-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-model-discovery-section.d.ts","sourceRoot":"","sources":["../../../../src/browser/ai-configuration/categories/provider-model-discovery-section.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAA0B,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAmB,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AAc/H,MAAM,WAAW,kCAAkC;IAC/C,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IACtC,kDAAkD;IAClD,QAAQ,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,qBAAqB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,IAAI,CAAC;IAC/B,sGAAsG;IACtG,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC7D;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,6BAA6B,EAAE,KAAK,CAAC,EAAE,CAAC,kCAAkC,CA6EtF,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProviderModelDiscoverySection = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("@theia/core/shared/react/jsx-runtime");
|
|
5
|
+
// *****************************************************************************
|
|
6
|
+
// Copyright (C) 2026 EclipseSource and others.
|
|
7
|
+
//
|
|
8
|
+
// This program and the accompanying materials are made available under the
|
|
9
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
10
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
11
|
+
//
|
|
12
|
+
// This Source Code may also be made available under the following Secondary
|
|
13
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
14
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
15
|
+
// with the GNU Classpath Exception which is available at
|
|
16
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
17
|
+
//
|
|
18
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
19
|
+
// *****************************************************************************
|
|
20
|
+
const core_1 = require("@theia/core");
|
|
21
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
22
|
+
const React = require("@theia/core/shared/react");
|
|
23
|
+
const date_fns_1 = require("date-fns");
|
|
24
|
+
const common_1 = require("@theia/ai-core/lib/common");
|
|
25
|
+
const ai_configuration_primitives_1 = require("@theia/ai-core-ui/lib/browser/ai-configuration/components/ai-configuration-primitives");
|
|
26
|
+
const ai_configuration_item_row_1 = require("@theia/ai-core-ui/lib/browser/ai-configuration/components/ai-configuration-item-row");
|
|
27
|
+
/**
|
|
28
|
+
* Number of models from which the list gets a filter. Below it, scanning the list is faster than
|
|
29
|
+
* typing; above it — OpenAI reports dozens — it is not.
|
|
30
|
+
*/
|
|
31
|
+
const FILTER_THRESHOLD = 8;
|
|
32
|
+
/**
|
|
33
|
+
* Renders a provider's model-discovery state (fetching / ready / cached / error / no credentials /
|
|
34
|
+
* awaiting consent / manual), a manual refresh, and the discovered models, below the provider's
|
|
35
|
+
* settings in the Models category. This is the provider-level surface that per-model status cannot
|
|
36
|
+
* give: fetching progress and failure of the list call itself.
|
|
37
|
+
*
|
|
38
|
+
* The list holds everything the provider offers, one entry per release included, which is more than
|
|
39
|
+
* a model picker can carry. Which of them the pickers offer is shown and controlled here, by the
|
|
40
|
+
* star on each row.
|
|
41
|
+
*/
|
|
42
|
+
const ProviderModelDiscoverySection = ({ status, models, favorites, onRefresh, onAction }) => {
|
|
43
|
+
const [filter, setFilter] = React.useState('');
|
|
44
|
+
const [favoritesOnly, setFavoritesOnly] = React.useState(false);
|
|
45
|
+
// Re-render when a star is set anywhere, and when a discovery changes what is featured.
|
|
46
|
+
const [favoritesRevision, setFavoritesRevision] = React.useState(0);
|
|
47
|
+
React.useEffect(() => {
|
|
48
|
+
const listener = favorites.onDidChange(() => setFavoritesRevision(revision => revision + 1));
|
|
49
|
+
return () => listener.dispose();
|
|
50
|
+
}, [favorites]);
|
|
51
|
+
const fetching = status.state === 'fetching';
|
|
52
|
+
const modelIdPrefix = status.modelIdPrefix ?? status.providerId;
|
|
53
|
+
const overridden = favorites.hasOverrides(modelIdPrefix);
|
|
54
|
+
// Without a credential there is nothing to ask the provider; refreshing would only report the same
|
|
55
|
+
// state back. The setting or the sign-in above the list is what moves this on.
|
|
56
|
+
const refreshable = status.state !== 'no-credentials' && status.state !== 'awaiting-consent';
|
|
57
|
+
// Newest first: a provider's recent models are what a list this long is scrolled for. Models whose
|
|
58
|
+
// provider reports no release date (Gemini reports none) fall back to alphabetical order.
|
|
59
|
+
const rows = React.useMemo(() => models
|
|
60
|
+
.slice()
|
|
61
|
+
.sort(common_1.compareModelsByRecency)
|
|
62
|
+
// `favoritesRevision` is not read here: it is what re-runs this when a star or the featured set changes.
|
|
63
|
+
.map(model => describeModel(model, status.discovered, favorites))
|
|
64
|
+
// The provider's current line-up first, newest first within each part. A list this long is read
|
|
65
|
+
// from the top, and the models the picker starts with are what it is usually opened for. The sort
|
|
66
|
+
// is stable, so it only lifts them past the older ones without disturbing the order.
|
|
67
|
+
.sort((left, right) => Number(right.featured) - Number(left.featured)), [models, status.discovered, favorites, favoritesRevision]);
|
|
68
|
+
const matches = React.useMemo(() => rows.filter(row => (!favoritesOnly || row.favorite) && matchesFilter(row, filter)), [rows, filter, favoritesOnly]);
|
|
69
|
+
const favoritesOnlyLabel = favoritesOnly
|
|
70
|
+
? core_1.nls.localize('theia/ai/ide/modelsConfiguration/showAllModels', 'Show all discovered models')
|
|
71
|
+
: core_1.nls.localize('theia/ai/ide/modelsConfiguration/showCheckedModels', 'Show only the models the AI chat input\'s model picker shows');
|
|
72
|
+
const filterToggles = [{
|
|
73
|
+
iconClass: (0, browser_1.codicon)('pass'),
|
|
74
|
+
title: favoritesOnlyLabel,
|
|
75
|
+
active: favoritesOnly,
|
|
76
|
+
onToggle: () => setFavoritesOnly(!favoritesOnly)
|
|
77
|
+
}];
|
|
78
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationSection, { title: core_1.nls.localize('theia/ai/ide/modelsConfiguration/discovery', 'Model Discovery'), count: rows.length > 0 ? rows.length : undefined, subtitle: sectionSubtitle(status, rows.length, rows.filter(row => row.favorite).length), actions: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationStatusBadge, { status: discoveryStatusBadge(status) }), (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationIconButton, { iconClass: (0, browser_1.codicon)(fetching ? 'sync' : 'refresh'), title: refreshable
|
|
79
|
+
? core_1.nls.localize('theia/ai/ide/modelsConfiguration/refresh', 'Refresh the model list')
|
|
80
|
+
: status.message ?? core_1.nls.localize('theia/ai/ide/modelsConfiguration/refreshUnavailable', 'Nothing to refresh until the provider has a credential'), busy: fetching, disabled: fetching || !refreshable, onClick: onRefresh }), (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationIconButton, { iconClass: (0, browser_1.codicon)('discard'), title: overridden
|
|
81
|
+
? core_1.nls.localize('theia/ai/ide/modelsConfiguration/resetShown', 'Reset to defaults')
|
|
82
|
+
: core_1.nls.localize('theia/ai/ide/modelsConfiguration/resetShownUnavailable', 'Already at the defaults'), disabled: !overridden, onClick: () => favorites.resetToDefaults(modelIdPrefix) })] }), children: (0, jsx_runtime_1.jsx)(DiscoveryBody, { status: status, rows: rows, matches: matches, filter: filter, onFilterChange: setFilter, filterToggles: filterToggles, favorites: favorites, onRefresh: onRefresh, onAction: onAction }) });
|
|
83
|
+
};
|
|
84
|
+
exports.ProviderModelDiscoverySection = ProviderModelDiscoverySection;
|
|
85
|
+
/**
|
|
86
|
+
* The line under the section title. A manually configured list says so, since that is why no discovery
|
|
87
|
+
* ran; otherwise it states once — rather than leaving it to the tooltip of each of forty rows — that
|
|
88
|
+
* the checks are about the chat input alone. An agent's model and a model alias are picked from every
|
|
89
|
+
* discovered model, on their own pages.
|
|
90
|
+
*/
|
|
91
|
+
function sectionSubtitle(status, rowCount, shownCount) {
|
|
92
|
+
if (status.state === 'overridden') {
|
|
93
|
+
return status.message;
|
|
94
|
+
}
|
|
95
|
+
// The ratio is the overview a list this long cannot give by itself, and it says what the checks mean.
|
|
96
|
+
return rowCount > 0
|
|
97
|
+
? core_1.nls.localize('theia/ai/ide/modelsConfiguration/shownExplanation', '{0} of {1} shown in the AI chat input\'s model picker', shownCount, rowCount)
|
|
98
|
+
: undefined;
|
|
99
|
+
}
|
|
100
|
+
function describeModel(model, discovered, favorites) {
|
|
101
|
+
// Registered ids carry the `<provider>/` prefix; what the provider reported does not.
|
|
102
|
+
const id = model.id.substring(model.id.indexOf('/') + 1);
|
|
103
|
+
const reported = discovered?.find(candidate => candidate.id === id);
|
|
104
|
+
return {
|
|
105
|
+
id,
|
|
106
|
+
qualifiedId: model.id,
|
|
107
|
+
label: reported?.label ?? model.name,
|
|
108
|
+
description: reported?.description,
|
|
109
|
+
released: model.released ?? reported?.released,
|
|
110
|
+
ready: model.status.status === 'ready',
|
|
111
|
+
statusMessage: model.status.message,
|
|
112
|
+
favorite: favorites.isFavorite(model.id),
|
|
113
|
+
featured: favorites.isFeatured(model.id)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function matchesFilter(row, filter) {
|
|
117
|
+
const query = filter.trim().toLowerCase();
|
|
118
|
+
return query.length === 0
|
|
119
|
+
|| row.id.toLowerCase().includes(query)
|
|
120
|
+
|| (row.label?.toLowerCase().includes(query) ?? false);
|
|
121
|
+
}
|
|
122
|
+
const DiscoveryBody = ({ status, rows, matches, filter, onFilterChange, filterToggles, favorites, onRefresh, onAction }) => {
|
|
123
|
+
// The provider's API-key and consent settings sit on the same page, right above this section — but
|
|
124
|
+
// a provider whose credential is a sign-in rather than a setting names the command that gets one.
|
|
125
|
+
if (status.state === 'no-credentials' || status.state === 'awaiting-consent') {
|
|
126
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationEmptyState, { message: status.message ?? '', iconClass: (0, browser_1.codicon)('key'), action: status.action && (0, jsx_runtime_1.jsx)("button", { className: 'theia-button main', onClick: () => onAction(status.action), children: status.action.label }) });
|
|
127
|
+
}
|
|
128
|
+
const retry = (0, jsx_runtime_1.jsx)("button", { className: 'theia-button main', onClick: onRefresh, children: core_1.nls.localizeByDefault('Retry') });
|
|
129
|
+
const refresh = (0, jsx_runtime_1.jsx)("button", { className: 'theia-button main', onClick: onRefresh, children: core_1.nls.localizeByDefault('Refresh') });
|
|
130
|
+
return (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [status.state === 'error' && (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationCallout, { message: status.message ?? '', action: retry }), status.state === 'ready' && status.fromCache && status.message && (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationCallout, { message: status.message, action: refresh }), rows.length === 0
|
|
131
|
+
? (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationEmptyState, { message: core_1.nls.localize('theia/ai/ide/modelsConfiguration/noModels', 'No models discovered yet.'), iconClass: (0, browser_1.codicon)('cloud') })
|
|
132
|
+
: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [rows.length > FILTER_THRESHOLD && (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationFilterInput, { value: filter, onChange: onFilterChange, placeholder: core_1.nls.localize('theia/ai/ide/modelsConfiguration/filterModels', 'Filter models'), toggles: filterToggles }), matches.length === 0
|
|
133
|
+
? (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationEmptyState, { message: core_1.nls.localizeByDefault('No results found') })
|
|
134
|
+
: (0, jsx_runtime_1.jsx)(ModelRows, { rows: matches, favorites: favorites })] })] });
|
|
135
|
+
};
|
|
136
|
+
const ModelRows = ({ rows, favorites }) => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: rows.map(row => (0, jsx_runtime_1.jsx)(ai_configuration_item_row_1.AiConfigurationItemRow, {
|
|
137
|
+
// The id is the heading on every row, whatever the provider reports: it is what agents, aliases
|
|
138
|
+
// and settings reference, and OpenAI reports nothing else, so heading it with the name where
|
|
139
|
+
// there is one would give each provider a differently shaped list.
|
|
140
|
+
label: row.id,
|
|
141
|
+
// Kept on the row whether the model is checked or not: it says that this is one of the
|
|
142
|
+
// provider's current models, which is why the picker starts with it and stays true after
|
|
143
|
+
// someone unchecks it.
|
|
144
|
+
tags: row.featured
|
|
145
|
+
? [{
|
|
146
|
+
label: core_1.nls.localizeByDefault('Default'),
|
|
147
|
+
title: core_1.nls.localize('theia/ai/ide/modelsConfiguration/defaultModel', 'One of the newest models of this provider, which the AI chat input\'s model picker shows unless it is hidden here')
|
|
148
|
+
}]
|
|
149
|
+
: undefined, description: modelRowDescription(row),
|
|
150
|
+
// Every model in this list is ready as long as the provider has a key, which it has whenever the
|
|
151
|
+
// list is shown at all. Only the exception is worth a badge.
|
|
152
|
+
status: row.ready ? undefined : notReadyBadge(row), trailing: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [row.released !== undefined && (0, jsx_runtime_1.jsx)("span", { className: 'ai-configuration-item-row-detail', children: core_1.nls.localize('theia/ai/ide/modelsConfiguration/released', 'released {0}', (0, date_fns_1.formatDistanceToNow)(row.released, { addSuffix: true })) }), (0, jsx_runtime_1.jsx)(ShowInChatButton, { row: row, favorites: favorites })] }) }, row.id)) });
|
|
153
|
+
/**
|
|
154
|
+
* Whether the AI chat input's model picker shows this model: a checked circle when it does, an empty
|
|
155
|
+
* one when it does not. Nothing else is affected — an agent's model and a model alias are picked from
|
|
156
|
+
* every discovered model, on their own pages.
|
|
157
|
+
*
|
|
158
|
+
* What a model released tomorrow is shown by is the `Default` badge on its row, not a check made
|
|
159
|
+
* here; unchecking one of those is what says otherwise, and that is all that is stored.
|
|
160
|
+
*/
|
|
161
|
+
const ShowInChatButton = ({ row, favorites }) => {
|
|
162
|
+
const title = row.favorite
|
|
163
|
+
? core_1.nls.localize('theia/ai/ide/modelsConfiguration/hideModel', 'Hide this model from the AI chat input\'s model picker')
|
|
164
|
+
: core_1.nls.localize('theia/ai/ide/modelsConfiguration/showModel', 'Show this model in the AI chat input\'s model picker');
|
|
165
|
+
return (0, jsx_runtime_1.jsx)(ai_configuration_primitives_1.AiConfigurationIconButton, { iconClass: (0, browser_1.codicon)(row.favorite ? 'pass' : 'circle-large'), title: title, onClick: () => favorites.toggleFavorite(row.qualifiedId) });
|
|
166
|
+
};
|
|
167
|
+
/** What the provider reports about the model, if anything: its name, its description, or both. */
|
|
168
|
+
function modelRowDescription(row) {
|
|
169
|
+
const parts = [row.label, row.description].filter(part => part !== undefined);
|
|
170
|
+
return parts.length > 0 ? parts.join(' · ') : undefined;
|
|
171
|
+
}
|
|
172
|
+
function notReadyBadge(row) {
|
|
173
|
+
return {
|
|
174
|
+
kind: 'warn',
|
|
175
|
+
label: core_1.nls.localize('theia/ai/ide/modelsConfiguration/modelNotReady', 'Not ready'),
|
|
176
|
+
tooltip: row.statusMessage
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/** Maps the discovery state onto the shared status badge, so it reads like every other badge in the view. */
|
|
180
|
+
function discoveryStatusBadge(status) {
|
|
181
|
+
const badge = genericStatusBadge(status);
|
|
182
|
+
// A provider whose credential is not an API key says so itself; the state alone cannot know.
|
|
183
|
+
return status.stateLabel ? { ...badge, label: status.stateLabel } : badge;
|
|
184
|
+
}
|
|
185
|
+
function genericStatusBadge(status) {
|
|
186
|
+
switch (status.state) {
|
|
187
|
+
case 'no-credentials':
|
|
188
|
+
return { kind: 'warn', label: core_1.nls.localize('theia/ai/ide/modelsConfiguration/noKey', 'No API key'), tooltip: status.message };
|
|
189
|
+
case 'awaiting-consent':
|
|
190
|
+
return { kind: 'warn', label: core_1.nls.localize('theia/ai/ide/modelsConfiguration/awaitingConsent', 'Awaiting consent'), tooltip: status.message };
|
|
191
|
+
case 'fetching':
|
|
192
|
+
return { kind: 'off', label: core_1.nls.localize('theia/ai/ide/modelsConfiguration/fetching', 'Fetching…'), tooltip: status.message };
|
|
193
|
+
case 'error':
|
|
194
|
+
return { kind: 'error', label: core_1.nls.localizeByDefault('Error'), tooltip: status.message };
|
|
195
|
+
case 'overridden':
|
|
196
|
+
return { kind: 'off', label: core_1.nls.localizeByDefault('Manual'), tooltip: status.message };
|
|
197
|
+
case 'ready':
|
|
198
|
+
if (status.fromCache) {
|
|
199
|
+
return { kind: 'warn', label: core_1.nls.localize('theia/ai/ide/modelsConfiguration/cached', 'Cached'), tooltip: status.message };
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
kind: 'on',
|
|
203
|
+
label: status.lastFetch
|
|
204
|
+
? core_1.nls.localize('theia/ai/ide/modelsConfiguration/updated', 'Updated {0}', (0, date_fns_1.formatDistanceToNow)(status.lastFetch, { addSuffix: true }))
|
|
205
|
+
: core_1.nls.localize('theia/ai/ide/modelsConfiguration/ready', 'Ready'),
|
|
206
|
+
tooltip: status.message
|
|
207
|
+
};
|
|
208
|
+
default:
|
|
209
|
+
return { kind: 'off', label: core_1.nls.localizeByDefault('Idle'), tooltip: status.message };
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=provider-model-discovery-section.js.map
|