From f3b2c8092dabdac73684249d6ab1ffbb16b7ec56 Mon Sep 17 00:00:00 2001 From: "David L. Qiu" Date: Thu, 18 Jul 2024 11:26:55 -0700 Subject: [PATCH] remove include selection checkbox --- .../jupyter-ai/src/components/chat-input.tsx | 19 ------------------- packages/jupyter-ai/src/components/chat.tsx | 19 ++----------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/packages/jupyter-ai/src/components/chat-input.tsx b/packages/jupyter-ai/src/components/chat-input.tsx index 91b40cec9..870863370 100644 --- a/packages/jupyter-ai/src/components/chat-input.tsx +++ b/packages/jupyter-ai/src/components/chat-input.tsx @@ -6,9 +6,6 @@ import { SxProps, TextField, Theme, - FormGroup, - FormControlLabel, - Checkbox, InputAdornment, Typography } from '@mui/material'; @@ -32,10 +29,7 @@ type ChatInputProps = { value: string; onChange: (newValue: string) => unknown; onSend: (selection?: AiService.Selection) => unknown; - hasSelection: boolean; - includeSelection: boolean; focusInputSignal: ISignal; - toggleIncludeSelection: () => unknown; sendWithShiftEnter: boolean; sx?: SxProps; }; @@ -321,19 +315,6 @@ export function ChatInput(props: ChatInputProps): JSX.Element { /> )} /> - {props.hasSelection && ( - - - } - label="Include selection" - /> - - )} ); } diff --git a/packages/jupyter-ai/src/components/chat.tsx b/packages/jupyter-ai/src/components/chat.tsx index 45a9930eb..519a2702d 100644 --- a/packages/jupyter-ai/src/components/chat.tsx +++ b/packages/jupyter-ai/src/components/chat.tsx @@ -14,10 +14,7 @@ import { PendingMessages } from './pending-messages'; import { ChatInput } from './chat-input'; import { ChatSettings } from './chat-settings'; import { AiService } from '../handler'; -import { - SelectionContextProvider, - useSelectionContext -} from '../contexts/selection-context'; +import { SelectionContextProvider } from '../contexts/selection-context'; import { SelectionWatcher } from '../selection-watcher'; import { ChatHandler } from '../chat_handler'; import { CollaboratorsContextProvider } from '../contexts/collaborators-context'; @@ -48,9 +45,7 @@ function ChatBody({ AiService.PendingMessage[] >([...chatHandler.history.pending_messages]); const [showWelcomeMessage, setShowWelcomeMessage] = useState(false); - const [includeSelection, setIncludeSelection] = useState(true); const [input, setInput] = useState(''); - const [textSelection] = useSelectionContext(); const [sendWithShiftEnter, setSendWithShiftEnter] = useState(true); /** @@ -92,14 +87,9 @@ function ChatBody({ // handled by the listeners registered in the effect hooks above. // TODO: unify how text selection & cell selection are handled const onSend = async (selection?: AiService.Selection) => { + const prompt = input; setInput(''); - const prompt = - input + - (includeSelection && textSelection?.text - ? '\n\n```\n' + textSelection.text + '\n```' - : ''); - // send message to backend const messageId = await chatHandler.sendMessage({ prompt, selection }); @@ -152,12 +142,7 @@ function ChatBody({ value={input} onChange={setInput} onSend={onSend} - hasSelection={!!textSelection?.text} - includeSelection={includeSelection} focusInputSignal={focusInputSignal} - toggleIncludeSelection={() => - setIncludeSelection(includeSelection => !includeSelection) - } sx={{ paddingLeft: 4, paddingRight: 4,