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

+3
View File
@@ -2,6 +2,7 @@ import { useState } from "react";
import { ModelFallbackNotice } from "@/components/thread/ModelFallbackNotice";
import { RecoveryNotice } from "@/components/thread/RecoveryNotice";
import { SandboxNotice } from "@/components/thread/SandboxNotice";
import { StreamErrorNotice } from "@/components/thread/StreamErrorNotice";
import { ThreadComposer } from "@/components/thread/ThreadComposer";
import { ThreadMessages } from "@/components/thread/ThreadMessages";
@@ -33,6 +34,8 @@ export function ChatFailureFixture({ parameters }: { parameters: URLSearchParams
? <StreamErrorNotice error={{ kind: "model_request_failed", chatId: "fixture", errorKind: "authentication" }} onDismiss={dismiss} onOpenSettings={settings} />
: parameters.get("notice") === "fallback"
? <ModelFallbackNotice model="Fallback model" onDismiss={dismiss} onOpenSettings={settings} />
: parameters.get("notice") === "sandbox"
? <SandboxNotice issue="missing" onDismiss={dismiss} onOpenSettings={settings} />
: <RecoveryNotice
state={{ recovery_id: "fixture-recovery", status: "awaiting_user", reason: "model_request_failed", failure_error_kind: "authentication" }}
onContinue={async () => { setVisible(false); setAction("continued"); }}
+13 -2
View File
@@ -2,8 +2,8 @@ import { expect, test } from "@playwright/test";
for (const width of [1440, 390]) {
for (const variant of ["thread", "hero"]) {
for (const notice of ["recovery", "stream", "fallback"]) {
test(`${notice} aligns with ${variant} composer at ${width}px`, async ({ page }) => {
for (const notice of ["recovery", "stream", "fallback", "sandbox"]) {
test(`${notice} aligns with ${variant} composer at ${width}px`, async ({ page }, info) => {
await page.setViewportSize({ width, height: 1000 });
await page.emulateMedia({ reducedMotion: "reduce" });
await page.addInitScript(({ dark, locale }) => {
@@ -29,6 +29,17 @@ for (const width of [1440, 390]) {
expect(box.x + box.width).toBeLessThanOrEqual(noticeBox.x + noticeBox.width);
}
expect(await page.evaluate(() => document.documentElement.scrollWidth)).toBeLessThanOrEqual(width);
if (notice === "sandbox") {
await expect(alert).toHaveAttribute("role", "status");
await expect(alert).toHaveAttribute("aria-live", "polite");
const input = page.getByRole("textbox");
await input.fill("Keep this unsent draft / 保留草稿");
await expect(input).toBeFocused();
await alert.getByRole("button").first().click();
await expect(page.getByLabel("Fixture action")).toHaveText("settings");
await expect(input).toHaveValue("Keep this unsent draft / 保留草稿");
await page.screenshot({ path: info.outputPath("sandbox-notice.png") });
}
if (notice === "recovery") {
await expect(alert).toContainText(width === 390 ? "模型提供商验证失败" : "Model provider authorization failed");
await alert.getByRole("button").first().click();