mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-11 17:26:32 +02:00
feat: Add bulk AI product analysis component with progress tracking, concurrency, and benchmark calculations, along with a component for displaying individual AI insights.
This commit is contained in:
1 parent
960045dc53
commit
673cab4454
2 files changed
+9
No files matched your search
@@ -5,17 +5,24 @@ import { useAiCopilotStore } from "@/features/ai-copilot/store/use-ai-copilot-st
|
||||
import type { ProductRow } from "@/types/grid";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
import { useGridStore } from "@/features/grid/store/use-grid-store";
|
||||
|
||||
interface AiInsightBlockProps {
|
||||
row: ProductRow;
|
||||
}
|
||||
|
||||
export function AiInsightBlock({ row }: AiInsightBlockProps) {
|
||||
const { insights, analyzeProduct } = useAiCopilotStore();
|
||||
const setDraftGamme = useGridStore(state => state.setDraftGamme);
|
||||
const insight = insights[row.codein];
|
||||
const status = insight?.status ?? "idle";
|
||||
|
||||
const handleAnalyze = () => {
|
||||
if (status === "loading") return;
|
||||
|
||||
// Vider la recommandation actuelle avant de relancer l'IA
|
||||
setDraftGamme(row.codein, "Aucune");
|
||||
|
||||
analyzeProduct({
|
||||
codein: row.codein,
|
||||
libelle1: row.libelle1,
|
||||
|
||||
@@ -103,6 +103,8 @@ export function BulkAiAnalyzer() {
|
||||
|
||||
// Marquer temporairement comme loading dans le store pour le feedback visuel individuel
|
||||
setInsight(payload.codein, "", false);
|
||||
// Vider aussi la recommandation (A, C, Z) pour montrer que c'est en cours de recalcul
|
||||
setDraftGamme(payload.codein, "Aucune");
|
||||
// Note: setInsight dans le store actuel met le status à "done".
|
||||
// Pour bien faire, il faudrait une action setStatusLoading dans le store.
|
||||
// Ici, on va au moins vider l'insight pour montrer que ça bouge.
|
||||
|
||||
Reference in new issue
Block a user