Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions src/main/java/fr/birdia/genai/model/AnalyseurToiture.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,25 @@ private String getAIReport(Toit toit) {
✅ Contraintes de forme :
• Résultat UNIQUEMENT en HTML (aucun texte hors balises).
• Utilise uniquement les emojis suivants : 🟢🟡🟠🔴 🔍 🧼 🛠️ 📸 🧪 🧯
• Utilise la police suivante en priorité : Kumbh Sans
• Respecte strictement la structure suivante, de telle sorte que les blocs INSTRUCTION soient remplacés par l’instruction donnée:


<head>
<link href="https://fonts.googleapis.com/css2?family=Kumbh+Sans:wght@400;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Kumbh Sans', sans-serif;
}
</style>
</head>
<section>
<h2>COMPRENDRE VOTRE RAPPORT</h2>
"""
.concat(
String.format(
"""
<h3><span>{{pastille_emoji}}</span> CATÉGORIE %s : %s</h3>""",
getCategory(toit), getEtatToiture(toit)))
<h3><span>%s</span> CATÉGORIE %s : %s</h3>""",
getCategoryEmoji(toit), getCategory(toit), getEtatToiture(toit)))
.concat(
String.format(
"""
Expand Down Expand Up @@ -121,6 +129,17 @@ Points sensibles (obstacles) : %s — peut être utilisé pour expliquer leur im
.replace("```", "");
}

private String getCategoryEmoji(Toit toit) {
var category = getCategory(toit);
return switch (category) {
case "A" -> "🟢";
case "B", "C" -> "🟡";
case "D" -> "🟠";
case "E" -> "🔴";
default -> throw new IllegalStateException("Unexpected value: " + category);
};
}

private String getCategory(Toit toit) {
var categoryFromConsumer = toit.category();
if (categoryFromConsumer == null || categoryFromConsumer.isEmpty()) {
Expand Down
Loading