Public Access
chore: Serveur 100% stable, ports corrigés, prêt pour le RAG
Build and Push Docker Image / build-and-push (push) Successful in 1m50s
Build and Push Docker Image / build-and-push (push) Successful in 1m50s
This commit is contained in:
1 parent
7125842853
commit
ffe820b00f
20 files changed
+7772
-198
No files matched your search
+42
-19
@@ -1,6 +1,7 @@
|
||||
from fasthtml.common import *
|
||||
from modules.database import load_history
|
||||
from modules.paypal import render_paypal_donation_widget
|
||||
from modules.billing_manager import obtenir_solde
|
||||
|
||||
def render_user_msg(text):
|
||||
return Div(P(text, style="margin:0; font-weight:bold; white-space: pre-wrap;"), cls="user-bubble")
|
||||
@@ -21,7 +22,7 @@ def render_ai_msg(text, intention, nom_fournisseur, nom_modele, couleur, executi
|
||||
Button("📝 TXT", onclick="downloadResponseTXT(this)", cls="msg-action-btn", title="Télécharger en Texte"),
|
||||
Button("🗄️ JSON", onclick="downloadResponseJSON(this)", cls="msg-action-btn", title="Télécharger en JSON"),
|
||||
Button("💬 WhatsApp", onclick="shareWhatsApp(this)", cls="msg-action-btn", title="Partager sur WhatsApp"),
|
||||
Button("📧 Email", onclick="shareEmail(this)", cls="msg-action-btn", title="Envoyer par Email"),
|
||||
Button("📧 Email", onclick="shareEmail(this)", cls="msg-action-btn", title="Envoyer par courriel"),
|
||||
cls="msg-actions"
|
||||
)
|
||||
return Div(
|
||||
@@ -49,7 +50,7 @@ def render_sidebar():
|
||||
)
|
||||
return Div(*items, id="sidebar-content", cls="sidebar-history", hx_swap_oob="true")
|
||||
|
||||
def render_main_page(chat_id):
|
||||
def render_main_page(chat_id, utilisateur_nom="xavier", role="Super Admin"):
|
||||
history = load_history()
|
||||
messages_ui = []
|
||||
if chat_id in history:
|
||||
@@ -57,16 +58,19 @@ def render_main_page(chat_id):
|
||||
if msg['role'] == 'user':
|
||||
messages_ui.append(render_user_msg(msg['content']))
|
||||
else:
|
||||
messages_ui.append(render_ai_msg(msg['content'], msg.get('intention', ''), msg.get('fournisseur', ''), msg.get('modele', ''), msg.get('couleur', '#333'), msg.get('execution_time', '')))
|
||||
messages_ui.append(render_ai_msg(
|
||||
msg['content'], msg.get('intention', ''), msg.get('fournisseur', ''),
|
||||
msg.get('modele', ''), msg.get('couleur', '#333'), msg.get('execution_time', '')
|
||||
))
|
||||
if messages_ui:
|
||||
messages_ui.append(Script("setTimeout(renderMarkdown, 150);"))
|
||||
|
||||
auto_refresh_script = Script('''
|
||||
let serverDown = false;
|
||||
setInterval(() => {
|
||||
fetch('/favicon.ico', {cache: 'no-store', method: 'HEAD'})
|
||||
fetch('/ping', {cache: 'no-store'})
|
||||
.then(response => {
|
||||
if (serverDown) { window.location.reload(); }
|
||||
if (serverDown && response.ok) { window.location.reload(); }
|
||||
})
|
||||
.catch(() => {
|
||||
serverDown = true;
|
||||
@@ -75,6 +79,22 @@ def render_main_page(chat_id):
|
||||
}, 5000);
|
||||
''')
|
||||
|
||||
solde_perso = obtenir_solde(utilisateur_nom)
|
||||
|
||||
if role.lower() in ["super admin", "admin"]:
|
||||
badge_finance = Div(
|
||||
P(f"👤 {utilisateur_nom.capitalize()} ({role})", style="color: #00e5ff; margin: 0; font-weight: bold; font-size: 0.9em;"),
|
||||
P(f"💳 Solde personnel : {solde_perso:.2f} $", style="color: #aaa; margin: 2px 0; font-size: 0.8em;"),
|
||||
P(f"🏦 Cagnotte globale : {obtenir_solde('xavier'):.2f} $", style="color: #4caf50; margin: 0; font-size: 0.8em; font-weight: bold;"),
|
||||
style="padding: 10px; background: #181818; border-radius: 6px; border: 1px solid #333;"
|
||||
)
|
||||
else:
|
||||
badge_finance = Div(
|
||||
P(f"👤 {utilisateur_nom.capitalize()} ({role})", style="color: #fff; margin: 0; font-weight: bold; font-size: 0.9em;"),
|
||||
P(f"💳 Solde disponible : {solde_perso:.2f} $", style="color: #00e5ff; margin: 2px 0 0; font-size: 0.85em;"),
|
||||
style="padding: 10px; background: #181818; border-radius: 6px; border: 1px solid #333;"
|
||||
)
|
||||
|
||||
return Title("Aethas38 - Core"), Body(
|
||||
auto_refresh_script,
|
||||
Div(
|
||||
@@ -95,7 +115,7 @@ def render_main_page(chat_id):
|
||||
cls="sidebar-top"
|
||||
),
|
||||
render_sidebar(),
|
||||
Div(P("👤 Xavier (Super Admin)", style="color: #aaa; margin: 0; font-size: 0.9em;"), cls="sidebar-footer"),
|
||||
Div(badge_finance, cls="sidebar-footer"),
|
||||
cls="sidebar"
|
||||
),
|
||||
Div(
|
||||
@@ -112,7 +132,12 @@ def render_main_page(chat_id):
|
||||
|
||||
Label(
|
||||
Input(type="checkbox", name="mode_payant", id="mode-payant-toggle", style="margin-right: 6px; accent-color: #00e5ff; cursor: pointer;"),
|
||||
"👑 VIP/Payant",
|
||||
"👑 Payant",
|
||||
style="color: #aaa; font-size: 0.85em; display: flex; align-items: center; margin-right: 10px; cursor: pointer; white-space: nowrap;"
|
||||
),
|
||||
Label(
|
||||
Input(type="checkbox", name="mode_multi_ia", id="mode-multi-toggle", style="margin-right: 6px; accent-color: #d97757; cursor: pointer;"),
|
||||
"⚡ Multi-IA",
|
||||
style="color: #aaa; font-size: 0.85em; display: flex; align-items: center; margin-right: 15px; cursor: pointer; white-space: nowrap;"
|
||||
),
|
||||
|
||||
@@ -133,34 +158,32 @@ def render_main_page(chat_id):
|
||||
)
|
||||
|
||||
def render_admin_moderation_panel(utilisateur_cible):
|
||||
"""
|
||||
Composant UI exclusif aux Admins pour statuer sur les infractions avec commentaire libre.
|
||||
"""
|
||||
"""Composant exclusif aux administrateurs pour statuer sur les infractions."""
|
||||
return Div(
|
||||
H3(f"⚖️ Tribunal Admin - Dossier de : {utilisateur_cible}", style="color: #ff4444;"),
|
||||
P("Loi applicable : Aucun utilisateur n'est dispensé du respect de la loi."),
|
||||
H3(f"⚖️ Tribunal d'administration - Dossier de : {utilisateur_cible}", style="color: #ff4444;"),
|
||||
P("Loi applicable : Aucun utilisateur n'est dispensé du respect de la législation en vigueur."),
|
||||
Form(
|
||||
Input(type="hidden", name="cible", value=utilisateur_cible),
|
||||
Div(
|
||||
Label("Action décidée :", style="font-weight: bold;"),
|
||||
Select(
|
||||
Option("Avertissement simple", value="Avertissement"),
|
||||
Option("Bannissement 1 Jour", value="Ban 1J"),
|
||||
Option("Bannissement 1 Semaine", value="Ban 1Sem"),
|
||||
Option("Bannissement 1 Mois", value="Ban 1M"),
|
||||
Option("Bannissement Définitif & Signalement PHAROS", value="Ban Definitif + Pharos"),
|
||||
Option("Bannissement 1 jour", value="Ban 1J"),
|
||||
Option("Bannissement 1 semaine", value="Ban 1Sem"),
|
||||
Option("Bannissement 1 mois", value="Ban 1M"),
|
||||
Option("Bannissement définitif et signalement PHAROS", value="Ban Definitif + Pharos"),
|
||||
Option("Faux positif (Levée de sanction)", value="Annulation"),
|
||||
name="decision", cls="input-field"
|
||||
),
|
||||
style="margin-bottom: 15px;"
|
||||
),
|
||||
Div(
|
||||
Label("Commentaire libre de l'Admin (Preuve d'audit) :", style="font-weight: bold;"),
|
||||
Textarea(name="commentaire", rows="4", cls="input-field", placeholder="Raison de la décision, contexte..."),
|
||||
Label("Commentaire libre de l'administrateur (Preuve d'audit) :", style="font-weight: bold;"),
|
||||
Textarea(name="commentaire", rows="4", cls="input-field", placeholder="Raison de la décision, contexte juridique..."),
|
||||
style="margin-bottom: 15px;"
|
||||
),
|
||||
Button("Valider la décision et archiver", type="submit", cls="btn-submit", style="background-color: #ff4444; color: white;"),
|
||||
hx_post="/admin_decision", # Nouvelle route backend à créer plus tard
|
||||
hx_post="/admin_decision",
|
||||
hx_target="#admin-result",
|
||||
style="background: #1a1a1a; padding: 20px; border-radius: 8px; border: 1px solid #333;"
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user