diff --git a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts index 77312d40381..35908757eda 100644 --- a/src/vs/workbench/api/browser/mainThreadChatAgents2.ts +++ b/src/vs/workbench/api/browser/mainThreadChatAgents2.ts @@ -47,7 +47,7 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA for (const [handle, agent] of this._agents) { if (agent.name === e.agentId) { if (e.action.kind === 'vote') { - this._proxy.$acceptFeedback(handle, e.sessionId, e.requestId, e.action.direction, e.action.reportIssue); + this._proxy.$acceptFeedback(handle, e.sessionId, e.requestId, e.action.direction); } else { this._proxy.$acceptAction(handle, e.sessionId, e.requestId, e); } diff --git a/src/vs/workbench/api/browser/mainThreadInlineChat.ts b/src/vs/workbench/api/browser/mainThreadInlineChat.ts index c64869de974..449ddae9699 100644 --- a/src/vs/workbench/api/browser/mainThreadInlineChat.ts +++ b/src/vs/workbench/api/browser/mainThreadInlineChat.ts @@ -60,8 +60,8 @@ export class MainThreadInlineChat implements MainThreadInlineChatShape { this._progresses.delete(request.requestId); } }, - handleInlineChatResponseFeedback: !supportsFeedback ? undefined : async (session, response, kind, reportIssue) => { - this._proxy.$handleFeedback(handle, session.id, response.id, kind, reportIssue); + handleInlineChatResponseFeedback: !supportsFeedback ? undefined : async (session, response, kind) => { + this._proxy.$handleFeedback(handle, session.id, response.id, kind); } }); diff --git a/src/vs/workbench/api/common/extHost.protocol.ts b/src/vs/workbench/api/common/extHost.protocol.ts index 6426238cc80..9239a3d4025 100644 --- a/src/vs/workbench/api/common/extHost.protocol.ts +++ b/src/vs/workbench/api/common/extHost.protocol.ts @@ -1206,7 +1206,7 @@ export type IInlineChatResponseDto = Dto; $provideResponse(handle: number, session: IInlineChatSession, request: IInlineChatRequest, token: CancellationToken): Promise; - $handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind, reportIssue?: boolean): void; + $handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind): void; $releaseSession(handle: number, sessionId: number): void; } diff --git a/src/vs/workbench/api/common/extHostInlineChat.ts b/src/vs/workbench/api/common/extHostInlineChat.ts index 1cfcdd8f2c9..145447fdac1 100644 --- a/src/vs/workbench/api/common/extHostInlineChat.ts +++ b/src/vs/workbench/api/common/extHostInlineChat.ts @@ -223,13 +223,13 @@ export class ExtHostInteractiveEditor implements ExtHostInlineChatShape { }; } - $handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind, reportIssue?: boolean): void { + $handleFeedback(handle: number, sessionId: number, responseId: number, kind: InlineChatResponseFeedbackKind): void { const entry = this._inputProvider.get(handle); const sessionData = this._inputSessions.get(sessionId); const response = sessionData?.responses[responseId]; if (entry && response) { const apiKind = typeConvert.InteractiveEditorResponseFeedbackKind.to(kind); - entry.provider.handleInteractiveEditorResponseFeedback?.(sessionData.session, response, apiKind, reportIssue); + entry.provider.handleInteractiveEditorResponseFeedback?.(sessionData.session, response, apiKind); } } diff --git a/src/vs/workbench/api/common/extHostTypeConverters.ts b/src/vs/workbench/api/common/extHostTypeConverters.ts index 8ae2479fd2f..2f13a42b1a1 100644 --- a/src/vs/workbench/api/common/extHostTypeConverters.ts +++ b/src/vs/workbench/api/common/extHostTypeConverters.ts @@ -2288,6 +2288,8 @@ export namespace InteractiveEditorResponseFeedbackKind { return types.InteractiveEditorResponseFeedbackKind.Undone; case InlineChatResponseFeedbackKind.Accepted: return types.InteractiveEditorResponseFeedbackKind.Accepted; + case InlineChatResponseFeedbackKind.Bug: + return types.InteractiveEditorResponseFeedbackKind.Bug; } } } diff --git a/src/vs/workbench/api/common/extHostTypes.ts b/src/vs/workbench/api/common/extHostTypes.ts index f6e1bc8fb4d..df40c53d3be 100644 --- a/src/vs/workbench/api/common/extHostTypes.ts +++ b/src/vs/workbench/api/common/extHostTypes.ts @@ -4104,7 +4104,8 @@ export enum InteractiveEditorResponseFeedbackKind { Unhelpful = 0, Helpful = 1, Undone = 2, - Accepted = 3 + Accepted = 3, + Bug = 4 } export enum ChatMessageRole { diff --git a/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts b/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts index 7cc774dcd61..deb69fa08e2 100644 --- a/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts +++ b/src/vs/workbench/contrib/chat/browser/actions/chatTitleActions.ts @@ -141,12 +141,9 @@ export function registerChatTitleActions() { sessionId: item.sessionId, requestId: item.requestId, action: { - kind: 'vote', - direction: InteractiveSessionVoteDirection.Down, - reportIssue: true + kind: 'bug' } }); - item.setVote(InteractiveSessionVoteDirection.Down); } }); diff --git a/src/vs/workbench/contrib/chat/common/chatService.ts b/src/vs/workbench/contrib/chat/common/chatService.ts index fd487f35d25..a558b2303ea 100644 --- a/src/vs/workbench/contrib/chat/common/chatService.ts +++ b/src/vs/workbench/contrib/chat/common/chatService.ts @@ -211,7 +211,11 @@ export interface IChatFollowupAction { followup: IChatReplyFollowup; } -export type ChatUserAction = IChatVoteAction | IChatCopyAction | IChatInsertAction | IChatTerminalAction | IChatCommandAction | IChatFollowupAction; +export interface IChatBugReportAction { + kind: 'bug'; +} + +export type ChatUserAction = IChatVoteAction | IChatCopyAction | IChatInsertAction | IChatTerminalAction | IChatCommandAction | IChatFollowupAction | IChatBugReportAction; export interface IChatUserActionEvent { action: ChatUserAction; diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts index 8649029dd17..53401db1f0c 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.ts @@ -10,7 +10,7 @@ import { EditorAction2 } from 'vs/editor/browser/editorExtensions'; import { EmbeddedCodeEditorWidget, EmbeddedDiffEditorWidget } from 'vs/editor/browser/widget/embeddedCodeEditorWidget'; import { EditorContextKeys } from 'vs/editor/common/editorContextKeys'; import { InlineChatController, InlineChatRunOptions } from 'vs/workbench/contrib/inlineChat/browser/inlineChatController'; -import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, MENU_INLINE_CHAT_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, InlineChatResponseType, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChateResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, MENU_INLINE_CHAT_WIDGET_TOGGLE, CTX_INLINE_CHAT_INNER_CURSOR_START, CTX_INLINE_CHAT_INNER_CURSOR_END, CTX_INLINE_CHAT_RESPONSE_FOCUSED, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; +import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_ACTIVE_REQUEST, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_EMPTY, CTX_INLINE_CHAT_OUTER_CURSOR_POSITION, CTX_INLINE_CHAT_VISIBLE, MENU_INLINE_CHAT_WIDGET, MENU_INLINE_CHAT_WIDGET_DISCARD, MENU_INLINE_CHAT_WIDGET_STATUS, CTX_INLINE_CHAT_LAST_FEEDBACK, CTX_INLINE_CHAT_EDIT_MODE, EditMode, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, MENU_INLINE_CHAT_WIDGET_MARKDOWN_MESSAGE, CTX_INLINE_CHAT_MESSAGE_CROP_STATE, CTX_INLINE_CHAT_DOCUMENT_CHANGED, CTX_INLINE_CHAT_DID_EDIT, CTX_INLINE_CHAT_HAS_STASHED_SESSION, MENU_INLINE_CHAT_WIDGET_FEEDBACK, ACTION_ACCEPT_CHANGES, ACTION_REGENERATE_RESPONSE, InlineChatResponseType, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChateResponseTypes, ACTION_VIEW_IN_CHAT, CTX_INLINE_CHAT_USER_DID_EDIT, MENU_INLINE_CHAT_WIDGET_TOGGLE, CTX_INLINE_CHAT_INNER_CURSOR_START, CTX_INLINE_CHAT_INNER_CURSOR_END, CTX_INLINE_CHAT_RESPONSE_FOCUSED, CTX_INLINE_CHAT_SUPPORT_ISSUE_REPORTING, InlineChatResponseFeedbackKind } from 'vs/workbench/contrib/inlineChat/common/inlineChat'; import { localize } from 'vs/nls'; import { IAction2Options, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions'; import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService'; @@ -408,7 +408,7 @@ export class FeebackHelpfulCommand extends AbstractInlineChatAction { } override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void { - ctrl.feedbackLast(true); + ctrl.feedbackLast(InlineChatResponseFeedbackKind.Helpful); } } @@ -430,7 +430,7 @@ export class FeebackUnhelpfulCommand extends AbstractInlineChatAction { } override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void { - ctrl.feedbackLast(false); + ctrl.feedbackLast(InlineChatResponseFeedbackKind.Unhelpful); } } @@ -451,7 +451,7 @@ export class ReportIssueForUnhelpfulCommand extends AbstractInlineChatAction { } override runInlineChatCommand(_accessor: ServicesAccessor, ctrl: InlineChatController): void { - ctrl.feedbackLast(false, true); + ctrl.feedbackLast(InlineChatResponseFeedbackKind.Bug); } } diff --git a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts index 0a7bb41a179..94e0b13a410 100644 --- a/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts +++ b/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts @@ -968,11 +968,19 @@ export class InlineChatController implements IEditorContribution { } } - feedbackLast(helpful: boolean, reportIssue?: boolean) { + feedbackLast(kind: InlineChatResponseFeedbackKind) { if (this._activeSession?.lastExchange && this._activeSession.lastExchange.response instanceof ReplyResponse) { - const kind = helpful ? InlineChatResponseFeedbackKind.Helpful : InlineChatResponseFeedbackKind.Unhelpful; - this._activeSession.provider.handleInlineChatResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, kind, reportIssue); - this._ctxLastFeedbackKind.set(helpful ? 'helpful' : 'unhelpful'); + this._activeSession.provider.handleInlineChatResponseFeedback?.(this._activeSession.session, this._activeSession.lastExchange.response.raw, kind); + switch (kind) { + case InlineChatResponseFeedbackKind.Helpful: + this._ctxLastFeedbackKind.set('helpful'); + break; + case InlineChatResponseFeedbackKind.Unhelpful: + this._ctxLastFeedbackKind.set('unhelpful'); + break; + default: + break; + } this._zone.value.widget.updateStatus('Thank you for your feedback!', { resetAfter: 1250 }); } } diff --git a/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts b/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts index 3f14f2aa0f6..ef7c11146c4 100644 --- a/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts +++ b/src/vs/workbench/contrib/inlineChat/common/inlineChat.ts @@ -98,7 +98,8 @@ export const enum InlineChatResponseFeedbackKind { Unhelpful = 0, Helpful = 1, Undone = 2, - Accepted = 3 + Accepted = 3, + Bug = 4 } export interface IInlineChatSessionProvider { @@ -111,7 +112,7 @@ export interface IInlineChatSessionProvider { provideResponse(item: IInlineChatSession, request: IInlineChatRequest, progress: IProgress, token: CancellationToken): ProviderResult; - handleInlineChatResponseFeedback?(session: IInlineChatSession, response: IInlineChatResponse, kind: InlineChatResponseFeedbackKind, reportIssue?: boolean): void; + handleInlineChatResponseFeedback?(session: IInlineChatSession, response: IInlineChatResponse, kind: InlineChatResponseFeedbackKind): void; } export const IInlineChatService = createDecorator('IInlineChatService'); diff --git a/src/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts b/src/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts index 12b5f2230fc..1005628fe0c 100644 --- a/src/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts +++ b/src/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts @@ -7,14 +7,7 @@ declare module 'vscode' { export interface ChatAgentUserActionEvent { readonly result: ChatAgentResult2; - readonly action: InteractiveSessionCopyAction | InteractiveSessionInsertAction | InteractiveSessionTerminalAction | InteractiveSessionCommandAction | InteractiveSessionFollowupAction; - } - - export interface ChatAgentResult2Feedback { - /** - * Whether the user wants to report an issue. - */ - readonly reportIssue?: boolean; + readonly action: InteractiveSessionCopyAction | InteractiveSessionInsertAction | InteractiveSessionTerminalAction | InteractiveSessionCommandAction | InteractiveSessionFollowupAction | InteractiveSessionBugReportAction; } export interface ChatAgent2 { diff --git a/src/vscode-dts/vscode.proposed.interactive.d.ts b/src/vscode-dts/vscode.proposed.interactive.d.ts index f2f65366201..24a21507fc2 100644 --- a/src/vscode-dts/vscode.proposed.interactive.d.ts +++ b/src/vscode-dts/vscode.proposed.interactive.d.ts @@ -62,7 +62,8 @@ declare module 'vscode' { Unhelpful = 0, Helpful = 1, Undone = 2, - Accepted = 3 + Accepted = 3, + Bug = 4 } export interface TextDocumentContext { @@ -83,7 +84,7 @@ declare module 'vscode' { provideInteractiveEditorResponse(session: S, request: InteractiveEditorRequest, progress: Progress, token: CancellationToken): ProviderResult; // eslint-disable-next-line local/vscode-dts-provider-naming - handleInteractiveEditorResponseFeedback?(session: S, response: R, kind: InteractiveEditorResponseFeedbackKind, shouldReportIssue?: boolean): void; + handleInteractiveEditorResponseFeedback?(session: S, response: R, kind: InteractiveEditorResponseFeedbackKind): void; } export interface InteractiveSessionParticipantInformation { diff --git a/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts b/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts index 976651c2675..c4f89f80bbe 100644 --- a/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts +++ b/src/vscode-dts/vscode.proposed.interactiveUserActions.d.ts @@ -59,7 +59,12 @@ declare module 'vscode' { followup: InteractiveSessionReplyFollowup; } - export type InteractiveSessionUserAction = InteractiveSessionVoteAction | InteractiveSessionCopyAction | InteractiveSessionInsertAction | InteractiveSessionTerminalAction | InteractiveSessionCommandAction; + export interface InteractiveSessionBugReportAction { + // eslint-disable-next-line local/vscode-dts-string-type-literals + kind: 'bug'; + } + + export type InteractiveSessionUserAction = InteractiveSessionVoteAction | InteractiveSessionCopyAction | InteractiveSessionInsertAction | InteractiveSessionTerminalAction | InteractiveSessionCommandAction | InteractiveSessionBugReportAction; export interface InteractiveSessionUserActionEvent { action: InteractiveSessionUserAction;