Skip to content

Commit 735b26b

Browse files
committed
feat: add compatibility tasks admin page
1 parent dca9268 commit 735b26b

14 files changed

Lines changed: 789 additions & 1 deletion

File tree

client/public/locales/en/translation.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,39 @@
55
},
66
"admin": {
77
"back_to_site": "Back to site",
8+
"compat_tasks_description": "Run compatibility jobs in bulk to backfill missing AI summaries and image blurhash metadata for older posts.",
89
"health_description": "Review required configuration, missing integrations, and risks that can affect runtime behavior.",
910
"queue_status_description": "Inspect AI summary queue progress, recent task results, and failures.",
1011
"settings_description": "Manage site behavior, integrations, and publishing rules in one place.",
1112
"title": "Admin",
1213
"writing_description": "Write, edit, and publish content from the private management workspace."
1314
},
15+
"compat_tasks": {
16+
"title": "Compatibility Tasks",
17+
"loading": "Loading compatibility task status...",
18+
"generated_at": "Last updated: {{date}}",
19+
"running": "Running",
20+
"yes": "Yes",
21+
"no": "No",
22+
"ai_summary": {
23+
"title": "Backfill AI Summaries",
24+
"description": "Scan existing published posts and enqueue AI summary generation for entries that do not have one yet.",
25+
"eligible": "{{count}} posts pending",
26+
"enabled": "AI summary enabled: {{value}}",
27+
"queue_configured": "Queue configured: {{value}}",
28+
"run": "Start backfill",
29+
"result": "Queued {{queued}} AI summary tasks and skipped {{skipped}} posts."
30+
},
31+
"blurhash": {
32+
"title": "Backfill Image Blurhash",
33+
"description": "Scan existing posts and write missing blurhash and image size metadata back into markdown image fragments.",
34+
"eligible": "{{count}} posts pending",
35+
"note": "This task runs in the current browser and processes images one post at a time.",
36+
"run": "Start backfill",
37+
"progress": "Processed {{processed}} / {{total}}, updated {{updated}} posts, failed {{failed}} posts.",
38+
"result": "Blurhash backfill finished: scanned {{total}} posts, updated {{updated}}, failed {{failed}}."
39+
}
40+
},
1441
"ai_summary": {
1542
"message": {
1643
"completed": "AI summary is ready.",

client/public/locales/ja/translation.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,39 @@
55
},
66
"admin": {
77
"back_to_site": "サイトに戻る",
8+
"compat_tasks_description": "過去記事向けの AI 要約と画像 blurhash メタデータを一括補完する互換タスクを実行します。",
89
"health_description": "必須設定、未構成の連携、動作に影響するリスクを確認します。",
910
"queue_status_description": "AI 要約キューの進行状況、最近のタスク結果、失敗内容を確認します。",
1011
"settings_description": "サイトの挙動、連携設定、公開ルールを一か所で管理します。",
1112
"title": "管理画面",
1213
"writing_description": "非公開の管理ワークスペースから記事を作成、編集、公開します。"
1314
},
15+
"compat_tasks": {
16+
"title": "互換タスク",
17+
"loading": "互換タスクの状態を読み込んでいます...",
18+
"generated_at": "最終更新: {{date}}",
19+
"running": "実行中",
20+
"yes": "はい",
21+
"no": "いいえ",
22+
"ai_summary": {
23+
"title": "AI 要約を補完",
24+
"description": "既存の公開記事を走査し、まだ要約がない記事を再度キューに入れます。",
25+
"eligible": "対象 {{count}} 件",
26+
"enabled": "AI 要約の有効化: {{value}}",
27+
"queue_configured": "キュー設定済み: {{value}}",
28+
"run": "補完を開始",
29+
"result": "{{queued}} 件をキューに追加し、{{skipped}} 件をスキップしました。"
30+
},
31+
"blurhash": {
32+
"title": "画像 Blurhash を補完",
33+
"description": "既存記事内の画像を走査し、欠けている blurhash と画像サイズ情報を markdown fragment に追記します。",
34+
"eligible": "対象 {{count}} 件",
35+
"note": "このタスクは現在のブラウザ内で実行され、記事ごとに画像を処理します。",
36+
"run": "補完を開始",
37+
"progress": "{{processed}} / {{total}} 件処理済み、更新 {{updated}} 件、失敗 {{failed}} 件。",
38+
"result": "Blurhash 補完が完了しました。全 {{total}} 件を走査し、{{updated}} 件を更新、{{failed}} 件が失敗しました。"
39+
}
40+
},
1441
"ai_summary": {
1542
"message": {
1643
"completed": "AI 要約の生成は完了しました。",

client/public/locales/zh-CN/translation.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,39 @@
55
},
66
"admin": {
77
"back_to_site": "返回站点",
8+
"compat_tasks_description": "批量触发向前兼容任务,用于补齐历史帖子缺失的 AI 摘要和图片 blurhash 元数据。",
89
"health_description": "检查关键配置、缺失的集成项,以及可能影响服务正常运行的风险。",
910
"queue_status_description": "查看 AI 摘要队列进度、最近任务结果和失败信息。",
1011
"settings_description": "在统一的后台空间中管理站点行为、集成配置和发布规则。",
1112
"title": "后台管理",
1213
"writing_description": "在独立的管理工作区中编写、编辑和发布内容。"
1314
},
15+
"compat_tasks": {
16+
"title": "兼容任务",
17+
"loading": "正在加载兼容任务状态...",
18+
"generated_at": "最近更新时间:{{date}}",
19+
"running": "执行中",
20+
"yes": "",
21+
"no": "",
22+
"ai_summary": {
23+
"title": "补齐 AI 摘要",
24+
"description": "扫描历史已发布帖子,为尚未生成摘要的内容重新入队。",
25+
"eligible": "待处理 {{count}} 篇",
26+
"enabled": "AI 摘要已启用:{{value}}",
27+
"queue_configured": "队列已配置:{{value}}",
28+
"run": "开始补齐",
29+
"result": "AI 摘要任务已入队 {{queued}} 篇,跳过 {{skipped}} 篇。"
30+
},
31+
"blurhash": {
32+
"title": "补齐图片 Blurhash",
33+
"description": "扫描历史帖子中的图片,为缺失占位图和尺寸元数据的图片补齐 markdown fragment。",
34+
"eligible": "待处理 {{count}} 篇",
35+
"note": "该任务在当前浏览器中执行,会逐篇加载图片并回写元数据。",
36+
"run": "开始补齐",
37+
"progress": "已处理 {{processed}} / {{total}},更新 {{updated}} 篇,失败 {{failed}} 篇。",
38+
"result": "Blurhash 补齐完成:共扫描 {{total}} 篇,成功更新 {{updated}} 篇,失败 {{failed}} 篇。"
39+
}
40+
},
1441
"ai_summary": {
1542
"message": {
1643
"completed": "AI 摘要已生成。",

client/public/locales/zh-TW/translation.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,39 @@
55
},
66
"admin": {
77
"back_to_site": "返回站點",
8+
"compat_tasks_description": "批次觸發向前相容任務,用於補齊歷史文章缺失的 AI 摘要與圖片 blurhash 中繼資料。",
89
"health_description": "檢查關鍵配置、缺失的整合項,以及可能影響服務正常運行的風險。",
910
"queue_status_description": "查看 AI 摘要佇列進度、最近任務結果與失敗資訊。",
1011
"settings_description": "在統一的後台空間中管理站點行為、整合配置與發佈規則。",
1112
"title": "後台管理",
1213
"writing_description": "在獨立的管理工作區中編寫、編輯並發佈內容。"
1314
},
15+
"compat_tasks": {
16+
"title": "相容任務",
17+
"loading": "正在載入相容任務狀態...",
18+
"generated_at": "最近更新時間:{{date}}",
19+
"running": "執行中",
20+
"yes": "",
21+
"no": "",
22+
"ai_summary": {
23+
"title": "補齊 AI 摘要",
24+
"description": "掃描歷史已發佈文章,為尚未生成摘要的內容重新入列。",
25+
"eligible": "待處理 {{count}} 篇",
26+
"enabled": "AI 摘要已啟用:{{value}}",
27+
"queue_configured": "佇列已設定:{{value}}",
28+
"run": "開始補齊",
29+
"result": "AI 摘要任務已入列 {{queued}} 篇,略過 {{skipped}} 篇。"
30+
},
31+
"blurhash": {
32+
"title": "補齊圖片 Blurhash",
33+
"description": "掃描歷史文章中的圖片,為缺失占位圖與尺寸中繼資料的圖片補齊 markdown fragment。",
34+
"eligible": "待處理 {{count}} 篇",
35+
"note": "此任務會在目前瀏覽器中執行,逐篇載入圖片並回寫中繼資料。",
36+
"run": "開始補齊",
37+
"progress": "已處理 {{processed}} / {{total}},更新 {{updated}} 篇,失敗 {{failed}} 篇。",
38+
"result": "Blurhash 補齊完成:共掃描 {{total}} 篇,成功更新 {{updated}} 篇,失敗 {{failed}} 篇。"
39+
}
40+
},
1441
"ai_summary": {
1542
"message": {
1643
"completed": "AI 摘要已生成。",

client/src/api/client.ts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,38 @@ export interface QueueTaskActionResponse {
9191
success: boolean;
9292
}
9393

94+
export interface CompatTasksResponse {
95+
generatedAt: string;
96+
aiSummary: {
97+
enabled: boolean;
98+
queueConfigured: boolean;
99+
eligible: number;
100+
};
101+
blurhash: {
102+
eligible: number;
103+
};
104+
}
105+
106+
export interface CompatAISummaryActionResponse {
107+
queued: number;
108+
skipped: number;
109+
}
110+
111+
export interface CompatBlurhashCandidate {
112+
id: number;
113+
title: string | null;
114+
content: string;
115+
}
116+
117+
export interface CompatBlurhashCandidatesResponse {
118+
generatedAt: string;
119+
items: CompatBlurhashCandidate[];
120+
}
121+
122+
export interface CompatBlurhashApplyResponse {
123+
updated: boolean;
124+
}
125+
94126
// Re-export for external use
95127
export type {
96128
ApiResponse,
@@ -455,6 +487,22 @@ class ConfigAPI {
455487
return this.http.get<QueueStatusResponse>("/api/config/queue-status");
456488
}
457489

490+
async getCompatTasks(): Promise<ApiResponse<CompatTasksResponse>> {
491+
return this.http.get<CompatTasksResponse>("/api/config/compat-tasks");
492+
}
493+
494+
async runCompatAISummary(): Promise<ApiResponse<CompatAISummaryActionResponse>> {
495+
return this.http.post<CompatAISummaryActionResponse>("/api/config/compat-tasks/ai-summary");
496+
}
497+
498+
async getCompatBlurhashCandidates(): Promise<ApiResponse<CompatBlurhashCandidatesResponse>> {
499+
return this.http.get<CompatBlurhashCandidatesResponse>("/api/config/compat-tasks/blurhash");
500+
}
501+
502+
async applyCompatBlurhash(feedId: number, content: string): Promise<ApiResponse<CompatBlurhashApplyResponse>> {
503+
return this.http.post<CompatBlurhashApplyResponse>(`/api/config/compat-tasks/blurhash/${feedId}`, { content });
504+
}
505+
458506
async retryQueueTask(feedId: number): Promise<ApiResponse<QueueTaskActionResponse>> {
459507
return this.http.post<QueueTaskActionResponse>(`/api/config/queue-status/${feedId}/retry`);
460508
}

client/src/app/routes.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Padding } from "../components/padding";
99
import { Tips, TipsPage } from "../components/tips";
1010
import useTableOfContents from "../hooks/useTableOfContents";
1111
import { CallbackPage } from "../page/callback";
12+
import { CompatTasksPage } from "../page/compat-tasks";
1213
import { ErrorPage } from "../page/error";
1314
import { FeedPage, TOCHeader } from "../page/feed";
1415
import { FeedsPage } from "../page/feeds";
@@ -73,6 +74,10 @@ export function AppRoutes() {
7374
<QueueStatusPage />
7475
</AdminRoute>
7576

77+
<AdminRoute path="/admin/compat-tasks" requirePermission title={t("compat_tasks.title")} description={t("admin.compat_tasks_description")}>
78+
<CompatTasksPage />
79+
</AdminRoute>
80+
7681
<AdminRoute path="/admin/writing" requirePermission title={t("writing")} description={t("admin.writing_description")}>
7782
<WritingPage />
7883
</AdminRoute>

client/src/components/admin-layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export function AdminLayout({
6464
<AdminNavItem href="/admin/settings" icon="ri-settings-3-line" label={t("settings.title")} />
6565
<AdminNavItem href="/admin/health" icon="ri-heart-pulse-line" label={t("health.title")} />
6666
<AdminNavItem href="/admin/queue-status" icon="ri-todo-line" label={t("queue_status.title")} />
67+
<AdminNavItem href="/admin/compat-tasks" icon="ri-history-line" label={t("compat_tasks.title")} />
6768
</div>
6869
</div>
6970
</div>

0 commit comments

Comments
 (0)