Spaces:
Sleeping
Sleeping
File size: 994 Bytes
1c0b5e6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
from divinity_engine import divine_mutation, apply_pending, cancel_pending
def process_command(text, agent):
text = text.strip()
# Mutation : langage naturel ou code
if text.lower().startswith("mutation:"):
try:
# Si format code direct : "mutation: fichier=app.py"
lines = text.split("\n")
header = lines[0]
new_code = "\n".join(lines[1:]).strip()
if "fichier=" in header:
target = header.split("fichier=")[1].strip()
else:
return "Format invalide. Utilise : mutation: fichier=app.py"
return divine_mutation(new_code, target)
except Exception as e:
return f"Erreur dans la mutation : {e}"
# Validation
if text.upper() == "VALIDER":
return apply_pending()
# Annulation
if text.upper() == "ANNULER":
return cancel_pending()
# Toutes autres commandes → Qwen interprète
return agent.run(text) |