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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
improvement: upload files, @-symbol for data, # for files in the Agent panel (#6389)
Myles Scolnickb60a99cc98b6
diff --git a/frontend/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap b/frontend/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snapindex b41a12f3df..7d544e8242 100644--- a/frontend/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap+++ b/frontend/src/components/chat/acp/__tests__/__snapshots__/prompt.test.ts.snap@@ -47,6 +47,7 @@ exports[`getAgentPrompt > should generate complete agent prompt with default fil- UI elements trigger updates when their values change without explicit callbacks- UI element values are accessed through \`.value\` attribute- You cannot access a UI element's value in the same cell where it's defined+ - Cells prefixed with an underscore (e.g. _my_var) are local to the cell and cannot be accessed by other cells## Best Practicesdiff --git a/frontend/src/components/chat/acp/__tests__/context-utils.test.ts b/frontend/src/components/chat/acp/__tests__/context-utils.test.tsnew file mode 100644index 0000000000..9618303f42--- /dev/null+++ b/frontend/src/components/chat/acp/__tests__/context-utils.test.ts@@ -0,0 +1,222 @@+/* Copyright 2024 Marimo. All rights reserved. */++import { beforeEach, describe, expect, it, type Mocked, vi } from "vitest";+import {+ convertFilesToResourceLinks,+ parseContextFromPrompt,+} from "../context-utils";++// Mock dependencies+vi.mock("@/utils/fileToBase64", () => ({+ blobToString: vi.fn(),+}));++vi.mock("@/core/ai/context/context", () => ({+ getAIContextRegistry: vi.fn(),+}));++vi.mock("@/core/state/jotai", () => ({+ store: {},+}));++vi.mock("@/utils/Logger", () => ({+ Logger: {+ error: vi.fn(),+ debug: vi.fn(),+ },+}));++import { getAIContextRegistry } from "@/core/ai/context/context";+import type {+ AIContextItem,+ AIContextRegistry,+ ContextLocatorId,+} from "@/core/ai/context/registry";+import { blobToString } from "@/utils/fileToBase64";++const CONTEXT_ID = "context1" as ContextLocatorId;++describe("convertFilesToResourceLinks", () => {+ beforeEach(() => {+ vi.clearAllMocks();+ });++ it("should convert files to resource links", async () => {+ const mockFile = new File(["content"], "test.txt", { type: "text/plain" });+ vi.mocked(blobToString).mockResolvedValue(+ "data:text/plain;base64,Y29udGVudA==",+ );++ const result = await convertFilesToResourceLinks([mockFile]);++ expect(result).toEqual([+ {+ type: "resource_link",+ uri: "data:text/plain;base64,Y29udGVudA==",+ mimeType: "text/plain",+ name: "test.txt",+ },+ ]);+ });++ it("should handle empty file array", async () => {+ const result = await convertFilesToResourceLinks([]);+ expect(result).toEqual([]);+ });++ it("should handle file conversion errors gracefully", async () => {+ const mockFile = new File(["content"], "test.txt", { type: "text/plain" });+ vi.mocked(blobToString).mockRejectedValue(new Error("Conversion failed"));++ const result = await convertFilesToResourceLinks([mockFile]);++ expect(result).toEqual([]);+ });++ it("should process multiple files", async () => {+ const file1 = new File(["content1"], "test1.txt", { type: "text/plain" });+ const file2 = new File(["content2"], "test2.txt", { type: "text/plain" });++ vi.mocked(blobToString)+ .mockResolvedValueOnce("data:text/plain;base64,Y29udGVudDE=")+ .mockResolvedValueOnce("data:text/plain;base64,Y29udGVudDI=");++ const result = await convertFilesToResourceLinks([file1, file2]);++ expect(result).toHaveLength(2);+ expect((result[0] as { name: string }).name).toBe("test1.txt");+ expect((result[1] as { name: string }).name).toBe("test2.txt");+ });+});++describe("parseContextFromPrompt", () => {+ const mockRegistry = {+ parseAllContextIds: vi.fn(),+ formatContextForAI: vi.fn(),+ getAttachmentsForContext: vi.fn(),+ } as unknown as Mocked<AIContextRegistry<AIContextItem>>;++ beforeEach(() => {+ vi.clearAllMocks();+ vi.mocked(getAIContextRegistry).mockReturnValue(mockRegistry);+ });++ it("should return empty blocks when no @ symbol in prompt", async () => {+ const result = await parseContextFromPrompt("simple prompt");++ expect(result).toEqual({+ contextBlocks: [],+ attachmentBlocks: [],+ });+ });++ it("should return empty blocks when no context IDs found", async () => {+ mockRegistry.parseAllContextIds.mockReturnValue([]);++ const result = await parseContextFromPrompt("prompt with @ but no context");++ expect(result).toEqual({+ contextBlocks: [],+ attachmentBlocks: [],+ });+ });++ it("should create context blocks when context IDs are found", async () => {+ mockRegistry.parseAllContextIds.mockReturnValue([CONTEXT_ID]);+ mockRegistry.formatContextForAI.mockReturnValue("formatted context");+ mockRegistry.getAttachmentsForContext.mockResolvedValue([]);++ const result = await parseContextFromPrompt("prompt with @context1");++ expect(result.contextBlocks).toHaveLength(1);+ expect(result.contextBlocks[0]).toEqual({+ type: "resource",+ resource: {+ uri: "context.md",+ mimeType: "text/markdown",+ text: "formatted context",+ },+ });+ expect(result.attachmentBlocks).toHaveLength(0);+ });++ it("should create attachment blocks when attachments are found", async () => {+ mockRegistry.parseAllContextIds.mockReturnValue([CONTEXT_ID]);+ mockRegistry.formatContextForAI.mockReturnValue("formatted context");+ mockRegistry.getAttachmentsForContext.mockResolvedValue([+ {+ type: "file",+ url: "http://example.com/file.pdf",+ mediaType: "application/pdf",+ filename: "file.pdf",+ },+ ]);++ const result = await parseContextFromPrompt("prompt with @context1");++ expect(result.contextBlocks).toHaveLength(1);+ expect(result.attachmentBlocks).toHaveLength(1);+ expect(result.attachmentBlocks[0]).toEqual({+ type: "resource_link",+ uri: "http://example.com/file.pdf",+ mimeType: "application/pdf",+ name: "file.pdf",+ });+ });++ it("should handle empty context string gracefully", async () => {+ mockRegistry.parseAllContextIds.mockReturnValue([CONTEXT_ID]);+ mockRegistry.formatContextForAI.mockReturnValue(" ");+ mockRegistry.getAttachmentsForContext.mockResolvedValue([]);++ const result = await parseContextFromPrompt("prompt with @context1");++ expect(result.contextBlocks).toHaveLength(0);+ expect(result.attachmentBlocks).toHaveLength(0);+ });++ it("should handle registry errors gracefully", async () => {+ vi.mocked(getAIContextRegistry).mockImplementation(() => {+ throw new Error("Registry error");+ });++ const result = await parseContextFromPrompt("prompt with @context1");++ expect(result).toEqual({+ contextBlocks: [],+ attachmentBlocks: [],+ });+ });++ it("should handle attachment errors gracefully", async () => {+ mockRegistry.parseAllContextIds.mockReturnValue([CONTEXT_ID]);+ mockRegistry.formatContextForAI.mockReturnValue("formatted context");+ mockRegistry.getAttachmentsForContext.mockRejectedValue(+ new Error("Attachment error"),+ );++ const result = await parseContextFromPrompt("prompt with @context1");++ expect(result.contextBlocks).toHaveLength(1);+ expect(result.attachmentBlocks).toHaveLength(0);+ });++ it("should use url as name when filename is not provided", async () => {+ mockRegistry.parseAllContextIds.mockReturnValue([CONTEXT_ID]);+ mockRegistry.formatContextForAI.mockReturnValue("formatted context");+ mockRegistry.getAttachmentsForContext.mockResolvedValue([+ {+ type: "file",+ url: "http://example.com/file.pdf",+ mediaType: "application/pdf",+ filename: undefined,+ },+ ]);++ const result = await parseContextFromPrompt("prompt with @context1");++ expect((result.attachmentBlocks[0] as { name: string }).name).toBe(+ "http://example.com/file.pdf",+ );+ });+});diff --git a/frontend/src/components/chat/acp/agent-panel.tsx b/frontend/src/components/chat/acp/agent-panel.tsxindex 5ec2417aa4..6d3fb67ef8 100644--- a/frontend/src/components/chat/acp/agent-panel.tsx+++ b/frontend/src/components/chat/acp/agent-panel.tsx@@ -3,8 +3,12 @@import { useAtom, useAtomValue } from "jotai";import { capitalize } from "lodash-es";import {+ AtSignIcon,BotMessageSquareIcon,+ PaperclipIcon,RefreshCwIcon,+ SendIcon,+ SquareIcon,StopCircleIcon,} from "lucide-react";import React, { memo, useEffect, useMemo, useRef, useState } from "react";@@ -21,6 +25,8 @@ import {import { PanelEmptyState } from "@/components/editor/chrome/panels/empty-state";import { Spinner } from "@/components/icons/spinner";import { Button } from "@/components/ui/button";+import { Input } from "@/components/ui/input";+import { Tooltip, TooltipProvider } from "@/components/ui/tooltip";import { cn } from "@/utils/cn";import { Logger } from "@/utils/Logger";import { AgentDocs } from "./agent-docs";@@ -38,10 +44,15 @@ import {import { AgentThread } from "./thread";import "./agent-panel.css";import type { Completion } from "@codemirror/autocomplete";+import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";import type {ContentBlock,RequestPermissionResponse,} from "@zed-industries/agent-client-protocol";+import {+ addContextCompletion,+ CONTEXT_TRIGGER,+} from "@/components/editor/ai/completion-utils";import {Select,SelectContent,@@ -56,6 +67,11 @@ import { filenameAtom } from "@/core/saving/file-state";import { store } from "@/core/state/jotai";import { Functions } from "@/utils/functions";import { Paths } from "@/utils/paths";+import { FileAttachmentPill } from "../chat-components";+import {+ convertFilesToResourceLinks,+ parseContextFromPrompt,+} from "./context-utils";import { getAgentPrompt } from "./prompt";import type {AgentConnectionState,@@ -68,6 +84,9 @@ import type {const logger = Logger.get("agents");+// File attachment constants+const SUPPORTED_ATTACHMENT_TYPES = ["image/*", "text/*"];+interface AgentTitleProps {currentAgentId?: ExternalAgentId;}@@ -274,6 +293,11 @@ interface PromptAreaProps {commands: AvailableCommands | undefined;onPromptValueChange: (value: string) => void;onPromptSubmit: (e: KeyboardEvent | undefined, prompt: string) => void;+ onAddFiles: (files: File[]) => void;+ onStop: () => void;+ fileInputRef: React.RefObject<HTMLInputElement | null>;+ sessionMode?: SessionMode;+ onModeChange?: (mode: string) => void;}const PromptArea = memo<PromptAreaProps>(@@ -284,7 +308,13 @@ const PromptArea = memo<PromptAreaProps>(commands,onPromptValueChange,onPromptSubmit,+ onAddFiles,+ onStop,+ fileInputRef,+ sessionMode,+ onModeChange,}) => {+ const inputRef = useRef<ReactCodeMirrorRef | null>(null);const promptCompletions: AdditionalCompletions | undefined = useMemo(() => {if (!commands) {return undefined;@@ -301,23 +331,101 @@ const PromptArea = memo<PromptAreaProps>(};}, [commands]);+ const handleSendClick = useEvent(() => {+ if (promptValue.trim()) {+ onPromptSubmit(undefined, promptValue);+ }+ });++ const handleAddContext = useEvent(() => {+ // For now, just append @ to the current value+ addContextCompletion(inputRef);+ });+return (- <div- className={cn(- "px-3 py-2 border-t bg-background flex-shrink-0 min-h-[80px]",- (isLoading || !activeSessionId) && "opacity-50 pointer-events-none",- )}- >- <PromptInput- value={promptValue}- onChange={isLoading ? Functions.NOOP : onPromptValueChange}- onSubmit={onPromptSubmit}- additionalCompletions={promptCompletions}- onClose={Functions.NOOP}- placeholder={isLoading ? "Processing..." : "Ask your AI agent..."}- className={isLoading ? "opacity-50 pointer-events-none" : ""}- maxHeight="120px"- />+ <div className="border-t bg-background flex-shrink-0">+ <div+ className={cn(+ "px-3 py-2 min-h-[80px]",+ (isLoading || !activeSessionId) && "opacity-50 pointer-events-none",+ )}+ >+ <PromptInput+ inputRef={inputRef}+ value={promptValue}+ onChange={isLoading ? Functions.NOOP : onPromptValueChange}+ onSubmit={onPromptSubmit}+ additionalCompletions={promptCompletions}+ onClose={Functions.NOOP}+ onAddFiles={onAddFiles}+ placeholder={+ isLoading+ ? "Processing..."+ : `Ask anything, ${CONTEXT_TRIGGER} to include context about tables or dataframes`+ }+ className={isLoading ? "opacity-50 pointer-events-none" : ""}+ maxHeight="120px"+ />+ </div>+ <TooltipProvider>+ <div className="px-3 py-2 border-t border-border/20 flex flex-row items-center justify-between">+ <div className="flex items-center gap-2">+ {sessionMode && onModeChange && (+ <ModeSelector+ sessionMode={sessionMode}+ onModeChange={onModeChange}+ />+ )}+ </div>+ <div className="flex flex-row">+ <Tooltip content="Add context">+ <Button variant="text" size="icon" onClick={handleAddContext}>+ <AtSignIcon className="h-3.5 w-3.5" />+ </Button>+ </Tooltip>+ <>+ <Tooltip content="Attach a file">+ <Button+ variant="text"+ size="icon"+ className="cursor-pointer"+ onClick={() => fileInputRef.current?.click()}+ title="Attach a file"+ >+ <PaperclipIcon className="h-3.5 w-3.5" />+ </Button>+ </Tooltip>+ <Input+ ref={fileInputRef}+ type="file"+ multiple={true}+ hidden={true}+ onChange={(event) => {+ if (event.target.files) {+ onAddFiles([...event.target.files]);+ }+ }}+ accept={SUPPORTED_ATTACHMENT_TYPES.join(",")}+ />+ </>+ <Tooltip content={isLoading ? "Stop" : "Submit"}>+ <Button+ variant="text"+ size="sm"+ className="h-6 w-6 p-0 hover:bg-muted/30 cursor-pointer"+ onClick={isLoading ? onStop : handleSendClick}+ disabled={isLoading ? false : !promptValue.trim()}+ >+ {isLoading ? (+ <SquareIcon className="h-3 w-3 fill-current" />+ ) : (+ <SendIcon className="h-3 w-3" />+ )}+ </Button>+ </Tooltip>+ </div>+ </div>+ </TooltipProvider></div>);},@@ -378,6 +486,7 @@ ModeSelector.displayName = "ModeSelector";interface ChatContentProps {hasNotifications: boolean;+ agentId: ExternalAgentId | undefined;connectionState: AgentConnectionState;sessionId: ExternalAgentSessionId | null;notifications: NotificationEvent[];@@ -391,6 +500,7 @@ interface ChatContentProps {const ChatContent = memo<ChatContentProps>(({hasNotifications,+ agentId,connectionState,notifications,pendingPermission,@@ -402,6 +512,7 @@ const ChatContent = memo<ChatContentProps>(}) => {const [isScrolledToBottom, setIsScrolledToBottom] = useState(true);const scrollContainerRef = useRef<HTMLDivElement>(null);+ const isDisconnected = connectionState.status === "disconnected";// Scroll handler to determine if we're at the bottom of the chatconst handleScroll = useEvent(() => {@@ -471,12 +582,30 @@ const ChatContent = memo<ChatContentProps>(/></div>) : (- <div className="flex items-center justify-center h-full min-h-[200px]">+ <div className="flex items-center justify-center h-full min-h-[200px] flex-col"><PanelEmptyStatetitle="Waiting for agent"description="Your AI agent will appear here when active"icon={<BotMessageSquareIcon />}/>+ {isDisconnected && agentId && (+ <AgentDocs+ className="border-t pt-6 px-5"+ title="Make sure you're connected to an agent"+ description="Run this command in your terminal:"+ agents={[agentId]}+ />+ )}+ {isDisconnected && (+ <Button+ variant="outline"+ onClick={onRetryConnection}+ type="button"+ className="mt-4"+ >+ Retry+ </Button>+ )}</div>)}</div>@@ -504,6 +633,8 @@ function getCwd() {const AgentPanel: React.FC = () => {const [isLoading, setIsLoading] = useState(false);const [promptValue, setPromptValue] = useState("");+ const [files, setFiles] = useState<File[]>();+ const fileInputRef = useRef<HTMLInputElement>(null);const [selectedTab] = useAtom(selectedTabAtom);const [sessionState, setSessionState] = useAtom(agentSessionStateAtom);@@ -691,6 +822,7 @@ const AgentPanel: React.FC = () => {});setIsLoading(true);setPromptValue("");+ setFiles(undefined);// Update session title with first message if it's still the defaultif (selectedTab?.title.startsWith("New ")) {@@ -708,6 +840,19 @@ const AgentPanel: React.FC = () => {}const promptBlocks: ContentBlock[] = [{ type: "text", text: prompt }];++ // Parse context from the prompt+ const { contextBlocks, attachmentBlocks } =+ await parseContextFromPrompt(prompt);+ promptBlocks.push(...contextBlocks);+ promptBlocks.push(...attachmentBlocks);++ // Add manually uploaded files as resource links+ if (files && files.length > 0) {+ const fileResourceLinks = await convertFilesToResourceLinks(files);+ promptBlocks.push(...fileResourceLinks);+ }+const hasGivenRules = notifications.some((notification) =>notification.type === "session_notification" &&@@ -754,6 +899,21 @@ const AgentPanel: React.FC = () => {setIsLoading(false);});+ // Handler for adding files+ const handleAddFiles = useEvent((newFiles: File[]) => {+ if (newFiles.length === 0) {+ return;+ }+ setFiles((prev) => [...(prev ?? []), ...newFiles]);+ });++ // Handler for removing files+ const handleRemoveFile = useEvent((fileToRemove: File) => {+ if (files) {+ setFiles(files.filter((f) => f !== fileToRemove));+ }+ });+// Handler for manual connectconst handleManualConnect = useEvent(() => {logger.debug("Manual connect requested", {@@ -826,6 +986,7 @@ const AgentPanel: React.FC = () => {<SessionTabs /><ChatContent+ agentId={selectedTab?.agentId}sessionId={activeSessionId}hasNotifications={hasNotifications}connectionState={connectionState}@@ -847,23 +1008,31 @@ const AgentPanel: React.FC = () => {onStop={handleStop}/>+ {files && files.length > 0 && (+ <div className="flex flex-row gap-1 flex-wrap p-3 border-t">+ {files.map((file) => (+ <FileAttachmentPill+ file={file}+ key={file.name}+ onRemove={() => handleRemoveFile(file)}+ />+ ))}+ </div>+ )}+<PromptAreaisLoading={isLoading}activeSessionId={activeSessionId}promptValue={promptValue}onPromptValueChange={setPromptValue}onPromptSubmit={handlePromptSubmit}+ onAddFiles={handleAddFiles}+ onStop={handleStop}+ fileInputRef={fileInputRef}commands={availableCommands}+ sessionMode={sessionMode}+ onModeChange={handleModeChange}/>-- {sessionMode && (- <div className="px-3 py-2 border-t flex-shrink-0 h-10">- <ModeSelector- sessionMode={sessionMode}- onModeChange={handleModeChange}- />- </div>- )}</div>);};diff --git a/frontend/src/components/chat/acp/context-utils.ts b/frontend/src/components/chat/acp/context-utils.tsnew file mode 100644index 0000000000..9b9a6d2283--- /dev/null+++ b/frontend/src/components/chat/acp/context-utils.ts@@ -0,0 +1,127 @@+/* Copyright 2024 Marimo. All rights reserved. */++import type { ContentBlock } from "@zed-industries/agent-client-protocol";+import type { FileUIPart } from "ai";+import { getAIContextRegistry } from "@/core/ai/context/context";+import { store } from "@/core/state/jotai";+import { blobToString } from "@/utils/fileToBase64";+import { Logger } from "@/utils/Logger";++export interface ContextParseResult {+ contextBlocks: ContentBlock[];+ attachmentBlocks: ContentBlock[];+}++/**+ * Converts File objects to agent protocol resource_link content blocks+ */+export async function convertFilesToResourceLinks(+ files: File[],+): Promise<ContentBlock[]> {+ const resourceLinks: ContentBlock[] = [];++ for (const file of files) {+ try {+ const dataUrl = await blobToString(file, "dataUrl");+ resourceLinks.push({+ type: "resource_link",+ uri: dataUrl,+ mimeType: file.type,+ name: file.name,+ });+ } catch (error) {+ Logger.error("Error converting file to resource link", {+ fileName: file.name,+ error,+ });+ }+ }++ return resourceLinks;+}++/**+ * Converts AI context registry attachments to agent protocol resource_link content blocks+ */+async function convertAiAttachmentsToResourceLinks(+ attachments: FileUIPart[],+): Promise<ContentBlock[]> {+ const resourceLinks: ContentBlock[] = [];++ for (const attachment of attachments) {+ resourceLinks.push({+ type: "resource_link",+ uri: attachment.url,+ mimeType: attachment.mediaType,+ name: attachment.filename ?? attachment.url,+ });+ }++ return resourceLinks;+}++/**+ * Parses context from the prompt value and returns content blocks for agent prompts.+ * Extracts context references using @ notation and converts them to resource blocks.+ * Also handles attachments from the AI context registry.+ */+export async function parseContextFromPrompt(+ promptValue: string,+): Promise<ContextParseResult> {+ const contextBlocks: ContentBlock[] = [];+ const attachmentBlocks: ContentBlock[] = [];++ // Skip if no '@' in the input+ if (!promptValue.includes("@")) {+ return { contextBlocks, attachmentBlocks };+ }++ try {+ const registry = getAIContextRegistry(store);+ const contextIds = registry.parseAllContextIds(promptValue);++ if (contextIds.length === 0) {+ return { contextBlocks, attachmentBlocks };+ }++ // Get context string for the registry+ const contextString = registry.formatContextForAI(contextIds);++ if (contextString.trim()) {+ // Create a resource block with the context information+ contextBlocks.push({+ type: "resource",+ resource: {+ uri: "context.md",+ mimeType: "text/markdown",+ text: contextString,+ },+ });+ }++ // Get attachments from the AI context registry+ try {+ const aiAttachments = await registry.getAttachmentsForContext(contextIds);+ if (aiAttachments.length > 0) {+ const resourceLinks =+ await convertAiAttachmentsToResourceLinks(aiAttachments);+ attachmentBlocks.push(...resourceLinks);+ Logger.debug("Added AI context attachments", {+ count: aiAttachments.length,+ });+ }+ } catch (error) {+ Logger.error("Error getting AI context attachments", { error });+ }++ Logger.debug("Parsed context for agent", {+ contextIds,+ contextLength: contextString.length,+ attachmentCount: attachmentBlocks.length,+ });+ } catch (error) {+ Logger.error("Error parsing context for agent", { error });+ }++ return { contextBlocks, attachmentBlocks };+}diff --git a/frontend/src/components/chat/acp/prompt.ts b/frontend/src/components/chat/acp/prompt.tsindex f9c4718f94..2f257d18a4 100644--- a/frontend/src/components/chat/acp/prompt.ts+++ b/frontend/src/components/chat/acp/prompt.ts@@ -47,6 +47,7 @@ export function getAgentPrompt(filename: string) {- UI elements trigger updates when their values change without explicit callbacks- UI element values are accessed through \`.value\` attribute- You cannot access a UI element's value in the same cell where it's defined+ - Cells prefixed with an underscore (e.g. _my_var) are local to the cell and cannot be accessed by other cells## Best Practicesdiff --git a/frontend/src/components/chat/chat-panel.tsx b/frontend/src/components/chat/chat-panel.tsxindex da7de0a636..951b5218a8 100644--- a/frontend/src/components/chat/chat-panel.tsx+++ b/frontend/src/components/chat/chat-panel.tsx@@ -430,7 +430,7 @@ const ChatInputFooter: React.FC<ChatInputFooterProps> = memo(</>)}- <Tooltip content="Submit">+ <Tooltip content={isLoading ? "Stop" : "Submit"}><Buttonvariant="text"size="sm"