feat(schedule): support KOL subscription targets and random time windows
Extend schedule tasks to dispatch KOL subscription prompts in addition to prompt rules, add daily/weekly scheduling with fixed or random time windows, and track dispatch outcomes (last run, status, consecutive failures). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1675,15 +1675,31 @@ export interface PromptRuleStatusRequest {
|
||||
|
||||
// --- Schedule Tasks ---
|
||||
|
||||
export type ScheduleTargetType = 'prompt_rule' | 'kol_subscription_prompt'
|
||||
export type ScheduleKind = 'daily' | 'weekly'
|
||||
export type ScheduleTimeMode = 'fixed' | 'random_window'
|
||||
export type ScheduleDispatchStatus = 'success' | 'failed' | string
|
||||
|
||||
export interface ScheduleTask {
|
||||
id: number
|
||||
workspace_id: number | null
|
||||
prompt_rule_id: number
|
||||
target_type: ScheduleTargetType
|
||||
prompt_rule_id: number | null
|
||||
prompt_rule_name: string | null
|
||||
subscription_prompt_id: number | null
|
||||
subscription_prompt_name: string | null
|
||||
subscription_package_name: string | null
|
||||
subscription_kol_name: string | null
|
||||
brand_id: number | null
|
||||
brand_name: string | null
|
||||
name: string
|
||||
cron_expr: string
|
||||
schedule_kind: ScheduleKind
|
||||
schedule_days: string[]
|
||||
schedule_time_mode: ScheduleTimeMode
|
||||
random_window_start: string
|
||||
random_window_end: string
|
||||
generation_input: Record<string, JsonValue>
|
||||
auto_publish: boolean
|
||||
publish_account_ids: string[]
|
||||
auto_publish_platforms: string[]
|
||||
@@ -1695,6 +1711,10 @@ export interface ScheduleTask {
|
||||
end_at: string | null
|
||||
next_run_at: string | null
|
||||
status: 'enabled' | 'disabled'
|
||||
last_run_at: string | null
|
||||
last_dispatch_status: ScheduleDispatchStatus | null
|
||||
last_dispatch_error: string | null
|
||||
consecutive_failures: number
|
||||
generation_status?: string | null
|
||||
execution_time?: string | null
|
||||
generated_articles?: GeneratedArticleLink[] | null
|
||||
@@ -1703,10 +1723,18 @@ export interface ScheduleTask {
|
||||
}
|
||||
|
||||
export interface ScheduleTaskRequest {
|
||||
prompt_rule_id: number
|
||||
target_type?: ScheduleTargetType
|
||||
prompt_rule_id?: number | null
|
||||
subscription_prompt_id?: number | null
|
||||
brand_id?: number | null
|
||||
name: string
|
||||
cron_expr: string
|
||||
cron_expr?: string
|
||||
schedule_kind?: ScheduleKind
|
||||
schedule_days?: string[]
|
||||
schedule_time_mode?: ScheduleTimeMode
|
||||
random_window_start?: string
|
||||
random_window_end?: string
|
||||
generation_input?: Record<string, JsonValue>
|
||||
auto_publish?: boolean
|
||||
publish_account_ids?: string[]
|
||||
cover_asset_url?: string | null
|
||||
@@ -1721,6 +1749,8 @@ export interface ScheduleTaskListParams {
|
||||
page?: number
|
||||
page_size?: number
|
||||
prompt_rule_id?: number
|
||||
subscription_prompt_id?: number
|
||||
target_type?: ScheduleTargetType
|
||||
status?: string
|
||||
keyword?: string
|
||||
created_from?: string
|
||||
|
||||
Reference in New Issue
Block a user