fix: decouple AI completion from history save failures and improve history API errors

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-16 21:31:20 +08:00
parent 123a5cce6d
commit 187b08c3e1
8 changed files with 145 additions and 53 deletions
+13 -3
View File
@@ -11,6 +11,7 @@ function ResultAI({
isLoading,
onCompletion,
error,
warning,
panel = false,
emptyHint = "完成左侧填写并起卦/排盘后,点击「AI 解读」",
downloadFilename,
@@ -20,6 +21,7 @@ function ResultAI({
isLoading: boolean;
onCompletion: () => void;
error: string;
warning?: string;
panel?: boolean;
emptyHint?: string;
downloadFilename?: string;
@@ -94,9 +96,17 @@ function ResultAI({
<p className="mt-1 whitespace-pre-wrap">{error}</p>
</div>
) : completion ? (
<Markdown className="prose max-w-none text-sm dark:prose-invert prose-p:leading-relaxed">
{completion}
</Markdown>
<>
{warning && (
<div className="mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 px-3 py-2 text-sm text-amber-700 dark:text-amber-300">
<p className="font-medium"></p>
<p className="mt-1 whitespace-pre-wrap">{warning}</p>
</div>
)}
<Markdown className="prose max-w-none text-sm dark:prose-invert prose-p:leading-relaxed">
{completion}
</Markdown>
</>
) : isLoading ? (
<p className="text-sm text-muted-foreground"> AI ...</p>
) : (