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;
}