Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fd82d77709 | ||
|
|
189a2e4bf6 | ||
|
|
e322435bd8 |
+177
-148
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<div id="app" class="flex w-full h-full relative bg-aethas-dark">
|
<div id="app" class="flex w-full h-full relative bg-aethas-dark">
|
||||||
|
|
||||||
<!-- MODAL PARAMÈTRES (Sécurité) -->
|
<!-- MODAL PARAMÈTRES -->
|
||||||
<div v-if="isSettingsModalOpen" class="fixed inset-0 bg-black/80 z-[100] flex items-center justify-center p-4">
|
<div v-if="isSettingsModalOpen" class="fixed inset-0 bg-black/80 z-[100] flex items-center justify-center p-4">
|
||||||
<div class="bg-aethas-panel border border-gray-600 rounded-2xl w-full max-w-md overflow-hidden shadow-[0_0_30px_rgba(0,0,0,0.7)]">
|
<div class="bg-aethas-panel border border-gray-600 rounded-2xl w-full max-w-md overflow-hidden shadow-[0_0_30px_rgba(0,0,0,0.7)]">
|
||||||
<div class="p-4 border-b border-gray-700 flex justify-between items-center bg-gray-800/50">
|
<div class="p-4 border-b border-gray-700 flex justify-between items-center bg-gray-800/50">
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1 overflow-y-auto p-4 space-y-6">
|
<div class="flex-1 overflow-y-auto p-4 space-y-6 custom-scrollbar">
|
||||||
<div v-if="pinnedProjects.length > 0">
|
<div v-if="pinnedProjects.length > 0">
|
||||||
<h3 class="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2">Épinglés</h3>
|
<h3 class="text-xs font-semibold text-gray-400 uppercase tracking-wider mb-2">Épinglés</h3>
|
||||||
<ul class="space-y-1">
|
<ul class="space-y-1">
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- NOUVEAU : ENCART FINANCIER SOUS LE MENU RÉCENTS -->
|
<!-- ENCART FINANCIER -->
|
||||||
<div class="px-4 pb-2 border-b border-gray-700">
|
<div class="px-4 pb-2 border-b border-gray-700">
|
||||||
<div v-if="financesList.length > 0" class="flex flex-col gap-1.5 mb-2">
|
<div v-if="financesList.length > 0" class="flex flex-col gap-1.5 mb-2">
|
||||||
<div v-for="fin in financesList" :key="fin.provider" class="text-[10px] bg-gray-800/80 border border-gray-600/50 px-2 py-1.5 rounded flex justify-between items-center shadow-inner">
|
<div v-for="fin in financesList" :key="fin.provider" class="text-[10px] bg-gray-800/80 border border-gray-600/50 px-2 py-1.5 rounded flex justify-between items-center shadow-inner">
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="p-4 flex justify-between items-center cursor-pointer hover:bg-gray-800 transition-colors" @click="activeView = 'settings'">
|
<div class="p-4 flex justify-between items-center cursor-pointer hover:bg-gray-800 transition-colors" @click="openSettings">
|
||||||
<div class="flex items-center gap-2">
|
<div class="flex items-center gap-2">
|
||||||
<img v-if="user.avatar_path" :src="user.avatar_path" class="w-8 h-8 rounded-full object-cover border border-gray-600 bg-gray-900">
|
<img v-if="user.avatar_path" :src="user.avatar_path" class="w-8 h-8 rounded-full object-cover border border-gray-600 bg-gray-900">
|
||||||
<div v-else class="w-8 h-8 rounded-full bg-gradient-to-tr from-aethas-cyan to-aethas-purple flex items-center justify-center text-sm font-bold shadow-md">{{ user.username.charAt(0).toUpperCase() }}</div>
|
<div v-else class="w-8 h-8 rounded-full bg-gradient-to-tr from-aethas-cyan to-aethas-purple flex items-center justify-center text-sm font-bold shadow-md">{{ user.username.charAt(0).toUpperCase() }}</div>
|
||||||
@@ -136,77 +136,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<!-- VUE : CONFIGURATION (Par Niveaux) -->
|
<!-- VUE : MODÈLES ET FINANCES -->
|
||||||
<div v-if="activeView === 'settings'" class="flex-1 overflow-y-auto p-4 md:p-8">
|
<div v-if="activeView === 'models' && user.is_admin" class="flex-1 overflow-y-auto p-4 md:p-8 space-y-6 custom-scrollbar">
|
||||||
<div class="max-w-4xl mx-auto space-y-6">
|
|
||||||
<h2 class="text-2xl font-bold text-white flex items-center gap-2 border-b border-gray-700 pb-4"><i data-lucide="settings-2" class="w-6 h-6 text-aethas-cyan"></i> Configuration Système</h2>
|
|
||||||
|
|
||||||
<div class="flex border-b border-gray-700">
|
|
||||||
<button @click="settingsTab = 'user'" :class="['py-2 px-4 text-sm font-semibold border-b-2 transition-colors', settingsTab === 'user' ? 'border-aethas-cyan text-aethas-cyan' : 'border-transparent text-gray-400 hover:text-white']">Mon Profil (Utilisateur)</button>
|
|
||||||
<button v-if="user.is_admin" @click="settingsTab = 'admin'" :class="['py-2 px-4 text-sm font-semibold border-b-2 transition-colors', settingsTab === 'admin' ? 'border-red-500 text-red-400' : 'border-transparent text-gray-400 hover:text-white']">Administration</button>
|
|
||||||
<button v-if="user.is_superadmin" @click="settingsTab = 'super'" :class="['py-2 px-4 text-sm font-semibold border-b-2 transition-colors', settingsTab === 'super' ? 'border-aethas-purple text-purple-400' : 'border-transparent text-gray-400 hover:text-white']">Super-Admin</button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tab: Utilisateur -->
|
|
||||||
<div v-if="settingsTab === 'user'" class="space-y-6">
|
|
||||||
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700">
|
|
||||||
<h3 class="text-lg font-semibold text-white mb-4">Personnalisation du Profil</h3>
|
|
||||||
<div class="flex items-center gap-6">
|
|
||||||
<img v-if="user.avatar_path" :src="user.avatar_path" class="w-20 h-20 rounded-full object-cover border-2 border-aethas-cyan bg-gray-900 shadow-lg">
|
|
||||||
<div v-else class="w-20 h-20 rounded-full bg-gradient-to-tr from-aethas-cyan to-aethas-purple flex items-center justify-center text-2xl font-bold shadow-lg">{{ user.username.charAt(0).toUpperCase() }}</div>
|
|
||||||
<div class="flex-1">
|
|
||||||
<label class="bg-aethas-panel hover:bg-gray-700 text-white border border-gray-600 px-4 py-2 rounded-lg cursor-pointer transition-colors text-sm inline-block">
|
|
||||||
<i data-lucide="upload" class="w-4 h-4 inline mr-1"></i> Uploader un nouvel Avatar
|
|
||||||
<input type="file" accept="image/*" @change="uploadAvatar" class="hidden">
|
|
||||||
</label>
|
|
||||||
<p class="text-xs text-gray-500 mt-2">L'image sera automatiquement recadrée et redimensionnée à l'affichage pour s'adapter parfaitement à l'interface.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700">
|
|
||||||
<h3 class="text-lg font-semibold text-white mb-4">Sécurité</h3>
|
|
||||||
<div v-if="settingsMessage" class="p-3 rounded text-sm mb-4 bg-gray-900 border border-aethas-cyan text-aethas-cyan">{{ settingsMessage }}</div>
|
|
||||||
<div class="grid gap-4 max-w-md">
|
|
||||||
<input v-model="passForm.old" type="password" placeholder="Ancien mot de passe" class="bg-aethas-dark border border-gray-600 rounded-lg px-4 py-2 focus:border-aethas-cyan focus:outline-none">
|
|
||||||
<input v-model="passForm.new" type="password" placeholder="Nouveau mot de passe" class="bg-aethas-dark border border-gray-600 rounded-lg px-4 py-2 focus:border-aethas-cyan focus:outline-none">
|
|
||||||
<input v-model="passForm.confirm" type="password" placeholder="Confirmer" class="bg-aethas-dark border border-gray-600 rounded-lg px-4 py-2 focus:border-aethas-cyan focus:outline-none">
|
|
||||||
<button @click="changePassword" :disabled="isSavingSettings" class="bg-gray-700 hover:bg-gray-600 text-white font-semibold py-2 px-4 rounded-lg disabled:opacity-50">Modifier le mot de passe</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tab: Admin -->
|
|
||||||
<div v-if="settingsTab === 'admin' && user.is_admin" class="space-y-6">
|
|
||||||
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700">
|
|
||||||
<h3 class="text-lg font-semibold text-red-400 mb-4">Outils Administrateur</h3>
|
|
||||||
<p class="text-sm text-gray-400 mb-4">Fonctionnalités réservées aux administrateurs pour la gestion des modèles et le suivi de base.</p>
|
|
||||||
<div class="flex gap-4">
|
|
||||||
<button @click="activeView = 'models'" class="bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded-lg text-sm border border-gray-600">Ouvrir le panneau Modèles IA</button>
|
|
||||||
<a href="/api/models/export" target="_blank" class="bg-gray-700 hover:bg-gray-600 text-white px-4 py-2 rounded-lg text-sm border border-gray-600">Exporter DB Modèles (JSON)</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Tab: Super-Admin -->
|
|
||||||
<div v-if="settingsTab === 'super' && user.is_superadmin" class="space-y-6">
|
|
||||||
<div class="bg-gray-800 p-6 rounded-xl border border-gray-700 border-l-4 border-l-aethas-purple">
|
|
||||||
<h3 class="text-lg font-semibold text-purple-400 mb-4">Espace Réservé Super-Admin</h3>
|
|
||||||
<p class="text-sm text-gray-400">La gestion complète du serveur mail, des clés API et de l'élévation des droits utilisateurs sera disponible ici lors du prochain patch de développement.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- VUE : MODÈLES ET FINANCES (Admin Only) -->
|
|
||||||
<div v-if="activeView === 'models' && user.is_admin" class="flex-1 overflow-y-auto p-4 md:p-8 space-y-6">
|
|
||||||
<div class="flex justify-between items-end border-b border-gray-700 pb-4">
|
<div class="flex justify-between items-end border-b border-gray-700 pb-4">
|
||||||
<div>
|
<div>
|
||||||
<h2 class="text-2xl font-bold text-white flex items-center gap-2"><i data-lucide="cpu" class="w-6 h-6 text-aethas-cyan"></i> Modèles & Finances API</h2>
|
<h2 class="text-2xl font-bold text-white flex items-center gap-2"><i data-lucide="cpu" class="w-6 h-6 text-aethas-cyan"></i> Modèles & Finances API</h2>
|
||||||
<p class="text-sm text-gray-400 mt-1">Dernière extraction : <span class="text-gray-200 font-mono">{{ formatDate(modelInfo.last_sync_date) }}</span> <span class="text-xs bg-gray-800 px-2 py-0.5 rounded border border-gray-600 ml-2 uppercase">{{ modelInfo.last_sync_type || 'Aucune' }}</span></p>
|
<p class="text-sm text-gray-400 mt-1">Dernière extraction : <span class="text-gray-200 font-mono">{{ formatDate(modelInfo.last_sync_date) }}</span> <span class="text-xs bg-gray-800 px-2 py-0.5 rounded border border-gray-600 ml-2 uppercase">{{ modelInfo.last_sync_type || 'Aucune' }}</span></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<button @click="syncModels" :disabled="isSyncing" class="bg-aethas-cyan hover:bg-cyan-600 text-aethas-dark font-semibold py-2 px-4 rounded flex items-center gap-2 text-sm disabled:opacity-50"><i data-lucide="refresh-cw" :class="{'animate-spin': isSyncing}" class="w-4 h-4"></i> Forcer Extraction</button>
|
||||||
<button @click="syncModels" :disabled="isSyncing" class="bg-aethas-cyan hover:bg-cyan-600 text-aethas-dark font-semibold py-2 px-4 rounded flex items-center gap-2 text-sm disabled:opacity-50"><i data-lucide="refresh-cw" :class="{'animate-spin': isSyncing}" class="w-4 h-4"></i> Forcer Extraction</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
@@ -253,86 +190,151 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- VUE : CHAT PAR DÉFAUT -->
|
<!-- VUE : CHAT -->
|
||||||
<template v-if="activeView === 'chat'">
|
<div v-show="activeView === 'chat'" class="flex-1 flex flex-col min-h-0">
|
||||||
<div v-if="!activeProject" class="flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center">
|
<div v-if="!activeProject" class="flex-1 overflow-y-auto p-4 flex flex-col items-center justify-center">
|
||||||
<img src="/assets/logo.png" class="w-24 h-24 mb-6 rounded-full border-2 border-aethas-cyan shadow-[0_0_15px_rgba(6,182,212,0.5)]">
|
<img src="/assets/logo.png" class="w-24 h-24 mb-6 rounded-full border-2 border-aethas-cyan shadow-[0_0_15px_rgba(6,182,212,0.5)]">
|
||||||
<h2 class="text-2xl font-bold text-gray-200 mb-2">Comment puis-je vous aider aujourd'hui ?</h2>
|
<h2 class="text-2xl font-bold text-gray-200 mb-2">Comment puis-je vous aider aujourd'hui ?</h2>
|
||||||
|
<p class="text-gray-500 text-sm">Sélectionnez ou créez un projet dans la barre latérale.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-else class="flex-1 overflow-y-auto p-4 md:p-8 space-y-6 flex flex-col custom-scrollbar" id="chat-container">
|
<template v-else>
|
||||||
<div v-if="messages.length === 0" class="flex-1 flex items-center justify-center text-gray-500 italic">Démarrez la conversation ci-dessous.</div>
|
<div class="flex-1 overflow-y-auto p-4 md:p-8 space-y-6 flex flex-col custom-scrollbar" id="chat-container">
|
||||||
|
<div v-if="messages.length === 0" class="flex-1 flex items-center justify-center text-gray-500 italic">Démarrez la conversation ci-dessous.</div>
|
||||||
|
|
||||||
<div v-for="msg in messages" :key="msg.id" :class="['max-w-4xl rounded-2xl p-4', msg.role === 'user' ? 'bg-gray-800 ml-auto border border-gray-700' : 'bg-aethas-panel mr-auto border border-aethas-cyan/30 flex flex-col']">
|
<div v-for="msg in messages" :key="msg.id" :class="['max-w-4xl rounded-2xl p-4', msg.role === 'user' ? 'bg-gray-800 ml-auto border border-gray-700' : 'bg-aethas-panel mr-auto border border-aethas-cyan/30 flex flex-col']">
|
||||||
<div class="flex items-center gap-2 mb-2">
|
<div class="flex items-center gap-2 mb-2">
|
||||||
<img v-if="msg.role === 'user' && user.avatar_path" :src="user.avatar_path" class="w-5 h-5 rounded-full object-cover">
|
<img v-if="msg.role === 'user' && user.avatar_path" :src="user.avatar_path" class="w-5 h-5 rounded-full object-cover">
|
||||||
<span class="text-xs font-semibold uppercase tracking-wider text-gray-400">{{ msg.role === 'user' ? 'Vous' : 'AETHAS38' }}</span>
|
<span class="text-xs font-semibold uppercase tracking-wider text-gray-400">{{ msg.role === 'user' ? 'Vous' : 'AETHAS38' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="text-gray-200 text-sm leading-relaxed w-full">
|
<div class="text-gray-200 text-sm leading-relaxed w-full">
|
||||||
<template v-for="(part, index) in parseMessage(msg.content)" :key="index">
|
<template v-for="(part, index) in parseMessage(msg.content)" :key="index">
|
||||||
<div v-if="part.type === 'text'" class="whitespace-pre-wrap font-sans">{{ part.content }}</div>
|
<div v-if="part.type === 'text'" class="whitespace-pre-wrap font-sans">{{ part.content }}</div>
|
||||||
<div v-if="part.type === 'code'" class="my-4 bg-gray-900 rounded-lg border border-gray-700 overflow-hidden shadow-inner">
|
<div v-if="part.type === 'code'" class="my-4 bg-gray-900 rounded-lg border border-gray-700 overflow-hidden shadow-inner">
|
||||||
<div class="flex justify-between items-center px-4 py-2 bg-gray-800 border-b border-gray-700">
|
<div class="flex justify-between items-center px-4 py-2 bg-gray-800 border-b border-gray-700">
|
||||||
<span class="text-xs text-gray-400 font-mono flex items-center gap-2"><i data-lucide="file-code-2" class="w-4 h-4"></i> {{ part.language || 'code' }}</span>
|
<span class="text-xs text-gray-400 font-mono flex items-center gap-2"><i data-lucide="file-code-2" class="w-4 h-4"></i> {{ part.language || 'code' }}</span>
|
||||||
<button @click="downloadFile(part.content, part.language)" class="text-aethas-cyan hover:text-white flex items-center gap-1 text-xs transition-colors bg-gray-700 hover:bg-gray-600 px-2 py-1 rounded"><i data-lucide="download" class="w-3 h-3"></i> Fichier</button>
|
<button @click="downloadFile(part.content, part.language)" class="text-aethas-cyan hover:text-white flex items-center gap-1 text-xs transition-colors bg-gray-700 hover:bg-gray-600 px-2 py-1 rounded"><i data-lucide="download" class="w-3 h-3"></i> Fichier</button>
|
||||||
|
</div>
|
||||||
|
<pre class="p-4 text-xs font-mono text-gray-300 overflow-x-auto custom-scrollbar"><code>{{ part.content }}</code></pre>
|
||||||
</div>
|
</div>
|
||||||
<pre class="p-4 text-xs font-mono text-gray-300 overflow-x-auto custom-scrollbar"><code>{{ part.content }}</code></pre>
|
</template>
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="msg.role !== 'user'" class="mt-3 flex items-center gap-3 border-t border-gray-700/50 pt-2 opacity-50 hover:opacity-100 transition-opacity">
|
|
||||||
<button @click="copyToClipboard(msg.content)" class="text-xs text-gray-400 hover:text-aethas-cyan flex items-center gap-1"><i data-lucide="copy" class="w-3 h-3"></i> Copier</button>
|
|
||||||
<button @click="downloadMessage(msg.content, msg.created_at)" class="text-xs text-gray-400 hover:text-aethas-cyan flex items-center gap-1"><i data-lucide="file-down" class="w-3 h-3"></i> Extraire</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="isAiThinking" class="max-w-3xl rounded-2xl p-4 bg-aethas-panel mr-auto border border-aethas-cyan/30 w-24">
|
|
||||||
<div class="flex space-x-1.5 h-4 items-center">
|
|
||||||
<div class="w-2 h-2 bg-aethas-cyan rounded-full animate-bounce"></div>
|
|
||||||
<div class="w-2 h-2 bg-aethas-cyan rounded-full animate-bounce" style="animation-delay: 0.15s"></div>
|
|
||||||
<div class="w-2 h-2 bg-aethas-cyan rounded-full animate-bounce" style="animation-delay: 0.3s"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- ZONE SÉLECTION MODÈLES PAR REQUÊTE -->
|
|
||||||
<div v-if="activeProject" class="p-4 md:p-6 w-full max-w-5xl mx-auto space-y-2">
|
|
||||||
<div class="bg-gray-800/80 border border-gray-700 rounded-xl p-3 flex flex-wrap gap-4 items-center text-xs shadow-md">
|
|
||||||
<div class="flex items-center gap-2 flex-1 min-w-[200px]">
|
|
||||||
<span class="text-aethas-cyan font-semibold w-20"><i data-lucide="users" class="w-3 h-3 inline"></i> Travailleurs:</span>
|
|
||||||
<select multiple v-model="selectedWorkers" @change="limitWorkers" class="bg-aethas-dark border border-gray-600 rounded px-2 py-1 text-gray-200 w-full h-16 outline-none focus:border-aethas-cyan custom-scrollbar">
|
|
||||||
<option value="gemini-3.5-flash-lite">Gemini 3.5 Flash-Lite (Direct)</option>
|
|
||||||
<option v-for="m in modelInfo.models" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }} ({{ m.domain }})</option>
|
|
||||||
</select>
|
|
||||||
<span class="text-gray-500 ml-1">{{ selectedWorkers.length }}/5</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-2 flex-1 min-w-[200px]" :class="{'opacity-30 pointer-events-none': selectedWorkers.length <= 1}">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<span class="text-gray-400 font-semibold w-24"><i data-lucide="edit-3" class="w-3 h-3 inline"></i> Prompteur:</span>
|
|
||||||
<select v-model="selectedPrompter" class="bg-aethas-dark border border-gray-600 rounded px-2 py-1 text-gray-200 flex-1 outline-none truncate">
|
|
||||||
<option value="gemini-3.5-flash-lite">Gemini 3.5 Flash-Lite (Direct)</option>
|
|
||||||
<option v-for="m in modelInfo.models" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<span class="text-aethas-purple font-semibold w-24"><i data-lucide="git-merge" class="w-3 h-3 inline"></i> Concaténeur:</span>
|
<div v-if="msg.role !== 'user'" class="mt-3 flex items-center gap-3 border-t border-gray-700/50 pt-2 opacity-50 hover:opacity-100 transition-opacity">
|
||||||
<select v-model="selectedConcatenator" class="bg-aethas-dark border border-gray-600 rounded px-2 py-1 text-gray-200 flex-1 outline-none truncate">
|
<button @click="copyToClipboard(msg.content)" class="text-xs text-gray-400 hover:text-aethas-cyan flex items-center gap-1"><i data-lucide="copy" class="w-3 h-3"></i> Copier</button>
|
||||||
<option value="gemini-3.5-flash-lite">Gemini 3.5 Flash-Lite (Direct)</option>
|
<button @click="downloadMessage(msg.content, msg.created_at)" class="text-xs text-gray-400 hover:text-aethas-cyan flex items-center gap-1"><i data-lucide="file-down" class="w-3 h-3"></i> Extraire</button>
|
||||||
<option v-for="m in modelInfo.models" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
</div>
|
||||||
</select>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="isAiThinking" class="max-w-3xl rounded-2xl p-4 bg-aethas-panel mr-auto border border-aethas-cyan/30 w-24">
|
||||||
|
<div class="flex space-x-1.5 h-4 items-center">
|
||||||
|
<div class="w-2 h-2 bg-aethas-cyan rounded-full animate-bounce"></div>
|
||||||
|
<div class="w-2 h-2 bg-aethas-cyan rounded-full animate-bounce" style="animation-delay: 0.15s"></div>
|
||||||
|
<div class="w-2 h-2 bg-aethas-cyan rounded-full animate-bounce" style="animation-delay: 0.3s"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative flex items-end bg-gray-800 border border-gray-600 rounded-2xl p-2 shadow-lg focus-within:border-aethas-cyan">
|
<!-- BARRE DE SÉLECTION DE STYLE TABULAIRE (9 COLONNES STRICTES) -->
|
||||||
<textarea v-model="prompt" @input="autoResize" @keydown.enter.exact.prevent="sendMessage" ref="promptTextarea" :disabled="isAiThinking" rows="1" class="w-full bg-transparent text-gray-200 p-3 max-h-[200px] overflow-y-auto focus:outline-none resize-none disabled:opacity-50 custom-scrollbar" placeholder="Sélectionnez vos modèles ci-dessus, puis posez votre question..."></textarea>
|
<div class="p-4 md:p-6 w-full max-w-7xl mx-auto space-y-2 flex-shrink-0">
|
||||||
<button @click="sendMessage" :disabled="!prompt.trim() || isAiThinking" class="p-3 text-aethas-cyan hover:text-white disabled:opacity-50"><i data-lucide="send" class="w-5 h-5"></i></button>
|
<div class="grid grid-cols-9 border border-black bg-gray-900 rounded-lg overflow-hidden text-center text-xs font-bold shadow-lg">
|
||||||
|
|
||||||
|
<!-- 1. PAYANT / GRATUIT -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-gray-400 mb-1">PRIX</label>
|
||||||
|
<select v-model="filterPricing" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none">
|
||||||
|
<option value="">TOUS</option>
|
||||||
|
<option value="free">GRATUIT</option>
|
||||||
|
<option value="paid">PAYANT</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 2. TYPE (DOMAINE) -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-gray-400 mb-1">TYPE</label>
|
||||||
|
<select v-model="filterDomain" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none">
|
||||||
|
<option value="">TOUS</option>
|
||||||
|
<option value="Texte Polyvalent">Texte</option>
|
||||||
|
<option value="Code & Logique">Codage</option>
|
||||||
|
<option value="Vision & Texte">Vision</option>
|
||||||
|
<option value="Audio">Audio</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 3. TRAVAILLEUR 1 -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-aethas-cyan mb-1">TRAVAILLEUR 1</label>
|
||||||
|
<select v-model="workers[0]" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="">(Aucun)</option>
|
||||||
|
<option v-for="m in filteredBarModels" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 4. TRAVAILLEUR 2 -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-aethas-cyan mb-1">TRAVAILLEUR 2</label>
|
||||||
|
<select v-model="workers[1]" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="">(Aucun)</option>
|
||||||
|
<option v-for="m in filteredBarModels" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 5. TRAVAILLEUR 3 -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-aethas-cyan mb-1">TRAVAILLEUR 3</label>
|
||||||
|
<select v-model="workers[2]" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="">(Aucun)</option>
|
||||||
|
<option v-for="m in filteredBarModels" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 6. TRAVAILLEUR 4 -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-aethas-cyan mb-1">TRAVAILLEUR 4</label>
|
||||||
|
<select v-model="workers[3]" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="">(Aucun)</option>
|
||||||
|
<option v-for="m in filteredBarModels" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 7. TRAVAILLEUR 5 -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-aethas-cyan mb-1">TRAVAILLEUR 5</label>
|
||||||
|
<select v-model="workers[4]" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="">(Aucun)</option>
|
||||||
|
<option v-for="m in filteredBarModels" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 8. PROMPTEUR -->
|
||||||
|
<div class="border-r border-black p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-gray-400 mb-1">PROMPTEUR</label>
|
||||||
|
<select v-model="selectedPrompter" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="gemini-3.5-flash-lite">Gemini Flash</option>
|
||||||
|
<option v-for="m in modelInfo.models" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- 9. CONCATENEUR -->
|
||||||
|
<div class="p-1.5 bg-gray-800 flex flex-col justify-center">
|
||||||
|
<label class="block text-[9px] text-aethas-purple mb-1">CONCATENEUR</label>
|
||||||
|
<select v-model="selectedConcatenator" class="w-full bg-aethas-dark border border-gray-700 rounded text-gray-200 text-[10px] p-1 outline-none truncate">
|
||||||
|
<option value="gemini-3.5-flash-lite">Gemini Flash</option>
|
||||||
|
<option v-for="m in modelInfo.models" :key="m.model_id" :value="m.model_id">{{ m.name || m.model_id }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Champ de texte du message -->
|
||||||
|
<div class="relative flex items-end bg-gray-800 border border-gray-600 rounded-2xl p-2 shadow-lg focus-within:border-aethas-cyan">
|
||||||
|
<textarea v-model="prompt" @input="autoResize" @keydown.enter.exact.prevent="sendMessage" ref="promptTextarea" :disabled="isAiThinking" rows="1" class="w-full bg-transparent text-gray-200 p-3 max-h-[200px] overflow-y-auto focus:outline-none resize-none disabled:opacity-50 custom-scrollbar" placeholder="Posez votre question à l'orchestrateur..."></textarea>
|
||||||
|
<button @click="sendMessage" :disabled="!prompt.trim() || isAiThinking" class="p-3 text-aethas-cyan hover:text-white disabled:opacity-50"><i data-lucide="send" class="w-5 h-5"></i></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
</template>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -357,6 +359,7 @@
|
|||||||
const isSyncing = ref(false);
|
const isSyncing = ref(false);
|
||||||
const isSavingSettings = ref(false);
|
const isSavingSettings = ref(false);
|
||||||
|
|
||||||
|
const isSettingsModalOpen = ref(false);
|
||||||
const settingsMessage = ref("");
|
const settingsMessage = ref("");
|
||||||
const passForm = reactive({ old: '', new: '', confirm: '' });
|
const passForm = reactive({ old: '', new: '', confirm: '' });
|
||||||
|
|
||||||
@@ -366,7 +369,7 @@
|
|||||||
const filterDomain = ref("");
|
const filterDomain = ref("");
|
||||||
const filterPricing = ref("");
|
const filterPricing = ref("");
|
||||||
|
|
||||||
const selectedWorkers = ref(["gemini-3.5-flash-lite"]);
|
const workers = ref(["gemini-3.5-flash-lite", "", "", "", ""]);
|
||||||
const selectedPrompter = ref("gemini-3.5-flash-lite");
|
const selectedPrompter = ref("gemini-3.5-flash-lite");
|
||||||
const selectedConcatenator = ref("gemini-3.5-flash-lite");
|
const selectedConcatenator = ref("gemini-3.5-flash-lite");
|
||||||
|
|
||||||
@@ -384,6 +387,16 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const filteredBarModels = computed(() => {
|
||||||
|
return modelInfo.models.filter(m => {
|
||||||
|
const matchDomain = filterDomain.value === "" || m.domain === filterDomain.value;
|
||||||
|
let matchPrice = true;
|
||||||
|
if (filterPricing.value === 'free') matchPrice = m.is_free;
|
||||||
|
if (filterPricing.value === 'paid') matchPrice = !m.is_free;
|
||||||
|
return matchDomain && matchPrice;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
const formatDate = (isoString) => {
|
const formatDate = (isoString) => {
|
||||||
if (!isoString) return "Jamais";
|
if (!isoString) return "Jamais";
|
||||||
const d = new Date(isoString);
|
const d = new Date(isoString);
|
||||||
@@ -394,6 +407,9 @@
|
|||||||
const autoResize = () => { const el = promptTextarea.value; if(el){ el.style.height = 'auto'; el.style.height = el.scrollHeight + 'px'; }};
|
const autoResize = () => { const el = promptTextarea.value; if(el){ el.style.height = 'auto'; el.style.height = el.scrollHeight + 'px'; }};
|
||||||
const scrollToBottom = () => { nextTick(() => { const c = document.getElementById('chat-container'); if (c) c.scrollTop = c.scrollHeight; }); };
|
const scrollToBottom = () => { nextTick(() => { const c = document.getElementById('chat-container'); if (c) c.scrollTop = c.scrollHeight; }); };
|
||||||
|
|
||||||
|
const openSettings = () => { isSettingsModalOpen.value = true; nextTick(() => lucide.createIcons()); };
|
||||||
|
const closeSettings = () => { isSettingsModalOpen.value = false; };
|
||||||
|
|
||||||
const fetchUser = async () => { try { const res = await fetch('/api/users/me'); if(res.ok) user.value = await res.json(); } catch(e){} };
|
const fetchUser = async () => { try { const res = await fetch('/api/users/me'); if(res.ok) user.value = await res.json(); } catch(e){} };
|
||||||
const fetchModelsInfo = async () => { try { const res = await fetch('/api/models/info'); if(res.ok) { const data = await res.json(); modelInfo.last_sync_date = data.last_sync_date; modelInfo.last_sync_type = data.last_sync_type; modelInfo.models = data.models; } } catch(e){} };
|
const fetchModelsInfo = async () => { try { const res = await fetch('/api/models/info'); if(res.ok) { const data = await res.json(); modelInfo.last_sync_date = data.last_sync_date; modelInfo.last_sync_type = data.last_sync_type; modelInfo.models = data.models; } } catch(e){} };
|
||||||
const fetchFinances = async () => { try { const res = await fetch('/api/finances'); if(res.ok) financesList.value = await res.json(); } catch(e){} };
|
const fetchFinances = async () => { try { const res = await fetch('/api/finances'); if(res.ok) financesList.value = await res.json(); } catch(e){} };
|
||||||
@@ -405,12 +421,13 @@
|
|||||||
if(res.ok) {
|
if(res.ok) {
|
||||||
await fetchModelsInfo();
|
await fetchModelsInfo();
|
||||||
await fetchFinances();
|
await fetchFinances();
|
||||||
alert("Synchronisation terminée !");
|
alert("Synchronisation réussie !");
|
||||||
} else {
|
} else {
|
||||||
const err = await res.json();
|
let errText = await res.text();
|
||||||
alert("Erreur: " + err.detail);
|
try { const errObj = JSON.parse(errText); errText = errObj.detail || errText; } catch(e){}
|
||||||
|
alert("Erreur retournée par le serveur : " + errText);
|
||||||
}
|
}
|
||||||
} catch(e) { alert("Erreur réseau de synchronisation."); }
|
} catch(e) { alert("Erreur réseau: impossible de contacter le serveur."); }
|
||||||
isSyncing.value = false;
|
isSyncing.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -438,17 +455,30 @@
|
|||||||
const createNewProject = async () => { activeView.value = 'chat'; isLoading.value = true; try { const res = await fetch('/api/projects', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({title: "Nouvelle discussion"})}); if(res.ok){ const np = await res.json(); projects.value.unshift(np); selectProject(np); } } catch(e){} finally{isLoading.value = false;} };
|
const createNewProject = async () => { activeView.value = 'chat'; isLoading.value = true; try { const res = await fetch('/api/projects', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({title: "Nouvelle discussion"})}); if(res.ok){ const np = await res.json(); projects.value.unshift(np); selectProject(np); } } catch(e){} finally{isLoading.value = false;} };
|
||||||
|
|
||||||
const sendMessage = async () => {
|
const sendMessage = async () => {
|
||||||
if (!prompt.value.trim() || !activeProject.value || selectedWorkers.value.length === 0) return;
|
const activeWorkers = workers.value.filter(w => w && w.trim() !== "");
|
||||||
|
if (!prompt.value.trim() || !activeProject.value || activeWorkers.length === 0) {
|
||||||
|
alert("Veuillez sélectionner au moins un travailleur.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
const userText = prompt.value.trim(); prompt.value = ""; autoResize();
|
const userText = prompt.value.trim(); prompt.value = ""; autoResize();
|
||||||
messages.value.push({ id: Date.now(), role: 'user', content: userText });
|
messages.value.push({ id: Date.now(), role: 'user', content: userText });
|
||||||
isAiThinking.value = true; scrollToBottom();
|
isAiThinking.value = true; scrollToBottom();
|
||||||
const payload = { role: 'user', content: userText, config: { workers: selectedWorkers.value, prompter: selectedPrompter.value, concatenator: selectedConcatenator.value } };
|
|
||||||
|
const payload = {
|
||||||
|
role: 'user',
|
||||||
|
content: userText,
|
||||||
|
config: {
|
||||||
|
workers: activeWorkers,
|
||||||
|
prompter: selectedPrompter.value,
|
||||||
|
concatenator: selectedConcatenator.value
|
||||||
|
}
|
||||||
|
};
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/projects/${activeProject.value.id}/messages`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) });
|
const response = await fetch(`/api/projects/${activeProject.value.id}/messages`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) });
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
if (Array.isArray(data)) messages.value = data;
|
if (Array.isArray(data)) messages.value = data;
|
||||||
await fetchFinances(); // MAJ du budget sous le nom
|
await fetchFinances();
|
||||||
} else {
|
} else {
|
||||||
const err = await response.json(); alert("Erreur API IA : " + err.detail);
|
const err = await response.json(); alert("Erreur API IA : " + err.detail);
|
||||||
}
|
}
|
||||||
@@ -466,7 +496,6 @@
|
|||||||
const renameProject = async (project) => { const nt = window.prompt("Nom :", project.title); if (!nt || nt.trim() === "" || nt === project.title) return; try { const res = await fetch(`/api/projects/${project.id}/rename`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ title: nt.trim() }) }); if (res.ok) { const up = await res.json(); const i = projects.value.findIndex(p => p.id === project.id); if (i !== -1) projects.value[i] = up; if (activeProject.value && activeProject.value.id === project.id) activeProject.value.title = up.title; } } catch (e) {} };
|
const renameProject = async (project) => { const nt = window.prompt("Nom :", project.title); if (!nt || nt.trim() === "" || nt === project.title) return; try { const res = await fetch(`/api/projects/${project.id}/rename`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ title: nt.trim() }) }); if (res.ok) { const up = await res.json(); const i = projects.value.findIndex(p => p.id === project.id); if (i !== -1) projects.value[i] = up; if (activeProject.value && activeProject.value.id === project.id) activeProject.value.title = up.title; } } catch (e) {} };
|
||||||
const togglePin = async (pid) => { try { const res = await fetch(`/api/projects/${pid}/pin`, { method: 'PUT' }); if (res.ok) { const up = await res.json(); const i = projects.value.findIndex(p => p.id === pid); if (i !== -1) projects.value[i] = up; } } catch (e) {} };
|
const togglePin = async (pid) => { try { const res = await fetch(`/api/projects/${pid}/pin`, { method: 'PUT' }); if (res.ok) { const up = await res.json(); const i = projects.value.findIndex(p => p.id === pid); if (i !== -1) projects.value[i] = up; } } catch (e) {} };
|
||||||
const deleteProject = async (pid) => { if (!confirm("Supprimer ce projet ?")) return; try { const res = await fetch(`/api/projects/${pid}`, { method: 'DELETE' }); if (res.ok) { projects.value = projects.value.filter(p => p.id !== pid); if (activeProject.value && activeProject.value.id === pid) activeProject.value = null; } } catch (e) {} };
|
const deleteProject = async (pid) => { if (!confirm("Supprimer ce projet ?")) return; try { const res = await fetch(`/api/projects/${pid}`, { method: 'DELETE' }); if (res.ok) { projects.value = projects.value.filter(p => p.id !== pid); if (activeProject.value && activeProject.value.id === pid) activeProject.value = null; } } catch (e) {} };
|
||||||
const limitWorkers = () => { if(selectedWorkers.value.length > 5) { selectedWorkers.value.pop(); alert("Max 5 travailleurs."); } };
|
|
||||||
|
|
||||||
onMounted(() => { lucide.createIcons(); fetchUser(); fetchProjects(); fetchModelsInfo(); fetchFinances(); });
|
onMounted(() => { lucide.createIcons(); fetchUser(); fetchProjects(); fetchModelsInfo(); fetchFinances(); });
|
||||||
|
|
||||||
@@ -474,9 +503,9 @@
|
|||||||
user, activeView, settingsTab, isSidebarOpen, toggleSidebar, prompt, autoResize, promptTextarea,
|
user, activeView, settingsTab, isSidebarOpen, toggleSidebar, prompt, autoResize, promptTextarea,
|
||||||
projects, pinnedProjects, recentProjects, activeProject, messages, isAiThinking,
|
projects, pinnedProjects, recentProjects, activeProject, messages, isAiThinking,
|
||||||
createNewProject, selectProject, renameProject, sendMessage, isLoading, togglePin, deleteProject,
|
createNewProject, selectProject, renameProject, sendMessage, isLoading, togglePin, deleteProject,
|
||||||
passForm, settingsMessage, isSavingSettings, changePassword, uploadAvatar,
|
isSettingsModalOpen, openSettings, closeSettings, passForm, settingsMessage, isSavingSettings, changePassword, uploadAvatar,
|
||||||
modelInfo, financesList, filterSearch, filterDomain, filterPricing, filteredModels, formatDate, syncModels, isSyncing,
|
modelInfo, financesList, filterSearch, filterDomain, filterPricing, filteredModels, filteredBarModels, formatDate, syncModels, isSyncing,
|
||||||
selectedWorkers, selectedPrompter, selectedConcatenator, limitWorkers,
|
workers, selectedPrompter, selectedConcatenator,
|
||||||
exportProject, copyToClipboard, downloadFile, downloadMessage, parseMessage
|
exportProject, copyToClipboard, downloadFile, downloadMessage, parseMessage
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user