feat: implement AI analysis engine for product recommendation and justification by generating prompts and processing responses.

This commit is contained in:
Michael committed 2026-02-26 16:15:20 +01:00
1 parent e50335a8c2
commit ea732bafc4
5 files changed
+85 -66

No files matched your search

@@ -252,16 +252,16 @@ export function BulkAiAnalyzer() {
</button>
</div>
) : progress.current > 0 ? (
<div className="flex items-center gap-2 h-10 px-4 rounded-xl bg-[var(--accent-success-bg)] border border-[var(--accent-success)] shadow-sm cursor-default">
<CheckCircle2 className="w-4 h-4 text-[var(--accent-success)]" />
<span className="text-xs font-bold text-[var(--accent-success)]">
<div className="btn-action btn-action-success">
<CheckCircle2 className="w-4 h-4" />
<span>
{progress.errors > 0 ? `Terminé (${progress.current - progress.errors}/${progress.total})` : `Analyse Terminée`}
</span>
</div>
) : (
<button
onClick={handleAnalyze}
className="group flex items-center justify-center gap-2 h-10 px-6 rounded-xl text-sm font-black transition-all shadow-md bg-[var(--accent)] text-white hover:brightness-110 active:scale-95 border border-white/10"
className="btn-action btn-action-ai"
>
<Sparkles className="w-4 h-4" />
Analyse IA
@@ -212,12 +212,7 @@ export function FloatingSummaryBar() {
alert("Une erreur s'est produite lors de l'export Excel.");
}
}}
className="h-10 px-6 rounded-xl text-sm font-bold transition-all active:scale-95 border hover:brightness-105"
style={{
background: "var(--action-secondary-bg)",
color: "var(--action-secondary-text)",
borderColor: "var(--action-secondary-border)"
}}
className="btn-action btn-action-secondary"
>
Export Excel
</button>
@@ -225,10 +220,7 @@ export function FloatingSummaryBar() {
<button
onClick={handleSave}
disabled={!hasDrafts || isPending}
className="h-10 px-6 flex items-center justify-center gap-2 rounded-xl text-sm font-black transition-all shadow-lg active:scale-95 text-white hover:brightness-110 disabled:opacity-50"
style={{
background: "var(--brand-solid)",
}}
className="btn-action btn-action-primary"
>
{isPending ? (
<Loader2 className="w-4 h-4 animate-spin" />
@@ -66,10 +66,10 @@ export function SupplierAiContextModal({ codeFournisseur, nomFournisseur }: Supp
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button variant="outline" size="sm" className="gap-2">
<button className="btn-action btn-action-secondary">
<Brain className="w-4 h-4" />
Règles IA
</Button>
</button>
</DialogTrigger>
<DialogContent className="sm:max-w-[500px] bg-white dark:bg-slate-900 border border-slate-200 dark:border-slate-800 shadow-xl">
<DialogHeader>
@@ -91,12 +91,12 @@ export function SupplierAiContextModal({ codeFournisseur, nomFournisseur }: Supp
</div>
<DialogFooter>
<Button variant="outline" onClick={() => setOpen(false)} disabled={isSaving}>
<button className="btn-action btn-action-secondary" onClick={() => setOpen(false)} disabled={isSaving}>
Annuler
</Button>
<Button onClick={handleSave} disabled={isSaving || isLoading} className="gap-2 bg-emerald-600 hover:bg-emerald-700 text-white">
</button>
<button onClick={handleSave} disabled={isSaving || isLoading} className="btn-action btn-action-primary">
{isSaving ? "Enregistrement..." : "Enregistrer les règles"}
</Button>
</button>
</DialogFooter>
</DialogContent>
</Dialog>