Skip to content

Conversation

@m-rgba
Copy link
Contributor

@m-rgba m-rgba commented Jan 5, 2026

📝 Summary

Before After
image image

Looking to make the "Generate cell with AI" input area consistent with the AI chat sidebar.

  • Brings over "Add context" and "Attach file" buttons to the "Generate cell with AI" area.
  • Moves instruction text into placeholder (adds a min-height to the editor to avoid banding when the user starts typing).
  • Shifts the model selector and language to the left to have consistent placement.
  • Updated the AI sparkles and close button to be pinned as the top row.

@vercel
Copy link

vercel bot commented Jan 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 5, 2026 8:49pm

@github-actions
Copy link

github-actions bot commented Jan 5, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Comment on lines +77 to +83
const PROVIDERS_THAT_SUPPORT_ATTACHMENTS = new Set([
"openai",
"google",
"anthropic",
] as const);
const SUPPORTED_ATTACHMENT_TYPES = ["image/*", "text/*"];
const MAX_ATTACHMENT_SIZE = 1024 * 1024 * 50; // 50MB
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we can import this from ChatPanel instead of redeclaring

placeholder={
placeholder || `Generate with AI, ${CONTEXT_TRIGGER} to include context`
placeholder ||
`Generate with AI, ${CONTEXT_TRIGGER} to include context about tables or dataframes.\nCode from other cells is automatically included. `
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`Generate with AI, ${CONTEXT_TRIGGER} to include context about tables or dataframes.\nCode from other cells is automatically included. `
`Generate with AI, ${CONTEXT_TRIGGER} to include context`

</>
)}
<Tooltip content={isLoading ? "Stop" : "Submit"}>
<Button
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer the send button to be next to the prompt input, but open to change. I know it differs from the chat panel

</DropdownMenuTrigger>
<DropdownMenuContent align="center">
<div className="px-2 py-1 font-semibold">Select language</div>
<div className="px-2 py-1 font-semibold">Generate</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<div className="px-2 py-1 font-semibold">Generate</div>
<div className="px-2 py-1 text-sm text-muted-foreground">Generate</div>

Comment on lines +244 to +267
const onAddFiles = useEvent((newFiles: File[]) => {
if (newFiles.length === 0) {
return;
}

let fileSize = 0;
for (const file of newFiles) {
fileSize += file.size;
}

if (fileSize > MAX_ATTACHMENT_SIZE) {
toast({
title: "File size exceeds 50MB limit",
variant: "danger",
});
return;
}

setFiles((prev) => [...(prev ?? []), ...newFiles]);
});

const removeFile = (fileToRemove: File) => {
setFiles((prev) => prev?.filter((f) => f !== fileToRemove));
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can extract this logic out to a hook to be reused by chatPanel & this

export function useFileState() {
  const [files, setFiles] = useState<File[]>([]);

  const onAddFiles = useEvent((newFiles: File[]) => {
    if (newFiles.length === 0) {
      return;
    }

    let fileSize = 0;
    for (const file of newFiles) {
      fileSize += file.size;
    }

    if (fileSize > MAX_ATTACHMENT_SIZE) {
      toast({
        title: "File size exceeds 50MB limit",
        variant: "danger",
      });
      return;
    }

    setFiles((prev) => [...(prev ?? []), ...newFiles]);
  });

  const removeFile = (fileToRemove: File) => {
    setFiles((prev) => prev?.filter((f) => f !== fileToRemove));
  };

  return { files, setFiles, onAddFiles, removeFile };
}

);

// Determine if provider supports attachments
const currentModel = ai?.models?.chat_model || DEFAULT_AI_MODEL;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const currentModel = ai?.models?.chat_model || DEFAULT_AI_MODEL;
const currentModel = ai?.models?.edit_model || DEFAULT_AI_MODEL;

/>
</div>
</div>
{filesPills}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you think about putting the filesPills left of the @ symbol

Image

@Light2Dark Light2Dark added the enhancement New feature or request label Jan 15, 2026
@Light2Dark
Copy link
Contributor

Light2Dark commented Jan 15, 2026

Hey @m-rgba , would you mind signing the CLA

Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.

I have read the CLA Document and I hereby sign the CLA

You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants