Public Access
15 lines
426 B
Python
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"}
|