maj auto 1

This commit is contained in:
xavier committed 2026-08-18 09:41:42 +02:00
1 parent e6cd509ffd
commit 950a0034aa
11 files changed
+223 -67

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
from openai import OpenAI
from modules.logger import log_event
def interroger_local_ollama(prompt_securise, modele="qwen2.5: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}]
)
if resp and resp.choices:
log_event("INFO", f"LOCAL-{modele}", "Succès.")
return resp.choices[0].message.content, "#10b981", "SERVEUR LOCAL", modele
except Exception as e:
log_event("ERROR", f"LOCAL-{modele}", f"Erreur: {e}")
raise Exception("Le serveur local a échoué.")