Files
aethas-free/modules/router.py
T
2026-08-16 23:26:07 +02:00

15 lines
426 B
Python

import json
import re
def nettoyer_decision_router(raw_text):
try:
clean = re.sub(r'```(?:json)?\s*', '', raw_text)
clean = clean.replace('```', '').strip()
start = clean.find('{')
end = clean.rfind('}') + 1
if start != -1 and end != 0:
return json.loads(clean[start:end])
except Exception:
pass
return {"intention": "Analyse", "fournisseur": "gemini"}