mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-10 16:58:55 -05:00
NES cursor jump: respect first model with tag CursorJump from /models (#313988)
* NES cursor jump: respect first model with tag CursorJump from /models * extract cursor-jump model name selection into a method with hardcoded default * comment cursor-jump model name selection priority
This commit is contained in:
committed by
GitHub
parent
530cb5de71
commit
25a3c5d05d
@@ -16,6 +16,7 @@ import { ILanguageDiagnosticsService } from '../../../platform/languages/common/
|
||||
import { ILogger } from '../../../platform/log/common/logService';
|
||||
import { OptionalChatRequestParams } from '../../../platform/networking/common/fetch';
|
||||
import { IChatEndpoint } from '../../../platform/networking/common/networking';
|
||||
import { IProxyModelsService } from '../../../platform/proxyModels/common/proxyModelsService';
|
||||
import { IExperimentationService } from '../../../platform/telemetry/common/nullExperimentationService';
|
||||
import { backwardCompatSetting } from '../../../util/common/backwardCompatSetting';
|
||||
import { ErrorUtils } from '../../../util/common/errors';
|
||||
@@ -33,6 +34,8 @@ export type CursorJumpPrediction =
|
||||
| { readonly kind: 'sameFile'; readonly lineNumber: number }
|
||||
| { readonly kind: 'differentFile'; readonly filePath: string; readonly lineNumber: number };
|
||||
|
||||
const DEFAULT_CURSOR_JUMP_MODEL_NAME = 'copilot-suggestions-himalia-001';
|
||||
|
||||
export class XtabNextCursorPredictor {
|
||||
|
||||
private isDisabled: boolean;
|
||||
@@ -44,6 +47,7 @@ export class XtabNextCursorPredictor {
|
||||
@IExperimentationService private readonly expService: IExperimentationService,
|
||||
@ILanguageDiagnosticsService private readonly langDiagService: ILanguageDiagnosticsService,
|
||||
@IEndpointProvider private readonly endpointProvider: IEndpointProvider,
|
||||
@IProxyModelsService private readonly proxyModelsService: IProxyModelsService,
|
||||
) {
|
||||
this.isDisabled = false;
|
||||
}
|
||||
@@ -161,11 +165,7 @@ export class XtabNextCursorPredictor {
|
||||
|
||||
telemetryBuilder?.setCursorJumpPrompt(messages);
|
||||
|
||||
const modelName = this.configService.getExperimentBasedConfig(ConfigKey.TeamInternal.InlineEditsNextCursorPredictionModelName, this.expService);
|
||||
if (modelName === undefined) {
|
||||
tracer.trace('Model name for cursor prediction is not defined; skipping prediction');
|
||||
return Result.fromString('modelNameNotDefined');
|
||||
}
|
||||
const modelName = this.determineModelName();
|
||||
telemetryBuilder?.setCursorJumpModelName(modelName);
|
||||
|
||||
const resolvedEndpoint = await this.resolveEndpoint(modelName, tracer);
|
||||
@@ -260,6 +260,14 @@ export class XtabNextCursorPredictor {
|
||||
};
|
||||
}
|
||||
|
||||
private determineModelName(): string {
|
||||
// Priority: experiment-configured model name, then the first `CursorJumpChat`
|
||||
// model advertised by the `/models` endpoint, then a hard-coded fallback.
|
||||
return this.configService.getExperimentBasedConfig(ConfigKey.TeamInternal.InlineEditsNextCursorPredictionModelName, this.expService)
|
||||
?? this.proxyModelsService.cursorJumpModels?.[0]?.name
|
||||
?? DEFAULT_CURSOR_JUMP_MODEL_NAME;
|
||||
}
|
||||
|
||||
private determineLintOptions(): xtabPromptOptions.LintOptions | undefined {
|
||||
const localLintOptions = this.configService.getConfig(ConfigKey.TeamInternal.InlineEditsNextCursorPredictionLintOptions);
|
||||
if (localLintOptions) {
|
||||
|
||||
@@ -810,7 +810,7 @@ export namespace ConfigKey {
|
||||
export const InlineEditsTriggerOnEditorChangeStrategy = defineTeamInternalSetting<triggerOptions.DocumentSwitchTriggerStrategy>('chat.advanced.inlineEdits.triggerOnEditorChangeStrategy', ConfigType.ExperimentBased, triggerOptions.DocumentSwitchTriggerStrategy.AfterAcceptance, triggerOptions.DocumentSwitchTriggerStrategy.VALIDATOR);
|
||||
export const InlineEditsProviderId = defineTeamInternalSetting<string | undefined>('chat.advanced.inlineEdits.providerId', ConfigType.ExperimentBased, undefined);
|
||||
export const InlineEditsUnification = defineTeamInternalSetting<boolean>('chat.advanced.inlineEdits.unification', ConfigType.ExperimentBased, false);
|
||||
export const InlineEditsNextCursorPredictionModelName = defineTeamInternalSetting<string | undefined>('chat.advanced.inlineEdits.nextCursorPrediction.modelName', ConfigType.ExperimentBased, 'copilot-suggestions-himalia-001');
|
||||
export const InlineEditsNextCursorPredictionModelName = defineTeamInternalSetting<string | undefined>('chat.advanced.inlineEdits.nextCursorPrediction.modelName', ConfigType.ExperimentBased, undefined);
|
||||
export const InlineEditsNextCursorPredictionUseEndpointProvider = defineTeamInternalSetting<boolean>('chat.advanced.inlineEdits.nextCursorPrediction.useEndpointProvider', ConfigType.Simple, false, vBoolean());
|
||||
export const InlineEditsNextCursorPredictionMaxResponseTokens = defineTeamInternalSetting<number>('chat.advanced.inlineEdits.nextCursorPrediction.maxResponseTokens', ConfigType.ExperimentBased, 40);
|
||||
export const InlineEditsNextCursorPredictionLintOptionsString = defineTeamInternalSetting<string | undefined>('chat.advanced.inlineEdits.nextCursorPrediction.lintOptionsString', ConfigType.ExperimentBased, undefined);
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface IProxyModelsService {
|
||||
|
||||
readonly models: WireTypes.ModelList.t | undefined;
|
||||
readonly nesModels: WireTypes.Model.t[] | undefined;
|
||||
readonly cursorJumpModels: WireTypes.Model.t[] | undefined;
|
||||
readonly instantApplyModels: WireTypes.Model.t[] | undefined;
|
||||
}
|
||||
|
||||
@@ -32,6 +33,10 @@ export class NullProxyModelsService implements IProxyModelsService {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get cursorJumpModels(): WireTypes.Model.t[] | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
get instantApplyModels(): WireTypes.Model.t[] | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,10 @@ export class ProxyModelsService extends Disposable implements IProxyModelsServic
|
||||
return this._models?.models.filter(model => model.serviceType === 'NESChat');
|
||||
}
|
||||
|
||||
get cursorJumpModels(): WireTypes.Model.t[] | undefined {
|
||||
return this._models?.models.filter(model => model.serviceType === 'CursorJumpChat');
|
||||
}
|
||||
|
||||
get instantApplyModels(): WireTypes.Model.t[] | undefined {
|
||||
return this._models?.models.filter(model => model.serviceType === 'InstantApplyChat');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user