Strip bullet chars from facts, neutral image captions
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzKpYaEsuWDevuNnvSjcFW
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Prevod i sažimanje članka na bosanski, prilagođeno djetetu."""
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
|
||||
from openai import AsyncOpenAI
|
||||
@@ -21,7 +22,7 @@ Odgovori ISKLJUČIVO JSON objektom oblika:
|
||||
{"naslov": "...",
|
||||
"html": "<p>uvod</p><h2>Pitanje?</h2><p>...</p>...",
|
||||
"zanimljivosti": ["...", "...", "..."],
|
||||
"slika_opis": "kratak opis slike na bosanskom, jedna rečenica (potpis ispod slike)",
|
||||
"slika_opis": "potpis ispod slike na bosanskom, jedna kratka rečenica o temi; ne piši 'slika/crtež/fotografija prikazuje', samo šta se vidi, npr. 'Vulkan Augustine na Aljasci sa oblakom pepela'",
|
||||
"slika_prompt": "simple English description of one illustration for this topic, for a children's drawing"}
|
||||
U "html" koristi samo oznake p, h2, strong. Ne stavljaj zanimljivosti u html, one idu posebno."""
|
||||
|
||||
@@ -50,7 +51,7 @@ async def summarize(client: AsyncOpenAI, model: str, article: Article, topic: st
|
||||
s = Summary(
|
||||
title=data.get("naslov") or article.title,
|
||||
html=data.get("html") or "<p>Nažalost, nisam uspio napisati sažetak.</p>",
|
||||
facts=[str(f) for f in data.get("zanimljivosti", [])][:3],
|
||||
facts=[re.sub(r"^[\s\-•*·]+", "", str(f)).strip() for f in data.get("zanimljivosti", [])][:3],
|
||||
caption=data.get("slika_opis") or "",
|
||||
image_prompt=data.get("slika_prompt") or article.title,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user