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:
@@ -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>
|
||||
) : (
|
||||
|
||||
Reference in New Issue
Block a user