Path: blob/main/src/vs/workbench/services/aiSettingsSearch/common/aiSettingsSearch.ts
3296 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { CancellationToken } from '../../../../base/common/cancellation.js';6import { Event } from '../../../../base/common/event.js';7import { IDisposable } from '../../../../base/common/lifecycle.js';8import { createDecorator } from '../../../../platform/instantiation/common/instantiation.js';910export const IAiSettingsSearchService = createDecorator<IAiSettingsSearchService>('IAiSettingsSearchService');1112export enum AiSettingsSearchResultKind {13EMBEDDED = 1,14LLM_RANKED = 2,15CANCELED = 3,16}1718export interface AiSettingsSearchResult {19query: string;20kind: AiSettingsSearchResultKind;21settings: string[];22}2324export interface AiSettingsSearchProviderOptions {25limit: number;26embeddingsOnly: boolean;27}2829export interface IAiSettingsSearchService {30readonly _serviceBrand: undefined;31readonly onProviderRegistered: Event<void>;3233// Called from the Settings editor34isEnabled(): boolean;35startSearch(query: string, embeddingsOnly: boolean, token: CancellationToken): void;36getEmbeddingsResults(query: string, token: CancellationToken): Promise<string[] | null>;37getLLMRankedResults(query: string, token: CancellationToken): Promise<string[] | null>;3839// Called from the main thread40registerSettingsSearchProvider(provider: IAiSettingsSearchProvider): IDisposable;41handleSearchResult(results: AiSettingsSearchResult): void;42}4344export interface IAiSettingsSearchProvider {45searchSettings(query: string, option: AiSettingsSearchProviderOptions, token: CancellationToken): void;46}474849