diff --git a/backend/app/db.py b/backend/app/db.py
index 53c8bf7..5fb94f7 100644
--- a/backend/app/db.py
+++ b/backend/app/db.py
@@ -493,7 +493,7 @@ def _seed_defaults(conn: sqlite3.Connection) -> None:
"x_clips_upload_min_gap_sec": 600,
"x_clips_delete_clip_after_post": True,
"x_clips_daily_max": 20,
- "x_clips_caption_template": "{anchor} 直播精彩瞬间",
+ "x_clips_caption_template": "{anchor}",
"tiktok_auto_retry_failed": False,
"tiktok_auto_retry_max_attempts": 3,
"tiktok_auto_retry_interval_sec": 300,
diff --git a/backend/app/main.py b/backend/app/main.py
index afcf115..2fd677b 100644
--- a/backend/app/main.py
+++ b/backend/app/main.py
@@ -1004,7 +1004,7 @@ async def x_clips_settings_update(body: dict[str, Any] | None = None) -> dict[st
except Exception:
raise HTTPException(400, "daily_max 无效") from None
if "x_clips_caption_template" in raw:
- patch["x_clips_caption_template"] = str(raw.get("x_clips_caption_template") or "{anchor}")[:200]
+ patch["x_clips_caption_template"] = str(raw.get("x_clips_caption_template") or "").strip()[:200] or "{anchor}"
if "x_clips_trigger" in raw:
t = str(raw.get("x_clips_trigger") or "tagged").strip().lower()
if t not in {"tagged", "all", "favorite"}:
diff --git a/backend/app/x_clips_pipeline.py b/backend/app/x_clips_pipeline.py
index b4acf50..c8979b3 100644
--- a/backend/app/x_clips_pipeline.py
+++ b/backend/app/x_clips_pipeline.py
@@ -57,8 +57,11 @@ def _clip_sec(cfg: dict[str, Any], room: dict[str, Any] | None = None) -> int:
def build_caption(job: dict[str, Any], cfg: dict[str, Any] | None = None) -> str:
+ """Render caption strictly from settings template — never invent live-room copy."""
settings = cfg or db.get_settings_map()
- tpl = str(settings.get("x_clips_caption_template") or "{anchor} 直播精彩瞬间").strip() or "{anchor} 直播精彩瞬间"
+ tpl = str(settings.get("x_clips_caption_template") or "").strip()
+ if not tpl:
+ tpl = "{anchor}"
anchor = str(job.get("anchor_name") or "").strip() or "Live"
room = str(job.get("room_id") or "").strip()
text = (
@@ -66,13 +69,8 @@ def build_caption(job: dict[str, Any], cfg: dict[str, Any] | None = None) -> str
.replace("{room}", room)
.replace("{title}", anchor)
).strip()
- bare = "".join(ch for ch in text if not ch.isspace())
- # Pad very short captions (短主播名会触发旧插件 length>=12 校验)
- if len(bare) < 8:
- suffix = "直播精彩瞬间"
- if suffix not in text:
- text = f"{text} {suffix}".strip()
- return text[:270]
+ # X hard limit ~280; leave headroom for media
+ return (text or anchor)[:270]
def _enqueue_job(
@@ -251,7 +249,7 @@ class XClipsPipeline:
"x_clips_trigger": cfg.get("x_clips_trigger") or "tagged",
"x_clips_tag": cfg.get("x_clips_tag") or "x",
"x_clips_daily_max": x_clips_db.x_clips_daily_max(cfg),
- "x_clips_caption_template": cfg.get("x_clips_caption_template") or "{anchor} 直播精彩瞬间",
+ "x_clips_caption_template": cfg.get("x_clips_caption_template") or "{anchor}",
"x_clips_live_sample": bool(cfg.get("x_clips_live_sample", True)),
"x_clips_live_sample_interval_sec": int(cfg.get("x_clips_live_sample_interval_sec") or 180),
"x_clips_live_sample_batch": int(cfg.get("x_clips_live_sample_batch") or 1),
@@ -488,13 +486,10 @@ class XClipsPipeline:
async def _do_post(self, job: dict[str, Any], *, manual: bool = False) -> None:
jid = str(job.get("id") or "")
cfg = db.get_settings_map()
- caption = str(job.get("caption") or "").strip() or build_caption(job, cfg)
- bare = "".join(ch for ch in caption if not ch.isspace())
- if len(bare) < 8:
- suffix = "直播精彩瞬间"
- caption = f"{caption} {suffix}".strip() if suffix not in caption else caption
- if len("".join(ch for ch in caption if not ch.isspace())) < 8:
- caption = build_caption(job, cfg)
+ # Always re-render from current template at post time (ignore stale job.caption)
+ caption = build_caption(job, cfg)
+ if not caption:
+ raise ValueError("文案模板结果为空")
media_url = str(job.get("media_url") or "").strip()
media_key = str(job.get("media_key") or "").strip()
clip = str(job.get("clip_path") or "").strip()
diff --git a/frontend/src/app/x/ClipsPanel.tsx b/frontend/src/app/x/ClipsPanel.tsx
index 2ca4a3a..1f8cb16 100644
--- a/frontend/src/app/x/ClipsPanel.tsx
+++ b/frontend/src/app/x/ClipsPanel.tsx
@@ -81,7 +81,7 @@ export function ClipsPanel({ toast }: { toast: (msg: string, kind?: "ok" | "err"
const s = status?.settings || {};
setClipSec(Number(s.x_clips_clip_sec || status?.clip_sec || 12));
setDailyMax(Number(s.x_clips_daily_max || status?.daily_max || 20));
- setCaptionTpl(String(s.x_clips_caption_template || "{anchor} 直播精彩瞬间"));
+ setCaptionTpl(String(s.x_clips_caption_template || "{anchor}"));
setTrigger(String(s.x_clips_trigger || "tagged"));
setSampleAny(Boolean(s.x_clips_sample_any_live ?? true));
setAutoPost(Boolean(s.x_clips_auto_post ?? true));
@@ -190,8 +190,13 @@ export function ClipsPanel({ toast }: { toast: (msg: string, kind?: "ok" | "err"
/>