31 lines
1.3 KiB
Python
31 lines
1.3 KiB
Python
|
|
#!/usr/bin/env python3
|
||
|
|
# -*- coding: utf-8 -*-
|
||
|
|
"""
|
||
|
|
patch_prompt_designer_meta.py — Le Designer ne conclut plus.
|
||
|
|
Bug : ses commentaires de synthèse (« Points clés de la proposition… »)
|
||
|
|
après la dernière slide fuyaient dans le deck (slide 27 du deck Sisley).
|
||
|
|
Défense en profondeur : encoder_schema v3 tronque déjà après '---' ;
|
||
|
|
cette règle prompt tarit la source.
|
||
|
|
Usage : python3 patch_prompt_designer_meta.py
|
||
|
|
puis prompt_injection_v2.py + recoller le Designer dans Mistral Studio.
|
||
|
|
"""
|
||
|
|
import shutil, sys
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
BLOC = """- Ta réponse se termine à la DERNIÈRE ligne de contenu de la dernière
|
||
|
|
slide. AUCUN commentaire, bilan, synthèse ou justification après —
|
||
|
|
tout texte postérieur serait transcrit dans le deck comme du contenu.
|
||
|
|
"""
|
||
|
|
p = Path("prompt_the_designer_v3.md")
|
||
|
|
if not p.exists():
|
||
|
|
print(" ! prompt_the_designer_v3.md introuvable"); sys.exit(1)
|
||
|
|
c = p.read_text(encoding="utf-8")
|
||
|
|
if "se termine à la DERNIÈRE ligne" in c:
|
||
|
|
print(" = déjà à jour"); sys.exit(0)
|
||
|
|
anchor = "- Tu ajoutes UNIQUEMENT les lignes `@layout:` et `@note:`."
|
||
|
|
if c.count(anchor) != 1:
|
||
|
|
print(" ! ancre introuvable/non unique"); sys.exit(1)
|
||
|
|
shutil.copy2(p, str(p) + ".bak-meta")
|
||
|
|
p.write_text(c.replace(anchor, anchor + "\n" + BLOC), encoding="utf-8")
|
||
|
|
print(" + règle anti-conclusion insérée — propager avec prompt_injection_v2.py")
|