refactor(webui): open models directly for first-run setup
This commit is contained in:
1 parent
1c1f746903
commit
05100b70ad
22 files changed
+75
-627
No files matched your search
@@ -31,12 +31,10 @@ import { ChannelsSettings } from "@/components/settings/system/ChannelsSettings"
|
||||
import { RuntimeSettings } from "@/components/settings/system/RuntimeSettings";
|
||||
import type { SettingsController } from "@/components/settings/useSettingsController";
|
||||
import type { SkillSummary } from "@/lib/types";
|
||||
import type { ModelSetupIntent } from "@/lib/model-setup";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
interface SettingsPageProps {
|
||||
controller: SettingsController;
|
||||
modelSetupIntent: ModelSetupIntent | null;
|
||||
theme: "light" | "dark";
|
||||
showSidebar: boolean;
|
||||
onToggleTheme: () => void;
|
||||
@@ -49,7 +47,6 @@ interface SettingsPageProps {
|
||||
|
||||
export function SettingsPage({
|
||||
controller,
|
||||
modelSetupIntent,
|
||||
theme,
|
||||
showSidebar,
|
||||
onToggleTheme,
|
||||
@@ -286,7 +283,6 @@ export function SettingsPage({
|
||||
providerSaving={providerSaving}
|
||||
showBrandLogos={localPrefs.brandLogos}
|
||||
remoteBrowserAccess={remoteBrowserAccess}
|
||||
setupIntent={modelSetupIntent}
|
||||
onToggleProvider={handleToggleProvider}
|
||||
onToggleProviderKey={toggleProviderKeyVisibility}
|
||||
onToggleProviderKeyEditing={toggleProviderKeyEditing}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { SettingsPage } from "@/components/settings/SettingsPage";
|
||||
import type { SettingsSectionKey } from "@/components/settings/contracts";
|
||||
import { useSettingsController } from "@/components/settings/useSettingsController";
|
||||
import type { ModelSetupIntent } from "@/lib/model-setup";
|
||||
import type { SettingsPayload, SkillSummary } from "@/lib/types";
|
||||
|
||||
export type { SettingsSectionKey } from "@/components/settings/contracts";
|
||||
@@ -10,7 +9,6 @@ interface SettingsViewProps {
|
||||
theme: "light" | "dark";
|
||||
initialSection?: SettingsSectionKey;
|
||||
initialSettings?: SettingsPayload | null;
|
||||
modelSetupIntent?: ModelSetupIntent | null;
|
||||
showSidebar?: boolean;
|
||||
onToggleTheme: () => void;
|
||||
onBackToChat: () => void;
|
||||
@@ -29,7 +27,6 @@ export function SettingsView({
|
||||
theme,
|
||||
initialSection = "overview",
|
||||
initialSettings = null,
|
||||
modelSetupIntent = null,
|
||||
showSidebar = true,
|
||||
onToggleTheme,
|
||||
onBackToChat,
|
||||
@@ -56,7 +53,6 @@ export function SettingsView({
|
||||
return (
|
||||
<SettingsPage
|
||||
controller={controller}
|
||||
modelSetupIntent={modelSetupIntent}
|
||||
theme={theme}
|
||||
showSidebar={showSidebar}
|
||||
onToggleTheme={onToggleTheme}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";
|
||||
import { useMemo, useState, type ReactNode } from "react";
|
||||
import {
|
||||
ChevronDown,
|
||||
Clipboard,
|
||||
@@ -42,10 +42,6 @@ import { Input } from "@/components/ui/input";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { providerBrand } from "@/lib/provider-brand";
|
||||
import {
|
||||
providerMatchesModelSetupIntent,
|
||||
type ModelSetupIntent,
|
||||
} from "@/lib/model-setup";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type {
|
||||
NanobotFeaturesPayload,
|
||||
@@ -236,17 +232,12 @@ const OPENAI_API_TYPE_OPTIONS: Array<{ value: ProviderApiType; label: string }>
|
||||
{ value: "responses", label: "Responses" },
|
||||
];
|
||||
|
||||
const LOCAL_PROVIDER_ORDER = new Map(
|
||||
const LOCAL_UNCONFIGURED_PROVIDER_ORDER = new Map(
|
||||
["vllm", "ollama", "lm_studio", "atomic_chat", "ovms"].map((name, index) => [
|
||||
name,
|
||||
index,
|
||||
]),
|
||||
);
|
||||
const MODEL_SETUP_TITLE_KEYS: Record<ModelSetupIntent, string> = {
|
||||
account: "thread.composer.modelSetup.account.title",
|
||||
apiKey: "thread.composer.modelSetup.apiKey.title",
|
||||
local: "thread.composer.modelSetup.local.title",
|
||||
};
|
||||
|
||||
export function ProviderOAuthLoginDialog({
|
||||
flow,
|
||||
@@ -664,7 +655,6 @@ export function ProvidersSettings({
|
||||
providerSaving,
|
||||
showBrandLogos,
|
||||
remoteBrowserAccess,
|
||||
setupIntent,
|
||||
onToggleProvider,
|
||||
onToggleProviderKey,
|
||||
onToggleProviderKeyEditing,
|
||||
@@ -688,7 +678,6 @@ export function ProvidersSettings({
|
||||
providerSaving: string | null;
|
||||
showBrandLogos: boolean;
|
||||
remoteBrowserAccess: boolean;
|
||||
setupIntent?: ModelSetupIntent | null;
|
||||
onToggleProvider: (provider: string) => void;
|
||||
onToggleProviderKey: (provider: string) => void;
|
||||
onToggleProviderKeyEditing: (provider: string) => void;
|
||||
@@ -708,57 +697,23 @@ export function ProvidersSettings({
|
||||
const [customProviderDraft, setCustomProviderDraft] = useState<CustomProviderDraft>(
|
||||
emptyCustomProviderDraft,
|
||||
);
|
||||
const sectionRef = useRef<HTMLElement>(null);
|
||||
const [setupPickerOpen, setSetupPickerOpen] = useState(false);
|
||||
const configuredProviders = settings.providers.filter((provider) => provider.configured);
|
||||
const unconfiguredProviders = useMemo(
|
||||
() =>
|
||||
orderProviderPickerOptions(
|
||||
orderUnconfiguredProviders(
|
||||
settings.providers.filter(
|
||||
(provider) => !provider.configured && provider.name !== "custom",
|
||||
),
|
||||
),
|
||||
[settings.providers],
|
||||
);
|
||||
const providerPickerOptions = useMemo(
|
||||
() => setupIntent
|
||||
? orderProviderPickerOptions(
|
||||
settings.providers.filter(
|
||||
(provider) =>
|
||||
provider.name !== "custom"
|
||||
&& providerMatchesModelSetupIntent(provider, setupIntent),
|
||||
),
|
||||
)
|
||||
: unconfiguredProviders,
|
||||
[settings.providers, setupIntent, unconfiguredProviders],
|
||||
);
|
||||
const selectedUnconfiguredProvider =
|
||||
unconfiguredProviders.find((provider) => provider.name === expandedProvider) ?? null;
|
||||
const customProviderSaving = providerSaving === CUSTOM_PROVIDER_CREATION_KEY;
|
||||
useEffect(() => {
|
||||
if (!setupIntent) {
|
||||
setSetupPickerOpen(false);
|
||||
return;
|
||||
}
|
||||
const frame = window.requestAnimationFrame(() => {
|
||||
sectionRef.current?.scrollIntoView?.({ block: "start" });
|
||||
setSetupPickerOpen(true);
|
||||
});
|
||||
return () => window.cancelAnimationFrame(frame);
|
||||
}, [setupIntent]);
|
||||
const toggleProvider = (providerName: string) => {
|
||||
setCreatingCustomProvider(false);
|
||||
onToggleProvider(providerName);
|
||||
};
|
||||
const chooseProvider = (providerName: string) => {
|
||||
setCreatingCustomProvider(false);
|
||||
if (expandedProvider !== providerName) onToggleProvider(providerName);
|
||||
window.requestAnimationFrame(() => {
|
||||
document.getElementById(`settings-provider-${providerName}`)?.scrollIntoView?.({
|
||||
block: "start",
|
||||
});
|
||||
});
|
||||
};
|
||||
const beginCustomProviderCreation = () => {
|
||||
if (expandedProvider) onToggleProvider(expandedProvider);
|
||||
setCustomProviderDraft(emptyCustomProviderDraft());
|
||||
@@ -821,11 +776,7 @@ export function ProvidersSettings({
|
||||
? (nanobotFeatures?.features ?? []).find((feature) => feature.name === supportName)
|
||||
: null;
|
||||
return (
|
||||
<div
|
||||
key={provider.name}
|
||||
id={`settings-provider-${provider.name}`}
|
||||
className="divide-y divide-border/45"
|
||||
>
|
||||
<div key={provider.name} className="divide-y divide-border/45">
|
||||
<button
|
||||
type="button"
|
||||
aria-expanded={expanded}
|
||||
@@ -1271,7 +1222,7 @@ export function ProvidersSettings({
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<section ref={sectionRef}>
|
||||
<section>
|
||||
<SettingsSectionTitle>
|
||||
{tx("settings.providers.title", "Model providers")}
|
||||
</SettingsSectionTitle>
|
||||
@@ -1282,12 +1233,7 @@ export function ProvidersSettings({
|
||||
: null}
|
||||
{customProviderForm}
|
||||
{!expandedProvider && !creatingCustomProvider ? (
|
||||
<DropdownMenu
|
||||
modal={false}
|
||||
{...(setupIntent
|
||||
? { open: setupPickerOpen, onOpenChange: setSetupPickerOpen }
|
||||
: {})}
|
||||
>
|
||||
<DropdownMenu modal={false}>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button
|
||||
type="button"
|
||||
@@ -1298,12 +1244,10 @@ export function ProvidersSettings({
|
||||
<Plus className="h-5 w-5" aria-hidden />
|
||||
</span>
|
||||
<span className="truncate text-[15px] font-semibold text-foreground">
|
||||
{setupIntent
|
||||
? t(MODEL_SETUP_TITLE_KEYS[setupIntent])
|
||||
: tx(
|
||||
"settings.providers.addOwnProvider",
|
||||
"Add your own model provider",
|
||||
)}
|
||||
{tx(
|
||||
"settings.providers.addOwnProvider",
|
||||
"Add your own model provider",
|
||||
)}
|
||||
</span>
|
||||
</span>
|
||||
<ChevronDown
|
||||
@@ -1317,25 +1261,25 @@ export function ProvidersSettings({
|
||||
sideOffset={8}
|
||||
className="max-h-[24rem] w-[380px] max-w-[calc(100vw-2rem)] overflow-y-auto scrollbar-thin scrollbar-track-transparent"
|
||||
>
|
||||
{!setupIntent || setupIntent === "apiKey" ? (
|
||||
<DropdownMenuItem
|
||||
onSelect={beginCustomProviderCreation}
|
||||
className="flex min-h-[54px] cursor-default items-center gap-3 px-2.5 py-2 focus:bg-muted/85 focus:text-foreground"
|
||||
>
|
||||
<ProviderIcon provider="custom" showBrandLogos={showBrandLogos} />
|
||||
<span className="truncate text-[13px] font-medium">
|
||||
{tx("settings.providers.customProvider", "Custom provider")}
|
||||
</span>
|
||||
</DropdownMenuItem>
|
||||
) : null}
|
||||
{providerPickerOptions.length > 0
|
||||
&& (!setupIntent || setupIntent === "apiKey")
|
||||
? <DropdownMenuSeparator />
|
||||
: null}
|
||||
{providerPickerOptions.map((provider) => (
|
||||
<DropdownMenuItem
|
||||
onSelect={beginCustomProviderCreation}
|
||||
className="flex min-h-[54px] cursor-default items-center gap-3 px-2.5 py-2 focus:bg-muted/85 focus:text-foreground"
|
||||
>
|
||||
<ProviderIcon provider="custom" showBrandLogos={showBrandLogos} />
|
||||
<span className="truncate text-[13px] font-medium">
|
||||
{tx("settings.providers.customProvider", "Custom provider")}
|
||||
</span>
|
||||
</DropdownMenuItem>
|
||||
{unconfiguredProviders.length > 0 ? <DropdownMenuSeparator /> : null}
|
||||
{unconfiguredProviders.map((provider) => (
|
||||
<DropdownMenuItem
|
||||
key={provider.name}
|
||||
onSelect={() => chooseProvider(provider.name)}
|
||||
onSelect={() => {
|
||||
setCreatingCustomProvider(false);
|
||||
if (expandedProvider !== provider.name) {
|
||||
onToggleProvider(provider.name);
|
||||
}
|
||||
}}
|
||||
className="flex min-h-[54px] cursor-default items-center gap-3 px-2.5 py-2 focus:bg-muted/85 focus:text-foreground"
|
||||
>
|
||||
<ProviderIcon
|
||||
@@ -1356,7 +1300,7 @@ export function ProvidersSettings({
|
||||
);
|
||||
}
|
||||
|
||||
function orderProviderPickerOptions(
|
||||
function orderUnconfiguredProviders(
|
||||
providers: SettingsPayload["providers"],
|
||||
): SettingsPayload["providers"] {
|
||||
return providers
|
||||
@@ -1369,7 +1313,7 @@ function orderProviderPickerOptions(
|
||||
}
|
||||
|
||||
function providerVisibilityRank(provider: SettingsPayload["providers"][number]): number {
|
||||
const localRank = LOCAL_PROVIDER_ORDER.get(provider.name);
|
||||
const localRank = LOCAL_UNCONFIGURED_PROVIDER_ORDER.get(provider.name);
|
||||
if (localRank !== undefined) return localRank;
|
||||
if ((provider.api_key_required ?? true) === false) return 100;
|
||||
return 200;
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
import { useRef } from "react";
|
||||
import { Check, Cloud, KeyRound, Laptop } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
DialogDescription,
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "@/components/ui/dialog";
|
||||
import { cn } from "@/lib/utils";
|
||||
import type { ModelSetupAvailability, ModelSetupIntent } from "@/lib/model-setup";
|
||||
|
||||
const SETUP_OPTIONS = [
|
||||
{
|
||||
intent: "account",
|
||||
icon: Cloud,
|
||||
titleKey: "thread.composer.modelSetup.account.title",
|
||||
title: "Connect an account",
|
||||
descriptionKey: "thread.composer.modelSetup.account.description",
|
||||
description: "Use a supported AI subscription.",
|
||||
},
|
||||
{
|
||||
intent: "apiKey",
|
||||
icon: KeyRound,
|
||||
titleKey: "thread.composer.modelSetup.apiKey.title",
|
||||
title: "Use an API key",
|
||||
descriptionKey: "thread.composer.modelSetup.apiKey.description",
|
||||
description: "Bring a key from your preferred provider.",
|
||||
},
|
||||
{
|
||||
intent: "local",
|
||||
icon: Laptop,
|
||||
titleKey: "thread.composer.modelSetup.local.title",
|
||||
title: "Run locally",
|
||||
descriptionKey: "thread.composer.modelSetup.local.description",
|
||||
description: "Connect Ollama, LM Studio, or vLLM.",
|
||||
},
|
||||
] as const;
|
||||
|
||||
export function ModelSetupDialog({
|
||||
availability,
|
||||
open,
|
||||
onOpenChange,
|
||||
onReturnFocus,
|
||||
onSelect,
|
||||
}: {
|
||||
availability: ModelSetupAvailability;
|
||||
open: boolean;
|
||||
onOpenChange: (open: boolean) => void;
|
||||
onReturnFocus: () => void;
|
||||
onSelect: (intent: ModelSetupIntent) => void;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const selectedRef = useRef(false);
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={open}
|
||||
onOpenChange={(nextOpen) => {
|
||||
if (nextOpen) selectedRef.current = false;
|
||||
onOpenChange(nextOpen);
|
||||
}}
|
||||
>
|
||||
<DialogContent
|
||||
className="max-w-md gap-5 p-5 sm:p-6"
|
||||
onCloseAutoFocus={(event) => {
|
||||
event.preventDefault();
|
||||
if (!selectedRef.current) onReturnFocus();
|
||||
selectedRef.current = false;
|
||||
}}
|
||||
>
|
||||
<DialogHeader className="pr-7">
|
||||
<DialogTitle className="text-[18px] leading-6">
|
||||
{t("thread.composer.modelSetup.title", { defaultValue: "Choose your AI" })}
|
||||
</DialogTitle>
|
||||
<DialogDescription className="leading-5">
|
||||
{t("thread.composer.modelSetup.description", {
|
||||
defaultValue: "Pick a starting point. You can change models at any time.",
|
||||
})}
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="space-y-2">
|
||||
{SETUP_OPTIONS.map((option) => {
|
||||
const Icon = option.icon;
|
||||
const ready = availability[option.intent];
|
||||
return (
|
||||
<button
|
||||
key={option.intent}
|
||||
type="button"
|
||||
aria-label={t(option.titleKey, { defaultValue: option.title })}
|
||||
onClick={() => {
|
||||
selectedRef.current = true;
|
||||
onSelect(option.intent);
|
||||
}}
|
||||
className={cn(
|
||||
"group flex min-h-[68px] w-full items-center gap-3 rounded-control border border-border/55 bg-background px-3.5 py-3 text-left",
|
||||
"transition-[background-color,border-color,transform] duration-150 ease-out hover:border-border hover:bg-muted/45 active:scale-[0.99]",
|
||||
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/45",
|
||||
)}
|
||||
>
|
||||
<span className="grid h-9 w-9 shrink-0 place-items-center rounded-full bg-muted/70 text-foreground/75 transition-colors group-hover:bg-background">
|
||||
<Icon className="h-[17px] w-[17px]" strokeWidth={1.8} aria-hidden />
|
||||
</span>
|
||||
<span className="min-w-0 flex-1">
|
||||
<span className="block text-[14px] font-semibold leading-5 text-foreground">
|
||||
{t(option.titleKey, { defaultValue: option.title })}
|
||||
</span>
|
||||
<span className="mt-0.5 block text-[12px] leading-[18px] text-muted-foreground">
|
||||
{t(option.descriptionKey, { defaultValue: option.description })}
|
||||
</span>
|
||||
</span>
|
||||
{ready ? (
|
||||
<span className="inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-500/10 px-2 py-1 text-[11px] font-medium text-emerald-700 dark:text-emerald-300">
|
||||
<Check className="h-3 w-3" strokeWidth={2.2} aria-hidden />
|
||||
{t("thread.composer.modelSetup.ready", { defaultValue: "Ready" })}
|
||||
</span>
|
||||
) : null}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
@@ -70,7 +70,6 @@ import {
|
||||
ModelPresetBadge,
|
||||
type ModelPresetOption,
|
||||
} from "@/components/thread/ModelPresetBadge";
|
||||
import { ModelSetupDialog } from "@/components/thread/ModelSetupDialog";
|
||||
import {
|
||||
ACCEPT_ATTR,
|
||||
MAX_ATTACHMENTS_PER_MESSAGE,
|
||||
@@ -114,7 +113,6 @@ import {
|
||||
} from "@/lib/session-drag";
|
||||
import { formatQuotedUserMessage } from "@/lib/user-message-quote";
|
||||
import { formatCompactTokenCount } from "@/lib/format";
|
||||
import type { ModelSetupAvailability, ModelSetupIntent } from "@/lib/model-setup";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const VOICE_SHORTCUT_CODE = "KeyD";
|
||||
@@ -300,9 +298,8 @@ interface ThreadComposerProps {
|
||||
modelProvider?: string | null;
|
||||
modelProviderLabel?: string | null;
|
||||
modelNeedsSetup?: boolean;
|
||||
modelSetupAvailability?: ModelSetupAvailability;
|
||||
fallbackModelName?: string | null;
|
||||
onModelBadgeClick?: (intent?: ModelSetupIntent) => void;
|
||||
onModelBadgeClick?: () => void;
|
||||
onManageModels?: () => void;
|
||||
contextUsage?: ComposerContextUsage | null;
|
||||
variant?: "thread" | "hero";
|
||||
@@ -1000,7 +997,6 @@ export function ThreadComposer({
|
||||
modelProvider = null,
|
||||
modelProviderLabel = null,
|
||||
modelNeedsSetup = false,
|
||||
modelSetupAvailability = { account: false, apiKey: false, local: false },
|
||||
fallbackModelName = null,
|
||||
onModelBadgeClick,
|
||||
onManageModels,
|
||||
@@ -1040,7 +1036,6 @@ export function ThreadComposer({
|
||||
} | null>(null);
|
||||
const [inlineError, setInlineError] = useState<string | null>(null);
|
||||
const [sendPending, setSendPending] = useState(false);
|
||||
const [modelSetupOpen, setModelSetupOpen] = useState(false);
|
||||
const interactionDisabled = !!disabled || sendPending;
|
||||
const [voiceErrorFading, setVoiceErrorFading] = useState(false);
|
||||
const [slashMenuDismissed, setSlashMenuDismissed] = useState(false);
|
||||
@@ -2013,7 +2008,7 @@ export function ThreadComposer({
|
||||
|
||||
const submit = useCallback(() => {
|
||||
if (modelNeedsSetup) {
|
||||
setModelSetupOpen(true);
|
||||
onModelBadgeClick?.();
|
||||
return;
|
||||
}
|
||||
if (!canSend) return;
|
||||
@@ -2121,6 +2116,7 @@ export function ThreadComposer({
|
||||
isStreaming,
|
||||
maxTextBytes,
|
||||
modelNeedsSetup,
|
||||
onModelBadgeClick,
|
||||
onSend,
|
||||
onStop,
|
||||
onQuotedContextChange,
|
||||
@@ -2131,15 +2127,6 @@ export function ThreadComposer({
|
||||
value,
|
||||
]);
|
||||
|
||||
const openModelSetup = useCallback(() => {
|
||||
setModelSetupOpen(true);
|
||||
}, []);
|
||||
|
||||
const continueModelSetup = useCallback((intent: ModelSetupIntent) => {
|
||||
setModelSetupOpen(false);
|
||||
onModelBadgeClick?.(intent);
|
||||
}, [onModelBadgeClick]);
|
||||
|
||||
const onKeyDown = (e: ReactKeyboardEvent<HTMLTextAreaElement>) => {
|
||||
if (showCliAppMenu) {
|
||||
if (e.key === "ArrowDown") {
|
||||
@@ -2561,7 +2548,7 @@ export function ThreadComposer({
|
||||
needsSetup={modelNeedsSetup}
|
||||
fallbackModelName={fallbackModelName}
|
||||
isHero={isHero}
|
||||
onClick={modelNeedsSetup ? openModelSetup : undefined}
|
||||
onClick={modelNeedsSetup ? onModelBadgeClick : undefined}
|
||||
/>
|
||||
) : null}
|
||||
{!voiceRecorder.isRecording ? <ComposerContextBadge usage={contextUsage} /> : null}
|
||||
@@ -2620,10 +2607,10 @@ export function ThreadComposer({
|
||||
showStopButton
|
||||
? t("thread.composer.stop")
|
||||
: modelNeedsSetup
|
||||
? t("thread.composer.openModelSetup", { defaultValue: "Open AI setup" })
|
||||
? t("thread.composer.configureModel", { defaultValue: "Configure model" })
|
||||
: t("thread.composer.send")
|
||||
}
|
||||
onClick={showStopButton ? handleStop : modelNeedsSetup ? openModelSetup : undefined}
|
||||
onClick={showStopButton ? handleStop : modelNeedsSetup ? onModelBadgeClick : undefined}
|
||||
className={cn(
|
||||
"thread-composer-action touch-target rounded-full transition-transform",
|
||||
showStopButton
|
||||
@@ -2669,13 +2656,6 @@ export function ThreadComposer({
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<ModelSetupDialog
|
||||
availability={modelSetupAvailability}
|
||||
open={modelSetupOpen}
|
||||
onOpenChange={setModelSetupOpen}
|
||||
onReturnFocus={() => textareaRef.current?.focus()}
|
||||
onSelect={continueModelSetup}
|
||||
/>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ import {
|
||||
} from "@/lib/mcp-preset-events";
|
||||
import type { CanonicalRunSnapshot, StreamError } from "@/lib/nanobot-client";
|
||||
import { inferProviderFromModelName, providerDisplayLabel } from "@/lib/provider-brand";
|
||||
import {
|
||||
modelSetupAvailability,
|
||||
type ModelSetupIntent,
|
||||
} from "@/lib/model-setup";
|
||||
import type {
|
||||
ChatSummary,
|
||||
SettingsPayload,
|
||||
@@ -358,7 +354,6 @@ interface ThreadShellProps {
|
||||
composerPortalTarget?: HTMLElement | null;
|
||||
composerActive?: boolean;
|
||||
composerInputAriaLabel?: string;
|
||||
focusComposerRequest?: number;
|
||||
emptyComposerVariant?: "hero" | "thread";
|
||||
workspaceScope?: WorkspaceScopePayload | null;
|
||||
workspaceDefaultScope?: WorkspaceScopePayload | null;
|
||||
@@ -367,7 +362,7 @@ interface ThreadShellProps {
|
||||
workspaceError?: string | null;
|
||||
onWorkspaceScopeChange?: (scope: WorkspaceScopePayload) => void;
|
||||
settingsSnapshot?: SettingsPayload | null;
|
||||
onOpenModelSettings?: (intent?: ModelSetupIntent) => void;
|
||||
onOpenModelSettings?: () => void;
|
||||
skills?: SkillSummary[];
|
||||
}
|
||||
|
||||
@@ -659,7 +654,6 @@ export function ThreadShell({
|
||||
composerPortalTarget,
|
||||
composerActive = true,
|
||||
composerInputAriaLabel,
|
||||
focusComposerRequest = 0,
|
||||
emptyComposerVariant = "hero",
|
||||
workspaceScope = null,
|
||||
workspaceDefaultScope = null,
|
||||
@@ -969,10 +963,6 @@ export function ThreadShell({
|
||||
const modelBadgeLabel = modelBadge.needsSetup
|
||||
? t("thread.composer.chooseAI", { defaultValue: "Choose your AI" })
|
||||
: modelBadge.label;
|
||||
const setupAvailability = useMemo(
|
||||
() => modelSetupAvailability(settings?.providers),
|
||||
[settings?.providers],
|
||||
);
|
||||
useEffect(() => {
|
||||
if (showHeroComposer && !wasShowingHeroComposerRef.current) {
|
||||
setHeroGreetingKey(randomHeroGreetingKey());
|
||||
@@ -1527,7 +1517,6 @@ export function ThreadShell({
|
||||
modelProvider={modelBadge.provider}
|
||||
modelProviderLabel={modelBadge.providerLabel}
|
||||
modelNeedsSetup={modelBadge.needsSetup}
|
||||
modelSetupAvailability={setupAvailability}
|
||||
fallbackModelName={fallbackModelName}
|
||||
onModelBadgeClick={modelBadge.needsSetup ? onOpenModelSettings : undefined}
|
||||
onManageModels={onOpenModelSettings}
|
||||
@@ -1555,7 +1544,7 @@ export function ThreadShell({
|
||||
transcriptionProvider={settingsSnapshot?.transcription?.provider}
|
||||
ingressLimits={ingressLimits}
|
||||
quotedContext={quotedContext}
|
||||
focusRequest={composerFocusSignal + focusComposerRequest}
|
||||
focusRequest={composerFocusSignal}
|
||||
onQuotedContextChange={setQuotedContext}
|
||||
/>
|
||||
) : (
|
||||
@@ -1577,7 +1566,6 @@ export function ThreadShell({
|
||||
modelProvider={modelBadge.provider}
|
||||
modelProviderLabel={modelBadge.providerLabel}
|
||||
modelNeedsSetup={modelBadge.needsSetup}
|
||||
modelSetupAvailability={setupAvailability}
|
||||
fallbackModelName={fallbackModelName}
|
||||
onModelBadgeClick={modelBadge.needsSetup ? onOpenModelSettings : undefined}
|
||||
onManageModels={onOpenModelSettings}
|
||||
@@ -1603,7 +1591,6 @@ export function ThreadShell({
|
||||
onWorkspaceScopeChange={onWorkspaceScopeChange}
|
||||
transcriptionProvider={settingsSnapshot?.transcription?.provider}
|
||||
ingressLimits={ingressLimits}
|
||||
focusRequest={composerFocusSignal + focusComposerRequest}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
|
||||
Reference in new issue
Block a user