feat(llm): 排版容器固定CSS + 插图用正文第一段 + 适中尺寸

- enrichment._enrich_format:把排版好的段落包到带固定 CSS 的 <div class=article-body> 里
  (font: system-ui / 17px / line-height 1.7 / color #3e3e3e / p margin-bottom 1.5em)
  CSS 同时内联到 style 属性,前端 .article-body 全局类做兑底
- enrichment._enrich_image:prompt 改用 body_zh_text 的第一段(原为 title);
  新增 {body} 占位符,image_prompt_template 默认模板同步改写
- 插图尺寸写死为 768x512(适中);image_size 字段保留供用户手改但默认行为不依赖它
- 分类明确多标签(2-5 个),提示词加 {body} 变量,容错读 categories/tags 两种 key
- AdminLlmSettings.vue:placeholder / 变量说明同步更新
This commit is contained in:
Mavis
2026-06-08 20:53:21 +08:00
parent 82a92032bb
commit 380e8b124e
5 changed files with 109 additions and 22 deletions

View File

@@ -13,7 +13,7 @@ class LlmSettingOut(BaseModel):
classify_prompt: str | None = None
commentary_prompt: str | None = None
image_prompt_template: str | None = None
image_size: str = "1024x768"
image_size: str = "768x512"
chat_model: str = "agnes-2.0-flash"
image_model: str = "agnes-image-2.1-flash"
interval_sec: float = 2.0
@@ -48,10 +48,10 @@ DEFAULT_PROMPTS = {
"原文:\n{body}\n"
),
"classify_prompt": (
"你是新闻分类助手。请阅读以下新闻,返回 1-2 个分类标签\n"
"可选标签(可自由组合): 时政 / 经济 / 科技 / 军事 / 社会 / 国际 / 体育 / 文化 / 环境 / 健康 / 金融 / 能源 / 气候\n"
"严格要求:只返回 JSON,形如 {\"categories\": [\"时政\", \"国际\"]},不要其他内容。\n\n"
"标题:{title}\n摘要:{summary}\n"
"你是新闻分类助手。请阅读以下新闻,返回 2-5 个最相关的分类标签(多标签)\n"
"可选标签(可自由组合,不限于此): 时政 / 经济 / 科技 / 军事 / 社会 / 国际 / 体育 / 文化 / 环境 / 健康 / 金融 / 能源 / 气候\n"
"严格要求:只返回 JSON,形如 {\"categories\": [\"时政\", \"国际\", \"经济\"]},不要其他内容。\n\n"
"标题:{title}\n摘要:{summary}\n正文(节选):{body}\n"
),
"commentary_prompt": (
"你是资深新闻评论员。请基于以下新闻写一段 100-200 字的中文点评。\n"
@@ -59,7 +59,7 @@ DEFAULT_PROMPTS = {
"标题:{title}\n正文:{body}\n"
),
"image_prompt_template": (
"Editorial news illustration about: {title}. "
"Editorial news illustration inspired by: {body}. "
"Cinematic, professional journalism style, soft natural lighting, "
"no text, no logos, no watermark."
),