Public Access
fix: Migration vers le nouveau SDK Google GenAI et mise à jour des dépendances
Build and Push Docker Image / build-and-push (push) Successful in 2m4s
Build and Push Docker Image / build-and-push (push) Successful in 2m4s
This commit is contained in:
1 parent
5a4e7dd094
commit
a10c854b2b
11 files changed
+2122
-100
No files matched your search
@@ -5,7 +5,6 @@ from modules.paypal import render_paypal_donation_widget
|
||||
def render_user_msg(text):
|
||||
return Div(P(text, style="margin:0; font-weight:bold; white-space: pre-wrap;"), cls="user-bubble")
|
||||
|
||||
# Ajout du paramètre execution_time
|
||||
def render_ai_msg(text, intention, nom_fournisseur, nom_modele, couleur, execution_time=None):
|
||||
time_badge = Span(f"⏱️ {execution_time}s", style="margin-right: 10px; color:#aaa; font-size:0.8em;") if execution_time else ""
|
||||
|
||||
@@ -13,7 +12,7 @@ def render_ai_msg(text, intention, nom_fournisseur, nom_modele, couleur, executi
|
||||
Span(f"🎯 {intention}", style="margin-right: 10px; color:#aaa; font-size:0.8em;"),
|
||||
Span(f"🏢 {nom_fournisseur}", style="margin-right: 10px; color:#aaa; font-size:0.8em;"),
|
||||
Span(f"🧠 {nom_modele}", style=f"margin-right: 10px; color:{couleur}; font-weight:bold; font-size:0.8em;"),
|
||||
time_badge, # ⏱️ Injection du chronomètre ici
|
||||
time_badge,
|
||||
style="border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 5px;"
|
||||
)
|
||||
actions = Div(
|
||||
@@ -62,28 +61,45 @@ def render_main_page(chat_id):
|
||||
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'})
|
||||
.then(response => {
|
||||
if (serverDown) { window.location.reload(); }
|
||||
})
|
||||
.catch(() => {
|
||||
serverDown = true;
|
||||
console.log("Serveur hors ligne (Mise à jour en cours)...");
|
||||
});
|
||||
}, 5000);
|
||||
''')
|
||||
|
||||
return Title("Aethas38 - Core"), Body(
|
||||
auto_refresh_script,
|
||||
Div(
|
||||
Div(
|
||||
Img(src="/Logo/logo_aethas.svg", style="max-width: 80%; height: auto; display: block; margin: 0 auto 20px;"),
|
||||
Div(
|
||||
A("+ Nouvelle discussion", href="/new_chat", cls="new-chat-btn"),
|
||||
A("💾 Exporter JSON", href="/export_json", target="_blank", cls="export-btn"),
|
||||
# Module de don modifiable par l'hébergeur
|
||||
render_paypal_donation_widget(),
|
||||
# Module inaltérable (Licence EULA Aethas38)
|
||||
A("❤️ Soutenir le créateur de ce projet", href="https://www.paypal.com/donate/?hosted_button_id=2B6T9UESCN2W6", target="_blank", style="margin-left: 10px; padding: 10px; background-color: #e2e8f0; color: #1a202c; border-radius: 5px; text-decoration: none; font-weight: bold; border: 1px solid #cbd5e0;"),
|
||||
cls="nav-buttons"
|
||||
|
||||
Div(
|
||||
render_paypal_donation_widget(),
|
||||
A("❤️ Soutenir le créateur", href="https://paypal.me/VotreLienIci", target="_blank", style="font-size: 0.8em; padding: 6px 12px; background-color: transparent; color: #00e5ff; border: 1px solid #00e5ff; border-radius: 6px; text-decoration: none; transition: 0.3s; font-weight: bold; text-align: center;"),
|
||||
style="display: flex; flex-direction: column; gap: 12px; align-items: center; margin-top: 20px;"
|
||||
),
|
||||
cls="nav-buttons",
|
||||
style="display: flex; flex-direction: column; gap: 10px;"
|
||||
),
|
||||
cls="sidebar-top"
|
||||
),
|
||||
render_sidebar(),
|
||||
Div(P("👤 Admin (Xavier)", style="color: #aaa; margin: 0; font-size: 0.9em;"), cls="sidebar-footer"),
|
||||
Div(P("👤 Xavier (Super Admin)", style="color: #aaa; margin: 0; font-size: 0.9em;"), cls="sidebar-footer"),
|
||||
cls="sidebar"
|
||||
),
|
||||
Div(
|
||||
Div(*messages_ui, id="chat-history", cls="chat-container"),
|
||||
# 🔄 Ajout de l'estimation de temps dans le Loader
|
||||
Div(Div(Div(cls="tech-spinner"), Span("Analyse en cours... (~5s à 10s)"), cls="tech-loader-container"), id="global-loader", cls="htmx-indicator", style="max-width: 1000px; margin: 0 auto; width: 100%; padding: 0 20px; box-sizing: border-box; padding-bottom: 120px;"),
|
||||
Div(
|
||||
Form(
|
||||
@@ -93,6 +109,13 @@ def render_main_page(chat_id):
|
||||
Div(
|
||||
Label("+", _for="file-upload", cls="file-btn"),
|
||||
Input(type="file", name="files", id="file-upload", multiple=True, style="display:none;", onchange="handleFileSelection(this)"),
|
||||
|
||||
Label(
|
||||
Input(type="checkbox", name="mode_payant", id="mode-payant-toggle", style="margin-right: 6px; accent-color: #00e5ff; cursor: pointer;"),
|
||||
"👑 VIP/Payant",
|
||||
style="color: #aaa; font-size: 0.85em; display: flex; align-items: center; margin-right: 15px; cursor: pointer; white-space: nowrap;"
|
||||
),
|
||||
|
||||
Textarea(name="prompt", id="prompt-input", placeholder="Requête, lien ou glissez vos fichiers ici...", cls="input-field", rows="1", oninput="autoResize(this)"),
|
||||
Button("↑", type="submit", cls="btn-submit"),
|
||||
cls="input-row"
|
||||
@@ -107,4 +130,40 @@ def render_main_page(chat_id):
|
||||
),
|
||||
cls="main-content"
|
||||
)
|
||||
)
|
||||
|
||||
def render_admin_moderation_panel(utilisateur_cible):
|
||||
"""
|
||||
Composant UI exclusif aux Admins pour statuer sur les infractions avec commentaire libre.
|
||||
"""
|
||||
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."),
|
||||
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("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..."),
|
||||
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_target="#admin-result",
|
||||
style="background: #1a1a1a; padding: 20px; border-radius: 8px; border: 1px solid #333;"
|
||||
),
|
||||
Div(id="admin-result", style="margin-top: 15px; color: #00e5ff;"),
|
||||
cls="admin-panel"
|
||||
)
|
||||
Reference in new issue
Block a user