Files
lcbp3/frontend/components/ai/intent-classification/analytics/recalibration-panel.tsx
T
admin ea5499123e
CI / CD Pipeline / build (push) Failing after 3m57s
CI / CD Pipeline / deploy (push) Has been skipped
690519:1631 224 to 226 AI #01
2026-05-19 16:31:50 +07:00

79 lines
2.7 KiB
TypeScript

// File: components/ai/intent-classification/analytics/recalibration-panel.tsx
// Change Log
// - 2026-05-19: สร้าง Recalibration Panel สำหรับ Analytics Dashboard (T036, US3).
'use client';
import { AlertTriangle } from 'lucide-react';
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from '@/components/ui/table';
import type { RecalibrationRecommendation } from '@/lib/services/ai-intent.service';
interface RecalibrationPanelProps {
data: RecalibrationRecommendation[];
}
/**
* แสดงคำแนะนำ Intent ที่ควรเพิ่ม pattern เพื่อลด LLM Calls
* ตาม SC-001: เป้าหมาย Pattern Hit Rate 70-80%
*/
export function RecalibrationPanel({ data }: RecalibrationPanelProps) {
if (data.length === 0) {
return (
<Alert>
<AlertTitle></AlertTitle>
<AlertDescription>
Intent Pattern Pattern Hit Rate
</AlertDescription>
</Alert>
);
}
return (
<div className="space-y-3">
<Alert variant="destructive">
<AlertTriangle className="h-4 w-4" />
<AlertTitle> Pattern</AlertTitle>
<AlertDescription>
Intent classify LLM keyword/regex pattern
LLM
</AlertDescription>
</Alert>
<Table>
<TableHeader>
<TableRow>
<TableHead>Intent Code</TableHead>
<TableHead className="text-right">LLM Calls</TableHead>
<TableHead className="text-right">Avg Confidence</TableHead>
<TableHead className="text-right">Priority</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{data.map((row) => (
<TableRow key={row.intentCode}>
<TableCell className="font-mono text-sm">
{row.intentCode}
</TableCell>
<TableCell className="text-right">{row.llmCallCount}</TableCell>
<TableCell className="text-right">
{row.avgConfidence.toFixed(2)}
</TableCell>
<TableCell className="text-right font-medium text-amber-600">
{row.priority}
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</div>
);
}