Files
wevads-platform/scripts/hamid-architecture-doc.php
2026-02-26 04:53:11 +01:00

324 lines
19 KiB
PHP
Executable File

<?php header('Content-Type: text/html; charset=UTF-8'); ?>
<!DOCTYPE html>
<html data-theme="dark" lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WEVAL MIND - Documentation Architecture Complète</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #0a0a1a; color: #fff; line-height: 1.6; }
.container { max-width: 1400px; margin: 0 auto; padding: 40px 20px; }
h1 { text-align: center; font-size: 2.5rem; margin-bottom: 10px; background: linear-gradient(90deg, #9f7aea, #00d4ff); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.subtitle { text-align: center; color: #888; margin-bottom: 40px; }
h2 { color: #9f7aea; font-size: 1.5rem; margin: 40px 0 20px; padding-bottom: 10px; border-bottom: 2px solid #333; }
h3 { color: #00d4ff; font-size: 1.2rem; margin: 25px 0 15px; }
p { color: #ccc; margin-bottom: 15px; }
.schema { background: #111; border-radius: 10px; padding: 20px; margin: 20px 0; font-family: 'Courier New', monospace; font-size: 11px; overflow-x: auto; border: 1px solid #333; }
.schema pre { color: #00d4ff; white-space: pre; }
table { width: 100%; border-collapse: collapse; margin: 20px 0; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid #333; }
th { background: rgba(159,122,234,0.2); color: #9f7aea; }
tr:hover { background: rgba(255,255,255,0.05); }
.badge { display: inline-block; padding: 4px 12px; border-radius: 15px; font-size: 0.75rem; margin-right: 5px; }
.badge-green { background: #10b981; color: #fff; }
.badge-blue { background: #3b82f6; color: #fff; }
.badge-yellow { background: #f59e0b; color: #000; }
.badge-red { background: #ef4444; color: #fff; }
.badge-purple { background: #9f7aea; color: #fff; }
.card { background: rgba(255,255,255,0.05); border-radius: 15px; padding: 25px; margin: 20px 0; border: 1px solid #333; }
.card-title { font-size: 1.1rem; color: #fff; margin-bottom: 15px; display: flex; align-items: center; gap: 10px; }
.pros { color: #10b981; }
.cons { color: #ef4444; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.nav { position: fixed; top: 20px; right: 20px; background: #1a1a2e; padding: 15px; border-radius: 10px; border: 1px solid #333; z-index: 100; }
.nav a { display: block; color: #9f7aea; text-decoration: none; padding: 5px 0; font-size: 0.85rem; }
.nav a:hover { color: #00d4ff; }
@media (max-width: 768px) { .nav { display: none; } }
.highlight { background: linear-gradient(90deg, rgba(159,122,234,0.2), transparent); padding: 15px 20px; border-left: 4px solid #9f7aea; margin: 20px 0; border-radius: 0 10px 10px 0; }
.comparison { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin: 20px 0; }
.comp-item { background: #1a1a2e; padding: 15px; border-radius: 10px; text-align: center; }
.comp-item .value { font-size: 1.5rem; font-weight: bold; color: #00d4ff; }
.comp-item .label { font-size: 0.8rem; color: #888; }
.toc { background: #1a1a2e; padding: 20px; border-radius: 10px; margin-bottom: 30px; }
.toc-title { color: #9f7aea; margin-bottom: 15px; }
.toc-list { columns: 2; column-gap: 30px; }
.toc-list a { color: #ccc; text-decoration: none; display: block; padding: 3px 0; }
.toc-list a:hover { color: #00d4ff; }
</style>
</head>
<body>
<div class="container">
<h1>📊 WEVAL MIND - Architecture Complète</h1>
<p class="subtitle">Documentation technique des 8 interfaces et systèmes WEVAL MIND</p>
<!-- TABLE DES MATIÈRES -->
<div class="toc">
<div class="toc-title">📑 Table des matières</div>
<div class="toc-list">
<!-- btn-killed --></td></tr>
<tr><td>Fichier</td><td>/opt/wevads/public/hamid-cli.php (7 KB)</td></tr>
<tr><td>API Backend</td><td>hamid-api.php</td></tr>
<tr><td>Providers</td><td>26+ via dropdown standardisé</td></tr>
<tr><td>Rotation</td><td>✅ Oui - via hamid-api.php</td></tr>
</table>
<h3>Fonctionnalités</h3>
<p>
<span class="badge badge-green">Terminal Style</span>
<span class="badge badge-green">Command History</span>
<span class="badge badge-green">Provider Switch</span>
<span class="badge badge-blue">Retro Design</span>
</p>
<h3>Architecture</h3>
<div class="schema">
<pre>
● ● ● hamid@wevads:~ [Provider ▼] │
$ help │
WEVAL MIND CLI v2.0 - Commands available... │
$ Explique Docker │
[cerebras|523ms] Docker est une... │
$ /use cloudflare │
Provider changé: cloudflare │
───────────────────────────────────────── │
hamid@wevads:~$ _ │
Commandes spéciales:
- help - Affiche l'aide
- clear - Efface l'écran
- /use X - Change le provider
- /providers - Liste des providers
</pre>
</div>
<h3>Points forts / faibles</h3>
<p class="pros">✅ Style terminal authentique | ✅ Historique commandes | ✅ Léger | ✅ Fun à utiliser</p>
<p class="cons">❌ Pas adapté aux longues réponses | ❌ Pas de formatage Markdown | ❌ Interface limitée</p>
</div>
<!-- Interface 4: SSH Web -->
<div class="card">
<div class="card-title">📟 4. WEVAL MIND SSH WEB</div>
<table>
<tr><th>Propriété</th><th>Valeur</th></tr>
<tr><td>URL</td><td><!-- btn-killed --> (intégré)</td></tr>
<tr><td>Intégration</td><td>Widget flottant sur toutes les pages WEVAL</td></tr>
<tr><td>API Backend</td><td>hamid-api.php ou widget-api.php</td></tr>
</table>
<h3>Points forts / faibles</h3>
<p class="pros">✅ Accessible partout | ✅ Non-intrusif | ✅ Contextuel</p>
<p class="cons">❌ Fonctionnalités limitées | ❌ Petit écran</p>
</div>
<!-- 4. TABLEAU COMPARATIF -->
<!-- AJOUT: Interface 9 - Widget WEVAL intégré -->
<div class="card">
<div class="card-title">🔲 9. WEVAL MIND WIDGET WEVAL (Intégré Admin)</div>
<table>
<tr><th>Propriété</th><th>Valeur</th></tr>
<tr><td>Fichier</td><td>/opt/wevads/public/includes/chatbot-widget.php (19 KB)</td></tr>
<tr><td>Intégration</td><td>include("includes/chatbot-widget.php") dans 50+ pages</td></tr>
<tr><td>API Backend</td><td>/api/widget-api.php</td></tr>
<tr><td>Config DB</td><td>admin.chatbot_config</td></tr>
<tr><td>Rotation</td><td>⚠️ Via widget-api.php (système séparé)</td></tr>
</table>
<h3>Pages avec Widget</h3>
<p>Le widget flottant est présent sur toutes les pages admin WEVAL :</p>
<ul style="color:#ccc; columns:2;">
<li>admin-permissions.php</li>
<li>architecture.php</li>
<li>ceo-dashboard.php</li>
<li>cloudflare-accounts.php</li>
<li>database-manager.php</li>
<li>dkim_setup.php</li>
<li>+ 50 autres pages...</li>
</ul>
<h3>Configuration (DB chatbot_config)</h3>
<div class="schema">
<pre>
config_key │ config_value │
<button class="help-btn" onclick="showHelp()">❓ Aide & /button<Documentation>
bot_name │ Hamid esmart │
bubble_text │ Salam ! │
welcome_message │ Bonjour! 👋 Je suis votre assistant... │
color1 │ #06b6d4 │
color2 │ #0891b2 │
default_provider│ ollama │
widget_size │ 100px │
glow │ Fort │
opacity │ 80% │
</pre>
</div>
<h3>Architecture</h3>
<div class="schema">
<pre>
WIDGET WEVAL INTÉGRÉ │
Page Admin WEVAL (ex: cloudflare-accounts.php) │
┌─────────────────────────────────────────────────────────┐ │
│ │ │
│ [Contenu de la page] │ │
│ │ │
│ │ │
│ ┌──────────┐│ │
│ │ 🤖 ││ │
│ │ Salam! ││ │
│ └──────────┘│ │
└─────────────────────────────────────────────────────────┘ │
include("includes/chatbot-widget.php") │
│ │
▼ │
┌─────────────────────────────────────────────────────────┐ │
│ chatbot-widget.php (19 KB) │ │
│ • Charge config depuis admin.chatbot_config │ │
│ • Génère HTML/CSS/JS du widget flottant │ │
│ • Appelle /api/widget-api.php pour les réponses IA │ │
└─────────────────────────────────────────────────────────┘ │
⚠️ DIFFÉRENCE: Utilise widget-api.php, PAS hamid-api.php │
</pre>
</div>
<h3>Points forts / faibles</h3>
<p class="pros">✅ Accessible sur toutes les pages | ✅ Non-intrusif | ✅ Config personnalisable | ✅ 50+ intégrations</p>
<p class="cons">❌ API différente (widget-api.php) | ❌ Failover séparé | ❌ Pas synchronisé avec hamid-api</p>
</div>
<!-- AJOUT: Interface 10 - CLI SSH Réel -->
<div class="card">
<div class="card-title">🖥️ 10. WEVAL MIND CLI SSH RÉEL (Serveur Direct)</div>
<table>
<tr><th>Propriété</th><th>Valeur</th></tr>
<tr><td>Accès</td><td>ssh root@89.167.40.150 → commande: <code>hamid</code></td></tr>
<tr><td>Fichier</td><td>/usr/local/bin/hamid (24 KB - Python)</td></tr>
<tr><td>API Backend</td><td>Appels DIRECTS aux APIs providers (pas de PHP)</td></tr>
<tr><td>Config DB</td><td>admin.commonia_config (clés API)</td></tr>
<tr><td>Providers</td><td>19 providers configurés dans le script Python</td></tr>
<tr><td>Rotation</td><td>✅ Propre implémentation avec auto-fallback</td></tr>
</table>
<h3>Providers CLI Python</h3>
<div class="schema">
<pre>
PROVIDERS = {
'ollama': {endpoint: localhost:11434, model: phi:latest}
'groq': {endpoint: api.groq.com, model: llama-3.3-70b-versatile}
'deepseek': {endpoint: api.deepseek.com, model: deepseek-chat}
'mistral': {endpoint: api.mistral.ai, model: mistral-large-latest}
'together': {endpoint: api.together.xyz, model: Llama-3.3-70B-Instruct}
'cerebras': {endpoint: api.cerebras.ai, model: llama3.1-8b}
'cloudflare':{endpoint: api.cloudflare.com, model: llama-3.1-8b-instruct}
'sambanova': {endpoint: api.sambanova.ai, model: Meta-Llama-3.1-8B}
... (19 total)
}
</pre>
</div>
<h3>Architecture</h3>
<div class="schema">
<pre>
WEVAL MIND CLI SSH RÉEL │
Utilisateur Admin │
│ │
│ ssh root@89.167.40.150 │
▼ │
┌─────────────────────────────────────────────────────────┐ │
│ Terminal Linux (bash) │ │
│ │ │
│ root@wevads:~$ hamid │ │
│ │ │
│ ╔═══════════════════════════════════════════════════╗ │ │
│ ║ 🤖 WEVAL MIND CLI v2.0 - Multi-Provider AI ║ │ │
│ ║ Provider: groq (⚡) ║ │ │
│ ╚═══════════════════════════════════════════════════╝ │ │
│ │ │
│ hamid> Explique Docker │ │
│ [groq|1234ms] Docker est un outil de... │ │
│ │ │
│ hamid> /use cerebras │ │
│ ✅ Provider changé: cerebras │ │
│ │ │
│ hamid> /quit │ │
│ Au revoir! 👋 │ │
└─────────────────────────────────────────────────────────┘ │
Script Python: /usr/local/bin/hamid │
│ │
├─ Charge clés API depuis admin.commonia_config (DB) │
│ │
├─ Appelle DIRECTEMENT les APIs providers │
│ (pas de couche PHP intermédiaire) │
│ │
└─ Auto-fallback si provider down │
Commandes disponibles: │
• /help - Affiche l'aide │
• /providers - Liste tous les providers │
• /use X - Change de provider │
• /model - Affiche le modèle actuel │
• /clear - Efface l'écran │
• /quit - Quitter │
⚠️ ACCÈS ADMIN UNIQUEMENT (nécessite SSH root) │
</pre>
</div>
<h3>Points forts / faibles</h3>
<p class="pros">✅ Accès direct serveur | ✅ Pas de latence web | ✅ Scripting bash possible | ✅ Auto-fallback | ✅ 19 providers</p>
<p class="cons">❌ Accès SSH requis | ❌ Config séparée (commonia_config) | ❌ Pas synchronisé avec hamid-api.php</p>
</div>
<!-- 4. TABLEAU COMPARATIF -->
<!-- TABLEAU MAÎTRE COMPLET AVEC PROMPTS ET RECOMMANDATIONS -->
<!-- TABLEAU UNIQUE COMPLET -->
<h2 id="master-table">📊 Tableau Maître - Comparatif Complet des 10 Interfaces WEVAL MIND</h2>
<div style="overflow-x:auto;">
<table style="font-size:10px; width:100%; border-collapse:collapse;">
<thead>
<tr style="background:linear-gradient(135deg,#1e1b4b,#312e81);">
<th style="padding:10px; text-align:left;">Interface</th>
<th style="padding:10px;">🌐 URL d'Accès</th>
<th style="padding:10px;">📄 Fichier<br>(Taille)</th>
<th style="padding:10px;">⚡ API Backend<br>(Taille)</th>
<th style="padding:10px;">🗄️ Config DB</th>
<th style="padding:10px;">📚 KB<br>(docs)</th>
<th style="padding:10px;">🧠 System Prompt</th>
<th style="padding:10px;">💡 Intell.</th>
<th style="padding:10px;">🖥️ Écran/Affichage</th>
<th style="padding:10px;">👤 Pour qui?</th>
<th style="padding:10px;">🎯 Cas d'usage</th>
<th style="padding:10px;">⚠️ Recommandation</th>
</tr>
</thead>
<tbody>
<!-- SYSTÈME PRINCIPAL - VERT -->
<tr style="background:rgba(16,185,129,0.25); border-left:4px solid #10b981;">
<td style="padding:8px;"><b>💬 Fullscreen</b><br><span style="color:#10b981; font-size:9px;">★ PRINCIPAL</span></td>
<td><!-- btn-killed -->
</p>
</div>
</div>
</body>
</html>