fix(web): 大纲错误透传 FriendlyError, 不再向用户暴露内部 code

This commit is contained in:
Yaojia Wang
2026-06-29 16:52:43 +02:00
parent 4afbbe0fe7
commit ffe9132f7d
3 changed files with 40 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ import { Button } from "@/components/ui/Button";
import { EmptyState } from "@/components/ui/EmptyState";
import { PageHeader } from "@/components/ui/PageHeader";
import { Select } from "@/components/ui/Select";
import { StatusNote } from "@/components/ui/StatusNote";
import { TextInput } from "@/components/ui/TextInput";
import type { OutlineChapterView, ProjectResponse } from "@/lib/api/types";
import {
@@ -111,20 +112,20 @@ export function OutlineEditor({
/>
{error ? (
<p className="mb-4 text-sm text-conflict">
{error.code}{error.message}
{error.code === "LLM_UNAVAILABLE" ? (
<StatusNote variant="danger" title="大纲生成失败" className="mb-4">
{error.text}
{error.actionHref ? (
<>
{" "}
<a
href="/settings/providers"
href={error.actionHref}
className="underline hover:text-cinnabar"
>
{error.actionLabel}
</a>
</>
) : null}
</p>
</StatusNote>
) : null}
<div className="min-h-0 flex-1 overflow-auto">