chore: preserve frontend concept lab
This commit is contained in:
30
frontend/src/components/app/AppReferenceCard.tsx
Normal file
30
frontend/src/components/app/AppReferenceCard.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
|
||||
const sourceLabels: Record<string, string> = {
|
||||
knowledge_item: '知识条目',
|
||||
solution: '解决方案',
|
||||
ticket: '历史工单',
|
||||
document: '文档'
|
||||
}
|
||||
|
||||
type AppReferenceCardProps = {
|
||||
title: string
|
||||
sourceType: string
|
||||
content: string
|
||||
score: number
|
||||
sourceLabel?: string
|
||||
}
|
||||
|
||||
export function AppReferenceCard({ title, sourceType, content, score, sourceLabel }: AppReferenceCardProps) {
|
||||
return (
|
||||
<article className="grid gap-2 rounded-md border border-border bg-background p-3">
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<p className="font-medium text-foreground">{title}</p>
|
||||
<Badge variant="secondary">{sourceLabels[sourceType] ?? sourceType}</Badge>
|
||||
<Badge variant="outline">匹配度 {Math.round(score * 100)}%</Badge>
|
||||
</div>
|
||||
<p className="line-clamp-4 whitespace-pre-line text-sm leading-6 text-muted-foreground">{content}</p>
|
||||
{sourceLabel ? <p className="text-xs text-muted-foreground">来源:{sourceLabel}</p> : null}
|
||||
</article>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user