Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to disable chat history variables #192346

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { CompletionContext, CompletionItem, CompletionItemKind, CompletionList }
import { ITextModel } from 'vs/editor/common/model';
import { ILanguageFeaturesService } from 'vs/editor/common/services/languageFeatures';
import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Registry } from 'vs/platform/registry/common/platform';
import { inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
Expand Down Expand Up @@ -357,6 +358,7 @@ class VariableCompletions extends Disposable {
@ILanguageFeaturesService private readonly languageFeaturesService: ILanguageFeaturesService,
@IChatWidgetService private readonly chatWidgetService: IChatWidgetService,
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
@IConfigurationService private readonly configurationService: IConfigurationService,
) {
super();

Expand Down Expand Up @@ -389,13 +391,14 @@ class VariableCompletions extends Disposable {
.filter(isResponseVM);

// TODO@roblourens work out a real API for this- maybe it can be part of the two-step flow that @file will probably use
const historyItems = history.map((h, i): CompletionItem => ({
const historyVariablesEnabled = this.configurationService.getValue('chat.experimental.historyVariables');
const historyItems = historyVariablesEnabled ? history.map((h, i): CompletionItem => ({
label: `@response:${i + 1}`,
detail: h.response.asString(),
insertText: `@response:${String(i + 1).padStart(String(history.length).length, '0')} `,
kind: CompletionItemKind.Text,
range: { insert, replace },
}));
})) : [];

const variableItems = Array.from(this.chatVariablesService.getVariables()).map(v => {
const withAt = `@${v.name}`;
Expand Down
Loading