This commit is contained in:
Orionis312050 committed 2026-04-17 12:08:37 +02:00
1 parent 4beb27e618
commit 76de333507
30 files changed
+5047 -2113

No files matched your search

+144 -52
View File
@@ -1,5 +1,22 @@
import React, { useState, useEffect } from 'react';
import { createPortal } from 'react-dom';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import {
Dialog,
DialogContent,
DialogHeader,
DialogTitle,
DialogFooter,
} from "@/components/ui/dialog"
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select"
import { CheckCircle2, Cpu, Globe, Link as LinkIcon } from 'lucide-react';
export default function SettingsModal({ onClose }: { onClose: () => void }) {
const [formData, setFormData] = useState({
@@ -7,7 +24,8 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
notionDbId: '',
ollamaUrl: '',
ollamaModel: '',
searxngUrl: ''
searxngUrl: '',
aiLanguage: 'Français'
});
const [saved, setSaved] = useState(false);
@@ -23,7 +41,8 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
notionDbId: data.notionDbId || '',
ollamaUrl: data.ollamaUrl || '',
ollamaModel: data.ollamaModel || '',
searxngUrl: data.searxngUrl || ''
searxngUrl: data.searxngUrl || '',
aiLanguage: data.aiLanguage || 'Français'
});
}
})
@@ -48,57 +67,130 @@ export default function SettingsModal({ onClose }: { onClose: () => void }) {
}
};
return createPortal(
<div className="modal-overlay" onClick={onClose}>
<div className="glass-panel modal-content" onClick={e => e.stopPropagation()}>
<form onSubmit={handleSubmit} style={{ maxHeight: '90vh', overflowY: 'auto' }}>
<h2 style={{ marginBottom: '1.5rem', color: 'var(--text-main)' }}>Paramètres Globaux</h2>
<div style={{ padding: '1.5rem', background: 'rgba(59, 130, 246, 0.05)', borderRadius: '8px', border: '1px solid rgba(59, 130, 246, 0.2)', marginBottom: '1.5rem' }}>
<h4 style={{ fontSize: '1rem', marginBottom: '1rem', color: 'var(--text-main)' }}>Intégration Notion</h4>
<div className="form-group">
<label>Token d'intégration Notion (Internal App)</label>
<input type="password" className="form-control" value={formData.notionToken} onChange={e => setFormData({...formData, notionToken: e.target.value})} placeholder="secret_..." />
</div>
<div className="form-group" style={{ marginBottom: 0 }}>
<label>ID de la base de données (Database ID)</label>
<input type="text" className="form-control" value={formData.notionDbId} onChange={e => setFormData({...formData, notionDbId: e.target.value})} placeholder="ex: a1b2c3d4e5f6..." />
</div>
</div>
<div style={{ padding: '1.5rem', background: 'rgba(16, 185, 129, 0.05)', borderRadius: '8px', border: '1px solid rgba(16, 185, 129, 0.2)', marginBottom: '1.5rem' }}>
<h4 style={{ fontSize: '1rem', marginBottom: '1rem', color: 'var(--text-main)' }}>Intégration IA (Ollama Local)</h4>
<div className="form-group">
<label>URL de l'API Ollama</label>
<input type="text" className="form-control" value={formData.ollamaUrl} onChange={e => setFormData({...formData, ollamaUrl: e.target.value})} placeholder="ex: http://localhost:11434" />
</div>
<div className="form-group" style={{ marginBottom: 0 }}>
<label>Nom du modèle (ex: qwen:7b, llama3)</label>
<input type="text" className="form-control" value={formData.ollamaModel} onChange={e => setFormData({...formData, ollamaModel: e.target.value})} placeholder="ex: qwen:7b" />
</div>
</div>
return (
<Dialog open={true} onOpenChange={onClose}>
<DialogContent className="sm:max-w-[600px] max-h-[90vh] overflow-hidden flex flex-col p-0">
<DialogHeader className="p-6 pb-2 border-b">
<DialogTitle className="text-2xl font-bold tracking-tight">Paramètres Globaux</DialogTitle>
</DialogHeader>
<div style={{ padding: '1.5rem', background: 'rgba(234, 179, 8, 0.05)', borderRadius: '8px', border: '1px solid rgba(234, 179, 8, 0.2)', marginBottom: '1.5rem' }}>
<h4 style={{ fontSize: '1rem', marginBottom: '1rem', color: 'var(--text-main)' }}>Recherche Web (SearXNG)</h4>
<div className="form-group" style={{ marginBottom: 0 }}>
<label>URL de SearXNG (pour enrichir l'IA)</label>
<input type="text" className="form-control" value={formData.searxngUrl} onChange={e => setFormData({...formData, searxngUrl: e.target.value})} placeholder="ex: http://localhost:8080" />
<div className="flex-1 overflow-y-auto p-6 pt-2 space-y-8 scrollbar-thin">
{/* Notion Integration */}
<section className="space-y-4">
<div className="flex items-center gap-2 text-primary font-semibold">
<LinkIcon size={18} />
<h4>Intégration Notion</h4>
</div>
<div className="grid gap-4 bg-muted/30 p-4 rounded-xl border">
<div className="grid gap-2">
<Label htmlFor="notionToken">Token d'intégration (Internal App)</Label>
<Input
id="notionToken"
type="password"
value={formData.notionToken}
onChange={e => setFormData({...formData, notionToken: e.target.value})}
placeholder="secret_..."
/>
</div>
<div className="grid gap-2">
<Label htmlFor="notionDbId">ID de la base de données</Label>
<Input
id="notionDbId"
type="text"
value={formData.notionDbId}
onChange={e => setFormData({...formData, notionDbId: e.target.value})}
placeholder="ex: a1b2c3d4e5f6..."
/>
</div>
</div>
</section>
{/* AI Integration */}
<section className="space-y-4">
<div className="flex items-center gap-2 text-secondary font-semibold">
<Cpu size={18} />
<h4>Intégration IA (Ollama Local)</h4>
</div>
<div className="grid gap-4 bg-secondary/5 p-4 rounded-xl border border-secondary/20">
<div className="grid gap-2">
<Label htmlFor="ollamaUrl">URL de l'API Ollama</Label>
<Input
id="ollamaUrl"
type="text"
value={formData.ollamaUrl}
onChange={e => setFormData({...formData, ollamaUrl: e.target.value})}
placeholder="ex: http://localhost:11434"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="ollamaModel">Nom du modèle</Label>
<Input
id="ollamaModel"
type="text"
value={formData.ollamaModel}
onChange={e => setFormData({...formData, ollamaModel: e.target.value})}
placeholder="ex: qwen:7b, llama3"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="language">Langue de sortie</Label>
<Select
value={formData.aiLanguage}
onValueChange={(val) => setFormData({...formData, aiLanguage: val})}
>
<SelectTrigger id="language">
<SelectValue placeholder="Choisir une langue" />
</SelectTrigger>
<SelectContent>
<SelectItem value="Français">Français</SelectItem>
<SelectItem value="English">English</SelectItem>
<SelectItem value="Español">Español</SelectItem>
<SelectItem value="Deutsch">Deutsch</SelectItem>
<SelectItem value="Italiano">Italiano</SelectItem>
</SelectContent>
</Select>
</div>
</div>
</section>
{/* Search Integration */}
<section className="space-y-4">
<div className="flex items-center gap-2 text-amber-500 font-semibold">
<Globe size={18} />
<h4>Recherche Web (SearXNG)</h4>
</div>
<div className="grid gap-4 bg-amber-500/5 p-4 rounded-xl border border-amber-500/20">
<div className="grid gap-2">
<Label htmlFor="searxngUrl">URL de SearXNG (enrichissement IA)</Label>
<Input
id="searxngUrl"
type="text"
value={formData.searxngUrl}
onChange={e => setFormData({...formData, searxngUrl: e.target.value})}
placeholder="ex: http://localhost:8080"
/>
</div>
</div>
</section>
</div>
<DialogFooter className="p-6 border-t bg-muted/10">
<div className="flex items-center justify-between w-full">
<div className="flex items-center gap-2">
{saved && (
<div className="flex items-center gap-1.5 text-green-500 animate-in fade-in slide-in-from-left-1">
<CheckCircle2 size={16} />
<span className="text-sm font-medium">Sauvegardé avec succès</span>
</div>
)}
</div>
<div className="flex gap-2">
<Button variant="ghost" onClick={onClose}>Fermer</Button>
<Button onClick={handleSubmit}>Enregistrer les modifications</Button>
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: '1rem', alignItems: 'center' }}>
{saved && <span style={{ color: 'var(--success-color)', fontSize: '0.875rem' }}>Sauvegardé !</span>}
<button type="button" className="btn" onClick={onClose}>Fermer</button>
<button type="submit" className="btn btn-primary">Enregistrer</button>
</div>
</form>
</div>
</div>,
document.body
</DialogFooter>
</DialogContent>
</Dialog>
);
}