Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

add send button for 'Generate with AI' (#6017)

Shahmir Varqhad53df7c5b27e
diff --git a/frontend/src/components/editor/ai/add-cell-with-ai.tsx b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
index 8a81f761f0..1b333d1834 100644
--- a/frontend/src/components/editor/ai/add-cell-with-ai.tsx
+++ b/frontend/src/components/editor/ai/add-cell-with-ai.tsx
@@ -18,7 +18,13 @@ import ReactCodeMirror, {
import { useCompletion } from "ai/react";
import { useAtom, useStore } from "jotai";
import { atomWithStorage } from "jotai/utils";
-import { ChevronsUpDown, Loader2Icon, SparklesIcon, XIcon } from "lucide-react";
+import {
+ ChevronsUpDown,
+ Loader2Icon,
+ SendHorizontal,
+ SparklesIcon,
+ XIcon,
+} from "lucide-react";
import { useMemo, useState } from "react";
import useEvent from "react-use-event-hook";
import { Button } from "@/components/ui/button";
@@ -97,6 +103,12 @@ export const AddCellWithAI: React.FC<{
},
});
+ const submit = () => {
+ if (!isLoading) {
+ handleSubmit();
+ }
+ };
+
const inputComponent = (
<div className="flex items-center px-3">
<SparklesIcon className="size-4 text-(--blue-11)" />
@@ -132,11 +144,7 @@ export const AddCellWithAI: React.FC<{
setInput(newValue);
setCompletionBody(getAICompletionBody({ input: newValue }));
}}
- onSubmit={() => {
- if (!isLoading) {
- handleSubmit();
- }
- }}
+ onSubmit={submit}
/>
{isLoading && (
<Button
@@ -173,6 +181,9 @@ export const AddCellWithAI: React.FC<{
<span className="text-(--grass-11) opacity-100">Accept</span>
</Button>
)}
+ <Button variant="text" size="sm" onClick={submit} title="Submit">
+ <SendHorizontal className="size-4" />
+ </Button>
<Button variant="text" size="sm" className="mb-0" onClick={onClose}>
<XIcon className="size-4" />
</Button>