Support page: choose a PDF or a reply mail (D-141)
PDF | Mail before Analyser. In mail mode the support agent gets ecrire_mail (body + figures of the session as attachments, mail-vN.json) instead of the presentation tools; its prompt ends with prompts/support-mail.md, without presentation.md and modele.typ. The page shows the text, Copier, and the attachments to download. check_sortie_mail in API/support/check.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b475da0acc
commit
ee3875fe75
13 files changed
+161
-31
No files matched your search
@@ -5,6 +5,7 @@ Typst `tools/typst/{documents,build}/`), et lève ErreurOutil sur une erreur : l
|
||||
"""
|
||||
import base64
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
@@ -106,6 +107,13 @@ OUTILS_SUPPORT = [
|
||||
"débordent et les remarques du lint, ou l'erreur de Typst.", {}),
|
||||
_schema("voir_page", "Regarder la page n (à partir de 1) de la dernière version du PDF.", {"n": I}),
|
||||
]
|
||||
PIECES = (".png", ".jpg", ".jpeg", ".gif") # ce qu'un mail peut joindre, du dossier de la séance
|
||||
# La sortie mail : sans les outils de la présentation, avec ecrire_mail
|
||||
OUTILS_SUPPORT_MAIL = [o for o in OUTILS_SUPPORT if o["name"] in ("poser_station", "demander_analyste")] + [
|
||||
_schema("ecrire_mail", "Écrit une version du mail de réponse (mail-v1.json, mail-v2.json…) : le corps, et les "
|
||||
"fichiers du dossier de la séance à joindre (.png, .jpg, .gif ; liste vide : aucun).",
|
||||
{"texte": S, "pieces_jointes": {"type": "array", "items": S}}),
|
||||
]
|
||||
|
||||
|
||||
class Boite:
|
||||
@@ -230,8 +238,18 @@ class Boite:
|
||||
return self._compiler()
|
||||
if nom == "voir_page":
|
||||
return self._voir_page(int(e["n"]))
|
||||
if nom == "ecrire_mail":
|
||||
return self._ecrire_mail(e["texte"], e["pieces_jointes"])
|
||||
raise ErreurOutil(f"outil inconnu : {nom}")
|
||||
|
||||
def _ecrire_mail(self, texte: str, pieces: list[str]) -> str:
|
||||
absentes = [p for p in pieces if "/" in p or not p.lower().endswith(PIECES) or not (self.dossier() / p).is_file()]
|
||||
if absentes:
|
||||
raise ErreurOutil(f"pièces refusées ou absentes du dossier de la séance : {', '.join(absentes)}")
|
||||
version = self.dossier() / f"mail-v{len(list(self.dossier().glob('mail-v*.json'))) + 1}.json"
|
||||
version.write_text(json.dumps({"texte": texte, "pieces_jointes": pieces}, ensure_ascii=False, indent=1))
|
||||
return f"{version.name} écrit ({len(texte)} caractères, {len(pieces)} pièce(s) jointe(s))"
|
||||
|
||||
def _compiler(self) -> str:
|
||||
station = self._station().name.lower()
|
||||
source = self.dossier() / f"{station}.typ"
|
||||
|
||||
Reference in new issue
Block a user