mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-14 10:48:09 +02:00
feat: Add bulk AI analyzer component to process product data and generate insights.
This commit is contained in:
1 parent
8c02771e46
commit
17498dcc10
4 files changed
+47
-8
No files matched your search
@@ -12,8 +12,9 @@ export function BulkAiAnalyzer() {
|
||||
const [progress, setProgress] = useState({ current: 0, total: 0, message: "", errors: 0 });
|
||||
const isCancelledRef = useRef(false);
|
||||
|
||||
const batchSetDraftGamme = useGridStore((s) => s.batchSetDraftGamme);
|
||||
const setDraftGamme = useGridStore((s) => s.setDraftGamme);
|
||||
const { setInsight, setLoading, setError } = useAiCopilotStore();
|
||||
const { setInsight, batchSetLoading, setError } = useAiCopilotStore();
|
||||
|
||||
const handleStop = () => {
|
||||
isCancelledRef.current = true;
|
||||
@@ -111,6 +112,14 @@ export function BulkAiAnalyzer() {
|
||||
const totalItems = productPayloads.length;
|
||||
setProgress({ current: 0, total: totalItems, message: "Initialisation...", errors: 0 });
|
||||
|
||||
// Reset global ATOMIQUE et IMMÉDIAT
|
||||
const codeins = productPayloads.map(p => p.codein);
|
||||
batchSetLoading(codeins);
|
||||
|
||||
const gammeChanges: Record<string, GammeCode> = {};
|
||||
codeins.forEach(c => gammeChanges[c] = "Aucune");
|
||||
batchSetDraftGamme(gammeChanges);
|
||||
|
||||
const CONCURRENCY = 3;
|
||||
const remaining = [...productPayloads];
|
||||
|
||||
@@ -120,9 +129,6 @@ export function BulkAiAnalyzer() {
|
||||
const payload = remaining.shift();
|
||||
if (!payload) break;
|
||||
|
||||
setLoading(payload.codein);
|
||||
setDraftGamme(payload.codein, "Aucune");
|
||||
|
||||
try {
|
||||
let res: Response | null = null;
|
||||
for (let i = 0; i < 3; i++) {
|
||||
|
||||
Reference in new issue
Block a user