feat(migrations): Harden task audit tracking and optimize article templates
- Added migration to harden task audit tracking by modifying audit_logs and related tables. - Introduced operator_id to several tables for better tracking of actions. - Updated article_templates with new prompt templates for various article types, enhancing content generation. - Created prompt_rules and schedule_tasks tables to manage content generation rules and scheduling. - Added foreign key constraints to articles for better data integrity.
This commit is contained in:
@@ -121,7 +121,11 @@ export interface TemplateDetail extends TemplateListItem {
|
||||
}
|
||||
|
||||
export interface TemplateGenerateRequest {
|
||||
article_id?: number;
|
||||
input_params: Record<string, JsonValue>;
|
||||
wizard_state?: Record<string, JsonValue>;
|
||||
enable_web_search?: boolean;
|
||||
web_search_limit?: number;
|
||||
}
|
||||
|
||||
export interface TemplateGenerateResponse {
|
||||
@@ -129,6 +133,98 @@ export interface TemplateGenerateResponse {
|
||||
task_id: number;
|
||||
}
|
||||
|
||||
export interface TemplateSaveDraftRequest {
|
||||
article_id?: number;
|
||||
current_step: number;
|
||||
wizard_state: Record<string, JsonValue>;
|
||||
}
|
||||
|
||||
export interface TemplateSaveDraftResponse {
|
||||
article_id: number;
|
||||
}
|
||||
|
||||
export interface TemplateAssistCompetitor {
|
||||
name: string;
|
||||
website?: string | null;
|
||||
description?: string | null;
|
||||
}
|
||||
|
||||
export interface TemplateAnalyzeTaskRequest {
|
||||
locale: string;
|
||||
brand_id?: number | null;
|
||||
brand_name?: string;
|
||||
website?: string | null;
|
||||
input_params?: Record<string, JsonValue>;
|
||||
existing_keywords?: string[];
|
||||
existing_competitors?: TemplateAssistCompetitor[];
|
||||
}
|
||||
|
||||
export interface TemplateAnalyzeResult {
|
||||
brand_summary: string;
|
||||
keywords: string[];
|
||||
competitors: TemplateAssistCompetitor[];
|
||||
}
|
||||
|
||||
export interface TemplateTitleTaskRequest {
|
||||
locale: string;
|
||||
brand_id?: number | null;
|
||||
brand_name?: string;
|
||||
website?: string | null;
|
||||
brand_summary?: string | null;
|
||||
input_params?: Record<string, JsonValue>;
|
||||
keywords?: string[];
|
||||
competitors?: TemplateAssistCompetitor[];
|
||||
}
|
||||
|
||||
export interface TemplateOutlineNode {
|
||||
outline: string;
|
||||
children?: TemplateOutlineNode[];
|
||||
}
|
||||
|
||||
export interface TemplateOutlineTaskRequest {
|
||||
locale: string;
|
||||
brand_id?: number | null;
|
||||
brand_name?: string;
|
||||
website?: string | null;
|
||||
brand_summary?: string | null;
|
||||
title: string;
|
||||
input_params?: Record<string, JsonValue>;
|
||||
keywords?: string[];
|
||||
competitors?: TemplateAssistCompetitor[];
|
||||
outline_sections?: string[];
|
||||
key_points?: string | null;
|
||||
}
|
||||
|
||||
export interface TemplateAssistTaskCreateResponse {
|
||||
task_id: string;
|
||||
status: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface TemplateAnalyzeTaskResultResponse {
|
||||
task_id: string;
|
||||
status: string;
|
||||
message: string;
|
||||
result?: TemplateAnalyzeResult | null;
|
||||
error_message?: string | null;
|
||||
}
|
||||
|
||||
export interface TemplateTitleTaskResultResponse {
|
||||
task_id: string;
|
||||
status: string;
|
||||
message: string;
|
||||
result?: string[] | null;
|
||||
error_message?: string | null;
|
||||
}
|
||||
|
||||
export interface TemplateOutlineTaskResultResponse {
|
||||
task_id: string;
|
||||
status: string;
|
||||
message: string;
|
||||
result?: TemplateOutlineNode[] | null;
|
||||
error_message?: string | null;
|
||||
}
|
||||
|
||||
export interface ArticleListParams {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
@@ -136,16 +232,24 @@ export interface ArticleListParams {
|
||||
publish_status?: string;
|
||||
source_type?: string;
|
||||
template_id?: number;
|
||||
prompt_rule_id?: number;
|
||||
keyword?: string;
|
||||
created_from?: string;
|
||||
created_to?: string;
|
||||
}
|
||||
|
||||
export interface ArticleListItem {
|
||||
id: number;
|
||||
source_type: string;
|
||||
template_id: number | null;
|
||||
template_name: string | null;
|
||||
prompt_rule_id: number | null;
|
||||
prompt_rule_name: string | null;
|
||||
platforms: string[];
|
||||
generate_status: string;
|
||||
publish_status: string;
|
||||
title: string | null;
|
||||
generation_error_message: string | null;
|
||||
word_count: number;
|
||||
source_label: string | null;
|
||||
created_at: string;
|
||||
@@ -163,6 +267,7 @@ export interface ArticleDetail {
|
||||
source_type: string;
|
||||
template_id: number | null;
|
||||
template_name: string | null;
|
||||
platforms: string[];
|
||||
generate_status: string;
|
||||
publish_status: string;
|
||||
title: string | null;
|
||||
@@ -172,9 +277,16 @@ export interface ArticleDetail {
|
||||
source_label: string | null;
|
||||
version_no: number | null;
|
||||
generation_error_message: string | null;
|
||||
wizard_state?: Record<string, JsonValue> | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface UpdateArticleRequest {
|
||||
title: string;
|
||||
markdown_content: string;
|
||||
platforms?: string[];
|
||||
}
|
||||
|
||||
export interface ArticleVersion {
|
||||
id: number;
|
||||
version_no: number;
|
||||
@@ -256,3 +368,124 @@ export interface Competitor {
|
||||
product_lines_json: JsonValue | null;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
// --- Prompt Rule Groups ---
|
||||
|
||||
export interface PromptRuleGroup {
|
||||
id: number;
|
||||
name: string;
|
||||
sort_order: number;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
export interface PromptRuleGroupRequest {
|
||||
name: string;
|
||||
sort_order?: number;
|
||||
}
|
||||
|
||||
// --- Prompt Rules ---
|
||||
|
||||
export interface PromptRule {
|
||||
id: number;
|
||||
group_id: number | null;
|
||||
name: string;
|
||||
prompt_content: string;
|
||||
scene: string | null;
|
||||
default_tone: string | null;
|
||||
default_word_count: number | null;
|
||||
status: "enabled" | "disabled";
|
||||
article_count: number;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface PromptRuleRequest {
|
||||
group_id?: number | null;
|
||||
name: string;
|
||||
prompt_content: string;
|
||||
scene?: string;
|
||||
default_tone?: string;
|
||||
default_word_count?: number;
|
||||
}
|
||||
|
||||
export interface PromptRuleListParams {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
group_id?: number;
|
||||
ungrouped?: boolean;
|
||||
status?: string;
|
||||
keyword?: string;
|
||||
}
|
||||
|
||||
export interface PromptRuleListResponse {
|
||||
items: PromptRule[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface PromptRuleSimple {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface PromptRuleStatusRequest {
|
||||
status: "enabled" | "disabled";
|
||||
}
|
||||
|
||||
// --- Schedule Tasks ---
|
||||
|
||||
export interface ScheduleTask {
|
||||
id: number;
|
||||
prompt_rule_id: number;
|
||||
prompt_rule_name: string | null;
|
||||
brand_id: number | null;
|
||||
brand_name: string | null;
|
||||
name: string;
|
||||
cron_expr: string;
|
||||
target_platform: string | null;
|
||||
start_at: string | null;
|
||||
end_at: string | null;
|
||||
next_run_at: string | null;
|
||||
status: "enabled" | "disabled";
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export interface ScheduleTaskRequest {
|
||||
prompt_rule_id: number;
|
||||
brand_id?: number | null;
|
||||
name: string;
|
||||
cron_expr: string;
|
||||
target_platform?: string;
|
||||
start_at?: string;
|
||||
end_at?: string;
|
||||
}
|
||||
|
||||
export interface ScheduleTaskListParams {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
prompt_rule_id?: number;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export interface ScheduleTaskListResponse {
|
||||
items: ScheduleTask[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface ScheduleTaskStatusRequest {
|
||||
status: "enabled" | "disabled";
|
||||
}
|
||||
|
||||
// --- Instant Generate ---
|
||||
|
||||
export interface GenerateFromRuleRequest {
|
||||
prompt_rule_id: number;
|
||||
brand_id?: number;
|
||||
target_platform?: string;
|
||||
extra_params?: Record<string, JsonValue>;
|
||||
}
|
||||
|
||||
export interface GenerateFromRuleResponse {
|
||||
article_id: number;
|
||||
task_id: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user