feat(schedule-tasks): support auto-publish via media accounts

Replace the legacy target_platform string on schedule tasks with a
workspace-aware auto-publish payload (auto_publish + publish_account_ids
JSONB + cover_asset_url + cover_image_asset_id) and migrate the schema,
sqlc queries, generated models, domain struct, ScheduleTaskService DTOs,
and dispatch worker to round-trip the new fields. PromptRuleGeneration
gains a WithPublishJobService hook so executeGeneration can enqueue an
auto-publish job once the article is ready, and worker-generate wires
the publish-job service in. On the admin-web side, extract
PublishArticleModal's account-card builders into a shared
publish-account-cards module, rebuild GenerateTaskDrawer's schedule
mode around account selection plus a CoverPickerModal, and surface the
new "auto publish" column on ScheduleTaskTab. Shared types and i18n
strings cover the new fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 01:32:19 +08:00
parent c9267d2fae
commit 6e6e19cccb
22 changed files with 1380 additions and 603 deletions
+15 -1
View File
@@ -1254,10 +1254,20 @@ const enUS = {
platformUnauthorized: "Unauthorized",
platformEmptyTitle: "No publish platforms",
platformEmptyHint: "No platform data is available yet. Please verify the Media Management setup first.",
publishSection: "Publish Settings",
autoPublish: "Auto publish",
autoPublishHint: "When enabled, scheduled articles enter the publish queue after generation.",
publishAccounts: "Media accounts",
publishAccountsHint: "Choose specific accounts. Offline clients queue first and continue after reconnecting.",
publishAccountEmptyTitle: "No media accounts",
publishAccountEmptyHint: "Bind media accounts in the desktop client before configuring auto publish.",
cover: "Cover image",
coverHint: "Keep the cover clear, complete, and visually polished.",
scheduleCoverHint: "Cover is off by default. Enable it to save a cover to generated articles for publishing.",
scheduleCoverRequiredHint: "A selected account platform requires a cover image before publishing.",
coverUpload: "Upload cover image",
coverUploadHint: "Local preview only for now",
scheduleCoverUploadHint: "Choose from local files or the asset library",
scheduleTime: "Schedule article generation",
scheduleEveryDay: "Every day",
enableWebSearch: "Enable web search for generation",
@@ -1276,7 +1286,9 @@ const enUS = {
name: "Task name",
rule: "Prompt rule",
cron: "Frequency",
platform: "Target platform",
autoPublish: "Auto publish",
manualPublish: "Manual publish",
autoPublishAccountCount: "Auto · {count} accounts",
nextRun: "Next run",
startAt: "Start time",
endAt: "End time",
@@ -1341,6 +1353,8 @@ const enUS = {
missingPromptRule: "Choose a prompt first.",
invalidGenerateCount: "Article count must be at least 1.",
invalidScheduleTime: "Choose a valid schedule time.",
missingPublishAccounts: "Choose at least one media account when auto publish is enabled.",
missingScheduleCover: "A selected media account platform requires a cover image.",
missingPromptName: "Enter a prompt name first.",
missingPromptContent: "Enter prompt content first.",
},
+17 -2
View File
@@ -91,6 +91,7 @@ const zhCN = {
},
auth: {
welcomeBack: "欢迎回来",
tenantAdminLogin: "租户后台登录",
loginAndEnter: "登录并进入工作台",
email: "邮箱",
loginIdentifier: "手机号 / 邮箱",
@@ -597,7 +598,7 @@ const zhCN = {
publishing: "发布中",
success: "发布成功",
failed: "发布失败",
partial_success: "部分成功",
partial_success: "部分发布",
published: "发布成功",
publish_success: "发布成功",
publish_failed: "发布失败",
@@ -1263,10 +1264,20 @@ const zhCN = {
platformUnauthorized: "未授权",
platformEmptyTitle: "暂无发布平台",
platformEmptyHint: "当前还没有可用的平台数据,请先检查媒体管理配置。",
publishSection: "发布设置",
autoPublish: "是否自动发布",
autoPublishHint: "开启后,定时生成完成的文章会使用指定媒体账号自动进入发布队列。",
publishAccounts: "媒体账号",
publishAccountsHint: "请选择具体账号。客户端离线时会先排队,上线后继续发布。",
publishAccountEmptyTitle: "暂无可选媒体账号",
publishAccountEmptyHint: "请先在桌面端绑定媒体账号,再回到这里配置自动发布。",
cover: "封面图",
coverHint: "请保证封面清晰、美观和完整",
scheduleCoverHint: "默认不设置封面。需要时可单独指定,生成完成后会写入文章并用于发布。",
scheduleCoverRequiredHint: "已选账号的平台要求发布封面,请先选择封面图。",
coverUpload: "上传封面图",
coverUploadHint: "当前仅做本地预览",
scheduleCoverUploadHint: "从本地或素材库选择",
scheduleTime: "定时生成文章",
scheduleEveryDay: "每天",
enableWebSearch: "生成文章联网搜索",
@@ -1285,7 +1296,9 @@ const zhCN = {
name: "任务名称",
rule: "关联规则",
cron: "执行频率",
platform: "目标平台",
autoPublish: "自动发布",
manualPublish: "手动发布",
autoPublishAccountCount: "自动 · {count} 个账号",
nextRun: "下次执行",
startAt: "开始时间",
endAt: "结束时间",
@@ -1350,6 +1363,8 @@ const zhCN = {
missingPromptRule: "请先选择 Prompt",
invalidGenerateCount: "生成篇数至少为 1",
invalidScheduleTime: "请选择有效的定时时间",
missingPublishAccounts: "开启自动发布后,请至少选择一个媒体账号",
missingScheduleCover: "已选媒体账号的平台要求封面图,请先设置封面",
missingPromptName: "请先填写 Prompt 名称",
missingPromptContent: "请先填写 Prompt 内容",
},