Public Access
maj auto 2
This commit is contained in:
1 parent
db2b137d6b
commit
98bd4d7fbf
5 files changed
+142
-73
No files matched your search
@@ -5,11 +5,15 @@ 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")
|
||||
|
||||
def render_ai_msg(text, intention, nom_fournisseur, nom_modele, couleur):
|
||||
# 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 ""
|
||||
|
||||
encart_info = Div(
|
||||
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
|
||||
style="border-bottom: 1px solid #333; padding-bottom: 10px; margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 5px;"
|
||||
)
|
||||
actions = Div(
|
||||
@@ -54,14 +58,13 @@ 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')))
|
||||
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);"))
|
||||
|
||||
return Title("Aethas38 - Core"), Body(
|
||||
Div(
|
||||
Div(
|
||||
# L'image est appelée depuis le dossier local "Logo" monté dans FastHTML
|
||||
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"),
|
||||
@@ -77,7 +80,8 @@ def render_main_page(chat_id):
|
||||
),
|
||||
Div(
|
||||
Div(*messages_ui, id="chat-history", cls="chat-container"),
|
||||
Div(Div(Div(cls="tech-spinner"), Span("Aethas Core analyse la requête..."), 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;"),
|
||||
# 🔄 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(
|
||||
Input(type="hidden", name="chat_id", value=chat_id),
|
||||
|
||||
Reference in new issue
Block a user