Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/services/aiSettingsSearch/common/aiSettingsSearch.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { CancellationToken } from '../../../../base/common/cancellation.js';
7
import { Event } from '../../../../base/common/event.js';
8
import { IDisposable } from '../../../../base/common/lifecycle.js';
9
import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';
10
11
export const IAiSettingsSearchService = createDecorator<IAiSettingsSearchService>('IAiSettingsSearchService');
12
13
export enum AiSettingsSearchResultKind {
14
EMBEDDED = 1,
15
LLM_RANKED = 2,
16
CANCELED = 3,
17
}
18
19
export interface AiSettingsSearchResult {
20
query: string;
21
kind: AiSettingsSearchResultKind;
22
settings: string[];
23
}
24
25
export interface AiSettingsSearchProviderOptions {
26
limit: number;
27
embeddingsOnly: boolean;
28
}
29
30
export interface IAiSettingsSearchService {
31
readonly _serviceBrand: undefined;
32
readonly onProviderRegistered: Event<void>;
33
34
// Called from the Settings editor
35
isEnabled(): boolean;
36
startSearch(query: string, embeddingsOnly: boolean, token: CancellationToken): void;
37
getEmbeddingsResults(query: string, token: CancellationToken): Promise<string[] | null>;
38
getLLMRankedResults(query: string, token: CancellationToken): Promise<string[] | null>;
39
40
// Called from the main thread
41
registerSettingsSearchProvider(provider: IAiSettingsSearchProvider): IDisposable;
42
handleSearchResult(results: AiSettingsSearchResult): void;
43
}
44
45
export interface IAiSettingsSearchProvider {
46
searchSettings(query: string, option: AiSettingsSearchProviderOptions, token: CancellationToken): void;
47
}
48
49