Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions frontend/src/components/app-config/ai-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
BotIcon,
BrainIcon,
ChevronRightIcon,
InfoIcon,
PlusIcon,
Trash2Icon,
} from "lucide-react";
Expand Down Expand Up @@ -61,6 +62,7 @@ import {
} from "../ui/accordion";
import { Button } from "../ui/button";
import { Checkbox } from "../ui/checkbox";
import { DropdownMenuSeparator } from "../ui/dropdown-menu";
import { Label } from "../ui/label";
import { ExternalLink } from "../ui/links";
import {
Expand Down Expand Up @@ -272,6 +274,32 @@ export const ModelSelector: React.FC<ModelSelectorProps> = ({
placeholder={placeholder}
onSelect={selectModel}
triggerClassName="text-sm"
customDropdownContent={
Copy link
Contributor Author

@Light2Dark Light2Dark Jan 29, 2026

Choose a reason for hiding this comment

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

this was removed in https://github.com/marimo-team/marimo/pull/7979/changes
but adding it back here for backwards compatibility UX. Users may use this & legacy Open-AI compatible provider. There would be added friction if this is removed (they need to create new model on the Models page).

<>
<DropdownMenuSeparator />
<p className="px-2 py-1.5 text-sm text-muted-secondary flex items-center gap-1">
Enter a custom model
<Tooltip content="Models should include the provider prefix, e.g. 'openai/gpt-4o'">
<InfoIcon className="h-3 w-3" />
</Tooltip>
</p>
<div className="px-2 py-1">
<Input
className="w-full border-border shadow-none focus-visible:shadow-xs"
placeholder={placeholder}
{...field}
value={asStringOrEmpty(field.value)}
onKeyDown={Events.stopPropagation()}
/>
{value && (
<IncorrectModelId
value={value}
includeSuggestion={false}
/>
)}
</div>
</>
}
forRole={forRole}
/>
</FormControl>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/chat/chat-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ const ChatPanel = () => {
return (
<PanelEmptyState
title="Chat with AI"
description="No AI provider configured or model selected"
description="No AI provider configured or Chat model not selected"
action={
<Button
variant="outline"
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/editor/ai/add-cell-with-ai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export const AddCellWithAI: React.FC<{
triggerClassName="h-7 text-xs max-w-64"
iconSize="small"
forRole="edit"
showAddCustomModelDocs={true}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
// Use complete to pass the prompt directly, else input might be empty
complete(initialPrompt);
}
// eslint-disable-next-line react-hooks/exhaustive-deps

Check warning on line 157 in frontend/src/components/editor/ai/ai-completion-editor.tsx

View workflow job for this annotation

GitHub Actions / 🧹 Lint frontend

React Compiler has skipped optimizing this component because one or more React ESLint rules were disabled. React Compiler only works when your components follow all the rules of React, disabling them may result in unexpected or incorrect behavior
}, [triggerImmediately]);

// Focus the input
Expand Down Expand Up @@ -363,6 +363,7 @@
iconSize="small"
forRole="edit"
displayIconOnly={true}
placeholder="Edit model"
/>
</div>
{completion && (
Expand Down
14 changes: 11 additions & 3 deletions frontend/src/components/editor/renderers/cell-array.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
SquareMIcon,
} from "lucide-react";
import { useEffect } from "react";
import { useOpenSettingsToTab } from "@/components/app-config/state";
import { StartupLogsAlert } from "@/components/editor/alerts/startup-logs-alert";
import { Cell } from "@/components/editor/notebook-cell";
import { PackageAlert } from "@/components/editor/package-alert";
Expand Down Expand Up @@ -253,6 +254,7 @@ const AddCellButtons: React.FC<{
const [isAiButtonOpen, isAiButtonOpenActions] = useBoolean(false);
const aiEnabled = useAtomValue(aiEnabledAtom);
const canInteractWithApp = useAtomValue(canInteractWithAppAtom);
const { handleClick } = useOpenSettingsToTab();

const buttonClass = cn(
"mb-0 rounded-none sm:px-4 md:px-5 lg:px-8 tracking-wide no-wrap whitespace-nowrap",
Expand Down Expand Up @@ -320,7 +322,9 @@ const AddCellButtons: React.FC<{
</Button>
<Tooltip
content={
aiEnabled ? null : <span>Enable via settings under AI Assist</span>
aiEnabled ? null : (
<span>AI provider not found or Edit model not selected</span>
)
}
delayDuration={100}
asChild={false}
Expand All @@ -329,8 +333,12 @@ const AddCellButtons: React.FC<{
className={buttonClass}
variant="text"
size="sm"
disabled={!aiEnabled || !canInteractWithApp}
onClick={isAiButtonOpenActions.toggle}
disabled={!canInteractWithApp}
onClick={
aiEnabled
? isAiButtonOpenActions.toggle
: () => handleClick("ai", "ai-providers")
}
>
<SparklesIcon className="mr-2 size-4 shrink-0" />
Generate with AI
Expand Down
Loading