Коммит 2a5020c2 создал по автору Oleg Solomko's avatar Oleg Solomko
Просмотр файлов

add /save slash command

владелец 8b4ad1d4
......@@ -63,7 +63,7 @@ import { convertBufferToScreenshotVariable, ScreenshotVariableId } from '../cont
import { resizeImage } from '../imageUtils.js';
import { INSTRUCTIONS_COMMAND_ID } from '../promptSyntax/contributions/attachInstructionsCommand.js';
import { CHAT_CATEGORY } from './chatActions.js';
import { runAttachInstructionsAction, registerReusablePromptActions } from './reusablePromptActions/index.js';
import { runAttachInstructionsAction, registerPromptActions } from './promptActions/index.js';
export function registerChatContextActions() {
registerAction2(AttachContextAction);
......@@ -978,4 +978,4 @@ export class AttachContextAction extends Action2 {
/**
* Register all actions related to reusable prompt files.
*/
registerReusablePromptActions();
registerPromptActions();
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { registerRunPromptActions } from './chatRunPromptAction.js';
import { registerSaveToPromptActions } from './chatSaveToPromptAction.js';
import { registerAttachPromptActions } from './chatAttachInstructionsAction.js';
/**
* Helper to register all actions related to reusable prompt files.
*/
export const registerPromptActions = () => {
registerRunPromptActions();
registerAttachPromptActions();
registerSaveToPromptActions();
};
export { runAttachInstructionsAction } from './chatAttachInstructionsAction.js';
......@@ -103,6 +103,8 @@ import { LanguageModelToolsService } from './languageModelToolsService.js';
import './promptSyntax/contributions/createPromptCommand/createPromptCommand.js';
import './promptSyntax/contributions/attachInstructionsCommand.js';
import { ChatViewsWelcomeHandler } from './viewsWelcome/chatViewsWelcomeHandler.js';
import { runSaveToPromptAction, SAVE_TO_PROMPT_SLASH_COMMAND_NAME } from './actions/promptActions/chatSaveToPromptAction.js';
import { assertDefined } from '../../../../base/common/types.js';
// Register configuration
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
......@@ -488,7 +490,7 @@ class ChatSlashStaticSlashCommandsContribution extends Disposable {
@IChatSlashCommandService slashCommandService: IChatSlashCommandService,
@ICommandService commandService: ICommandService,
@IChatAgentService chatAgentService: IChatAgentService,
@IChatVariablesService chatVariablesService: IChatVariablesService,
@IChatWidgetService chatWidgetService: IChatWidgetService,
@IInstantiationService instantiationService: IInstantiationService,
) {
super();
......@@ -501,6 +503,22 @@ class ChatSlashStaticSlashCommandsContribution extends Disposable {
}, async () => {
commandService.executeCommand(ACTION_ID_NEW_CHAT);
}));
this._store.add(slashCommandService.registerSlashCommand({
command: SAVE_TO_PROMPT_SLASH_COMMAND_NAME,
detail: nls.localize('save-chat-to-prompt-file', "Save chat to a prompt file"),
// TODO: @legomushroom - reuse the command name constant?
sortText: 'z3_save',
executeImmediately: true,
locations: [ChatAgentLocation.Panel]
}, async () => {
const { lastFocusedWidget } = chatWidgetService;
assertDefined(
lastFocusedWidget,
'No currently active chat widget found.',
);
runSaveToPromptAction({ chat: lastFocusedWidget }, commandService);
}));
this._store.add(slashCommandService.registerSlashCommand({
command: 'help',
detail: '',
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать