Skip to content

Commit

Permalink
Drop usage of inline chat services in notebook chat. (#212935)
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed May 16, 2024
1 parent 1d44987 commit a48f464
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 345 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_LAST_RESPONSE_TYPE, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseFeedbackKind, InlineChatResponseTypes } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, MENU_CELL_CHAT_INPUT, MENU_CELL_CHAT_WIDGET, MENU_CELL_CHAT_WIDGET_FEEDBACK, MENU_CELL_CHAT_WIDGET_STATUS } from 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
import { CTX_INLINE_CHAT_FOCUSED, CTX_INLINE_CHAT_HAS_PROVIDER, CTX_INLINE_CHAT_INNER_CURSOR_FIRST, CTX_INLINE_CHAT_INNER_CURSOR_LAST, CTX_INLINE_CHAT_RESPONSE_TYPES, InlineChatResponseTypes } from 'vs/workbench/contrib/inlineChat/common/inlineChat';
import { CTX_NOTEBOOK_CELL_CHAT_FOCUSED, CTX_NOTEBOOK_CHAT_HAS_ACTIVE_REQUEST, CTX_NOTEBOOK_CHAT_OUTER_FOCUS_POSITION, CTX_NOTEBOOK_CHAT_USER_DID_EDIT, MENU_CELL_CHAT_INPUT, MENU_CELL_CHAT_WIDGET, MENU_CELL_CHAT_WIDGET_STATUS } from 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext';
import { NotebookChatController } from 'vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController';
import { CELL_TITLE_CELL_GROUP_ID, INotebookActionContext, INotebookCellActionContext, NotebookAction, NotebookCellAction, getEditorFromArgsOrActivePane } from 'vs/workbench/contrib/notebook/browser/controller/coreActions';
import { insertNewCell } from 'vs/workbench/contrib/notebook/browser/controller/insertCellActions';
Expand Down Expand Up @@ -299,69 +299,6 @@ registerAction2(class extends NotebookAction {
}
});

registerAction2(class extends NotebookAction {
constructor() {
super({
id: 'notebook.cell.feedbackHelpful',
title: localize('feedback.helpful', 'Helpful'),
icon: Codicon.thumbsup,
menu: {
id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
group: 'inline',
order: 1,
when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
},
f1: false
});
}

async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext) {
NotebookChatController.get(context.notebookEditor)?.feedbackLast(InlineChatResponseFeedbackKind.Helpful);
}
});

registerAction2(class extends NotebookAction {
constructor() {
super({
id: 'notebook.cell.feedbackUnhelpful',
title: localize('feedback.unhelpful', 'Unhelpful'),
icon: Codicon.thumbsdown,
menu: {
id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
group: 'inline',
order: 2,
when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
},
f1: false
});
}

async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext) {
NotebookChatController.get(context.notebookEditor)?.feedbackLast(InlineChatResponseFeedbackKind.Unhelpful);
}
});

registerAction2(class extends NotebookAction {
constructor() {
super({
id: 'notebook.cell.reportIssueForBug',
title: localize('feedback.reportIssueForBug', 'Report Issue'),
icon: Codicon.report,
menu: {
id: MENU_CELL_CHAT_WIDGET_FEEDBACK,
group: 'inline',
order: 3,
when: CTX_INLINE_CHAT_LAST_RESPONSE_TYPE.notEqualsTo(undefined),
},
f1: false
});
}

async runWithContext(accessor: ServicesAccessor, context: INotebookActionContext) {
NotebookChatController.get(context.notebookEditor)?.feedbackLast(InlineChatResponseFeedbackKind.Bug);
}
});

interface IInsertCellWithChatArgs extends INotebookActionContext {
input?: string;
autoSend?: boolean;
Expand Down

0 comments on commit a48f464

Please sign in to comment.