chore: Serveur 100% stable, ports corrigés, prêt pour le RAG
Build and Push Docker Image / build-and-push (push) Successful in 1m50s

This commit is contained in:
xavier committed 2026-08-20 15:24:28 +02:00
1 parent 7125842853
commit ffe820b00f
20 files changed
+7772 -198

No files matched your search

+15 -6
View File
@@ -1,16 +1,25 @@
from openai import OpenAI
from modules.logger import log_event
def interroger_local_ollama(prompt_securise, modele="qwen2.5:3b"):
def interroger_local_ollama(prompt_securise: str, modele: str = "qwen2.5-coder:3b"):
"""
Interroge le serveur local Ollama avec repli automatique sur le modèle par défaut.
"""
modele_effectif = modele if modele else "qwen2.5-coder:3b"
client = OpenAI(base_url="http://192.168.1.20:11434/v1", api_key="ollama")
try:
resp = client.chat.completions.create(
model=modele,
messages=[{"role": "system", "content": "Réponds en français."}, {"role": "user", "content": prompt_securise}]
model=modele_effectif,
messages=[
{"role": "system", "content": "Réponds en français."},
{"role": "user", "content": prompt_securise}
]
)
if resp and resp.choices:
log_event("INFO", f"LOCAL-{modele}", "Succès.")
return resp.choices[0].message.content, "#10b981", "SERVEUR LOCAL", modele
log_event("INFO", f"LOCAL-{modele_effectif}", "Succès de la requête.")
return resp.choices[0].message.content, "#10b981", "SERVEUR LOCAL", modele_effectif
except Exception as e:
log_event("ERROR", f"LOCAL-{modele}", f"Erreur: {e}")
log_event("ERROR", f"LOCAL-{modele_effectif}", f"Erreur : {e}")
raise Exception("Le serveur local a échoué.")