From 13130c7f27301c73dabdad4154bc107d70ca58c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Wed, 20 May 2026 15:09:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=95=E5=BC=80=E6=94=B6=E8=B5=B7=E5=8A=A8?= =?UTF-8?q?=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai-writing/CompletedInterventionCard.tsx | 104 +++++++++++++----- 1 file changed, 74 insertions(+), 30 deletions(-) diff --git a/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx b/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx index 70619177..5cbc9d99 100644 --- a/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx +++ b/frontend-web/src/open-canvas/components/ai-writing/CompletedInterventionCard.tsx @@ -5,7 +5,7 @@ import { } from 'lucide-react'; import { cn } from '@/lib/utils'; import { buildIntranetSourceUrl } from '@/core/config'; -import type { CompletedIntervention } from '../../types/ai-writing'; +import type { AIMaterial, CompletedIntervention } from '../../types/ai-writing'; import { OutlineCard } from './OutlineCard'; import { ReviewCard } from './ReviewCard'; import { ScoreBar } from './ScoreBar'; @@ -65,35 +65,79 @@ function MaterialCompleted({ record, expanded, onToggle }: { record: CompletedIn {expanded && record.materials && record.materials.length > 0 && (
- {record.materials.map((m) => { - const pct = Math.round(m.relevanceScore * 100); - const barColor = - m.relevanceScore >= 0.8 ? 'bg-green-500' - : m.relevanceScore >= 0.5 ? 'bg-orange-400' - : 'bg-red-400'; - return ( -
-

{m.title}

-
- {m.source} - {m.publishedAt && <>·{m.publishedAt}} -
-
-
-
- {pct}% -
- {m.recUuid && ( - - )} -
-
- ); - })} + {record.materials.map((m) => ( + + ))} +
+ )} +
+ ); +} + +function relevanceLabel(score: number): string { + if (score >= 0.8) return '高相关'; + if (score >= 0.5) return '中相关'; + return '低相关'; +} + +function CompletedMaterialItem({ material }: { material: AIMaterial }) { + const [open, setOpen] = useState(false); + const pct = Math.round(material.relevanceScore * 100); + const barColor = + material.relevanceScore >= 0.8 ? 'bg-green-500' + : material.relevanceScore >= 0.5 ? 'bg-orange-400' + : 'bg-red-400'; + const hasDetail = !!material.content || !!material.recUuid; + + return ( +
+ + + {open && hasDetail && ( +
+ {material.content && ( +

+ {material.content.slice(0, 300)} + {material.content.length > 300 && '…'} +

+ )} + {material.recUuid && ( + + )}
)}