feat(webui): guide sandbox launcher recovery from chat

This commit is contained in:
Xubin Ren committed 2026-11-08 14:29:46 +08:00
1 parent 16250540d3
commit f5e5bd6ea0
47 files changed
+613 -32

No files matched your search

+24
View File
@@ -7,6 +7,7 @@ import { ComposerUsagePopover, type ComposerRoundUsage } from "@/components/thre
import type { ContextSnapshot } from "@/lib/types";
import { ContextCompactionNotice } from "@/components/thread/ContextCompactionNotice";
import { ModelFallbackNotice } from "@/components/thread/ModelFallbackNotice";
import { SandboxNotice, type SandboxIssue } from "@/components/thread/SandboxNotice";
import { ModelPresetBadge, type ModelPresetOption } from "@/components/thread/ModelPresetBadge";
import { PromptNavigator } from "@/components/thread/PromptNavigator";
import { RecoveryNotice } from "@/components/thread/RecoveryNotice";
@@ -238,6 +239,26 @@ function RecoveryPreview() {
</div>;
}
function SandboxPreview() {
const { t } = useGalleryTranslation();
const [issue, setIssue] = useState<SandboxIssue>("missing");
const [dismissed, setDismissed] = useState(false);
const [opened, setOpened] = useState(false);
return <div className="space-y-4">
<div className="flex flex-wrap gap-2">
{(["missing", "permissions", "startup"] as const).map((value) => <Button key={value}
variant={issue === value ? "secondary" : "outline"} size="sm" className="rounded-full"
onClick={() => { setIssue(value); setDismissed(false); setOpened(false); }}>{t(`previews.sandbox.${value}`)}</Button>)}
</div>
<div className="thread-composer-stack">
{!dismissed ? <SandboxNotice issue={issue} onDismiss={() => setDismissed(true)} onOpenSettings={() => setOpened(true)} /> : null}
<ThreadComposer workspaceControlsHidden onSend={() => false} onStop={() => {}} />
</div>
<Button variant="outline" size="sm" onClick={() => setDismissed(false)}>{t("previews.fallback.showAgain")}</Button>
<p role="status" className="text-caption text-muted-foreground">{t(`previews.sandbox.${opened ? "settingsAction" : "hint"}`)}</p>
</div>;
}
function FallbackPreview() {
const { t } = useGalleryTranslation();
const [mode, setMode] = useState<"fallback" | "reauth">("fallback");
@@ -351,6 +372,9 @@ export const conversationExamples: ComponentExample[] = [
{ title: "previews.fallback.title", files: ["thread/ModelFallbackNotice"], Preview: FallbackPreview,
description: "previews.fallback.description", options: "previews.fallback.options",
code: '<ModelFallbackNotice model="gpt-4.1" onDismiss={dismiss} onOpenSettings={openModelSettings} />' },
{ title: "previews.sandbox.title", files: ["thread/SandboxNotice"], Preview: SandboxPreview,
description: "previews.sandbox.description", options: "previews.sandbox.options",
code: '<SandboxNotice issue="missing" onDismiss={dismiss} onOpenSettings={openSandboxSettings} />' },
{ title: "previews.compaction.title", files: ["thread/ContextCompactionNotice"], Preview: CompactionPreview,
description: "previews.compaction.description", options: "previews.compaction.options",
code: '<ContextCompactionNotice compaction={{ id: "compaction-1", phase: "succeeded", announce: true }} />' },