feat: update frontend schedule task fields, zhihu table format, and shared types

Persist enable_web_search and generate_count in GenerateTaskDrawer.
Display generate_count in ScheduleTaskTab. Add Zhihu table format
conversion for compatibility. Extend shared types with batch generation
response fields. Strengthen outline adherence rule in prompts config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-15 14:21:19 +08:00
parent 6869dc2fa6
commit 4d06938565
5 changed files with 34 additions and 3 deletions
@@ -155,8 +155,8 @@ function hydrateForm(): void {
form.promptRuleId = props.task?.prompt_rule_id ?? undefined;
form.platformIds = parseTargetPlatforms(props.task?.target_platform);
form.coverEnabled = true;
form.enableWebSearch = false;
form.generateCount = 1;
form.enableWebSearch = props.task?.enable_web_search ?? false;
form.generateCount = props.task?.generate_count ?? 1;
form.scheduleTime = parseCronToDailyTime(props.task?.cron_expr);
resetCoverState();
}
@@ -171,6 +171,8 @@ function buildSchedulePayload() {
prompt_rule_id: form.promptRuleId!,
cron_expr: buildDailyCron(form.scheduleTime),
target_platform: serializeTargetPlatforms(getSelectedPlatformIds()),
enable_web_search: form.enableWebSearch,
generate_count: form.generateCount,
};
}
@@ -227,7 +227,7 @@ function handleTableChange(nextPage: number, nextPageSize: number): void {
{{ formatPublishPlatformSummary(record.target_platform) }}
</template>
<template v-else-if="column.key === 'generate_count'">
--
{{ record.generate_count || 1 }}
</template>
<template v-else-if="column.key === 'created_at'">
{{ formatDateTime(record.created_at) }}
@@ -119,6 +119,20 @@ function wrapStandaloneImages(html: string): string {
return root.innerHTML.trim();
}
function convertTablesToZhihuFormat(html: string): string {
let next = html;
// Zhihu requires all rows in a single <tbody> — merge <thead> into <tbody>
next = next.replace(/<\/thead>\s*<tbody>/gi, "");
next = next.replace(/<thead>/gi, "<tbody>");
next = next.replace(/<\/thead>/gi, "</tbody>");
// Mark tables with Zhihu data-draft attributes so the sanitizer preserves them
next = next.replace(
/<table\b/gi,
'<table data-draft-node="block" data-draft-type="table" data-draft-padding="8"',
);
return next;
}
function transformContent(html: string): string {
let next = html.trim();
@@ -129,6 +143,7 @@ function transformContent(html: string): string {
next = next.replace(/<figure[^>]*>\s*(<img[\s\S]*?>)\s*<\/figure>/gi, "$1");
next = next.replace(/<pre><code class="language-([^"]+)">/gi, '<pre lang="$1"><code>');
next = wrapStandaloneImages(next);
next = convertTablesToZhihuFormat(next);
return next;
}
+13
View File
@@ -991,6 +991,8 @@ export interface ScheduleTask {
name: string;
cron_expr: string;
target_platform: string | null;
enable_web_search: boolean;
generate_count: number;
start_at: string | null;
end_at: string | null;
next_run_at: string | null;
@@ -1005,6 +1007,8 @@ export interface ScheduleTaskRequest {
name: string;
cron_expr: string;
target_platform?: string;
enable_web_search?: boolean;
generate_count?: number;
start_at?: string;
end_at?: string;
}
@@ -1040,6 +1044,15 @@ export interface GenerateFromRuleRequest {
export interface GenerateFromRuleResponse {
article_id: number;
task_id: number;
article_ids: number[];
task_ids: number[];
items: Array<{
article_id: number;
task_id: number;
}>;
requested_generate_count: number;
success_count: number;
failed_count: number;
}
export interface InstantTaskListParams {
+1
View File
@@ -7,6 +7,7 @@ runtime:
- 输出语言与 locale 一致:zh-CN 使用简体中文,en-US 使用自然、专业的英语。
- 如提供了 title,使用该标题作为文章主标题,并围绕它展开,不要另起一个无关标题。
- 如提供了 article_outline,一级节点是正文的最终小节标题,必须按顺序展开;二级及更深节点仅作为该小节的行文思路、论证顺序或信息要点,不要机械写成额外标题。
- 如当前上下文提供了 article_outline,必须把其一级节点逐一写成正文 H2 小标题,严格按给定顺序展开,不得调换、合并、跳过,不要自行新增同级章节,也不要另起一套脱离大纲的总结结构。
- 除主标题和一级小节标题外,默认不要把大纲子节点直接写成 Markdown 标题;子节点内容应自然融入段落、列表或过渡句中。
- 如提供了 key_points,正文中必须覆盖这些重点,不要遗漏。
- 每个核心段落都要有明确判断、原因解释、适用场景或对比维度,避免空话、套话和重复表述。