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 }} />' },
@@ -179,6 +179,16 @@
"reset": "Reset preview",
"hint": "Select a recovery state, then try continuing or dismissing."
},
"sandbox": {
"title": "Command notice",
"description": "Use the production notice to compare missing components, unprotected installations, and startup failures.",
"options": "The notice does not take focus or retry commands. Change its state, dismiss it, and keep typing.",
"missing": "Component not found",
"permissions": "Installation needs attention",
"startup": "Startup unavailable",
"hint": "Component demo only. No commands run and no settings change.",
"settingsAction": "Requested sandbox settings (demo)."
},
"fallback": {
"title": "ModelFallbackNotice · Model fallback",
"description": "View fallback-model and expired-authorization notices, settings and dismissal.",
@@ -179,6 +179,16 @@
"reset": "Restablecer vista previa",
"hint": "Elige un estado de recuperación y prueba a continuar o cerrar."
},
"sandbox": {
"title": "Aviso de comandos",
"description": "Compara componentes ausentes, instalaciones sin protección y errores de inicio con el componente real.",
"options": "El aviso no toma el foco ni reintenta comandos. Cambia el estado, ciérralo y sigue escribiendo.",
"missing": "Componente no encontrado",
"permissions": "Revisar instalación",
"startup": "Inicio no disponible",
"hint": "Solo demostración. No se ejecutan comandos ni se cambian ajustes.",
"settingsAction": "Se solicitaron los ajustes del sandbox (demostración)."
},
"fallback": {
"title": "ModelFallbackNotice · Modelo alternativo",
"description": "Consulta avisos de modelo alternativo y autorización caducada, configuración y cierre.",
@@ -179,6 +179,16 @@
"reset": "Réinitialiser l’aperçu",
"hint": "Sélectionnez un état de reprise, puis essayez de continuer ou de fermer."
},
"sandbox": {
"title": "Avis de commande",
"description": "Comparez les composants manquants, les installations non protégées et les échecs de démarrage avec le composant réel.",
"options": "L’avis ne prend pas le focus et ne relance aucune commande. Changez son état, fermez-le et continuez à saisir.",
"missing": "Composant introuvable",
"permissions": "Installation à vérifier",
"startup": "Démarrage indisponible",
"hint": "Démonstration uniquement. Aucune commande ni modification des paramètres.",
"settingsAction": "Paramètres du bac à sable demandés (démonstration)."
},
"fallback": {
"title": "ModelFallbackNotice · Modèle de secours",
"description": "Consultez les avis de modèle de secours et d’autorisation expirée, puis les actions associées.",
@@ -179,6 +179,16 @@
"reset": "Atur ulang pratinjau",
"hint": "Pilih status pemulihan, lalu coba lanjutkan atau tutup."
},
"sandbox": {
"title": "Pemberitahuan perintah",
"description": "Bandingkan komponen yang hilang, pemasangan tidak terlindungi, dan kegagalan awal dengan komponen produksi.",
"options": "Pemberitahuan tidak mengambil fokus atau mengulang perintah. Ubah status, tutup, lalu lanjutkan mengetik.",
"missing": "Komponen tidak ditemukan",
"permissions": "Pemasangan perlu diperiksa",
"startup": "Tidak dapat dimulai",
"hint": "Hanya demo komponen. Tidak ada perintah atau perubahan pengaturan.",
"settingsAction": "Pengaturan sandbox diminta (demo)."
},
"fallback": {
"title": "ModelFallbackNotice · Model cadangan",
"description": "Lihat pemberitahuan model cadangan dan otorisasi kedaluwarsa, lalu coba pengaturan atau tutup.",
@@ -179,6 +179,16 @@
"reset": "プレビューをリセット",
"hint": "復旧状態を選び、続行または閉じる操作を試してください。"
},
"sandbox": {
"title": "コマンドの通知",
"description": "実際のコンポーネントで、コンポーネントの欠落、保護されていないインストール、起動失敗を比較します。",
"options": "通知はフォーカスを奪わず、コマンドを再実行しません。状態を切り替え、閉じて入力を続けられます。",
"missing": "コンポーネントが見つからない",
"permissions": "インストールの確認が必要",
"startup": "起動できない",
"hint": "コンポーネントのデモです。コマンドの実行や設定の変更は行いません。",
"settingsAction": "サンドボックス設定を開く操作(デモ)。"
},
"fallback": {
"title": "ModelFallbackNotice · 代替モデル",
"description": "代替モデルや認証期限切れの通知、設定と閉じる操作を確認できます。",
@@ -179,6 +179,16 @@
"reset": "미리보기 초기화",
"hint": "복구 상태를 선택한 후 계속하거나 닫아 보세요."
},
"sandbox": {
"title": "명령 알림",
"description": "실제 구성 요소로 누락된 구성 요소, 보호되지 않은 설치 위치, 시작 실패를 비교합니다.",
"options": "알림은 포커스를 가져오거나 명령을 재시도하지 않습니다. 상태를 바꾸고 닫은 후 계속 입력할 수 있습니다.",
"missing": "구성 요소 없음",
"permissions": "설치 확인 필요",
"startup": "시작 불가",
"hint": "구성 요소 데모입니다. 명령 실행이나 설정 변경은 없습니다.",
"settingsAction": "샌드박스 설정 열기 요청(데모)."
},
"fallback": {
"title": "ModelFallbackNotice · 대체 모델",
"description": "대체 모델과 인증 만료 알림, 설정 열기, 닫기를 확인합니다.",
@@ -179,6 +179,16 @@
"reset": "Redefinir prévia",
"hint": "Selecione um estado de recuperação e teste continuar ou fechar."
},
"sandbox": {
"title": "Aviso de comandos",
"description": "Compare componentes ausentes, instalações desprotegidas e falhas de inicialização com o componente real.",
"options": "O aviso não toma o foco nem repete comandos. Mude o estado, feche-o e continue digitando.",
"missing": "Componente não encontrado",
"permissions": "Verificar instalação",
"startup": "Inicialização indisponível",
"hint": "Apenas demonstração. Nenhum comando é executado ou ajuste alterado.",
"settingsAction": "Configurações do sandbox solicitadas (demonstração)."
},
"fallback": {
"title": "ModelFallbackNotice · Modelo alternativo",
"description": "Veja avisos de modelo alternativo e autorização expirada, configurações e fechamento.",
@@ -179,6 +179,16 @@
"reset": "Đặt lại bản xem trước",
"hint": "Chọn trạng thái khôi phục, rồi thử tiếp tục hoặc đóng."
},
"sandbox": {
"title": "Thông báo lệnh",
"description": "So sánh thành phần bị thiếu, vị trí cài đặt không được bảo vệ và lỗi khởi động bằng thành phần thực tế.",
"options": "Thông báo không chiếm tiêu điểm hay tự chạy lại lệnh. Đổi trạng thái, đóng thông báo rồi tiếp tục nhập.",
"missing": "Không tìm thấy thành phần",
"permissions": "Cần kiểm tra cài đặt",
"startup": "Không thể khởi động",
"hint": "Chỉ minh họa thành phần. Không chạy lệnh hay thay đổi cài đặt.",
"settingsAction": "Đã yêu cầu mở cài đặt sandbox (minh họa)."
},
"fallback": {
"title": "ModelFallbackNotice · Mô hình dự phòng",
"description": "Xem thông báo mô hình dự phòng, ủy quyền hết hạn và thử mở cài đặt hoặc đóng.",
@@ -179,6 +179,16 @@
"reset": "重置预览",
"hint": "选择恢复状态,再试用继续或关闭。"
},
"sandbox": {
"title": "命令提示",
"description": "使用正式提示组件,体验缺失组件、安装位置受限和启动异常三种状态。",
"options": "提示不抢焦点,也不自动重试命令。可切换状态、关闭提示并继续输入。",
"missing": "找不到组件",
"permissions": "安装位置受限",
"startup": "启动异常",
"hint": "这里只演示组件,不会执行命令或修改设置。",
"settingsAction": "已请求打开沙箱设置(演示)。"
},
"fallback": {
"title": "ModelFallbackNotice · 模型回退",
"description": "查看模型回退和授权失效提示。",
@@ -179,6 +179,16 @@
"reset": "重設預覽",
"hint": "選擇復原狀態,再試用繼續或關閉。"
},
"sandbox": {
"title": "指令提示",
"description": "使用正式提示元件,體驗缺少元件、安裝位置受限與啟動異常三種狀態。",
"options": "提示不會搶焦點,也不會自動重試指令。可切換狀態、關閉提示並繼續輸入。",
"missing": "找不到元件",
"permissions": "安裝位置受限",
"startup": "啟動異常",
"hint": "這裡僅示範元件,不會執行指令或修改設定。",
"settingsAction": "已要求開啟沙箱設定(示範)。"
},
"fallback": {
"title": "ModelFallbackNotice · 模型備援",
"description": "查看備援模型與授權失效提示。",