feat(kol): add KOL TypeScript shared types
This commit is contained in:
@@ -1157,3 +1157,195 @@ export interface InstantTaskListResponse {
|
|||||||
items: InstantTaskItem[];
|
items: InstantTaskItem[];
|
||||||
total: number;
|
total: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- KOL types ----------
|
||||||
|
|
||||||
|
export type KolVariableType = "input" | "textarea" | "select" | "number" | "checkbox";
|
||||||
|
|
||||||
|
export interface KolVariableDefinition {
|
||||||
|
id: string; // immutable, e.g. "var_a1b2c3"
|
||||||
|
key: string; // default = label (supports Chinese)
|
||||||
|
label: string;
|
||||||
|
type: KolVariableType;
|
||||||
|
required?: boolean;
|
||||||
|
placeholder?: string;
|
||||||
|
options?: string[]; // only for select / checkbox
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolSchemaJson {
|
||||||
|
variables: KolVariableDefinition[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolProfile {
|
||||||
|
id: number;
|
||||||
|
tenant_id: number;
|
||||||
|
user_id: number;
|
||||||
|
display_name: string;
|
||||||
|
bio: string | null;
|
||||||
|
avatar_url: string | null;
|
||||||
|
market_enabled: boolean;
|
||||||
|
status: "active" | "suspended" | "closed";
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolProfileBrief {
|
||||||
|
id: number;
|
||||||
|
display_name: string;
|
||||||
|
status: "active" | "suspended" | "closed";
|
||||||
|
market_enabled: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolPackageSummary {
|
||||||
|
id: number;
|
||||||
|
kol_profile_id: number;
|
||||||
|
kol_display_name: string;
|
||||||
|
kol_avatar_url: string | null;
|
||||||
|
name: string;
|
||||||
|
description: string | null;
|
||||||
|
cover_url: string | null;
|
||||||
|
industry: string | null;
|
||||||
|
tags: string[];
|
||||||
|
price_note: string | null;
|
||||||
|
status: "draft" | "published" | "archived";
|
||||||
|
prompt_count: number;
|
||||||
|
subscriber_count: number;
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolPackageDetail extends KolPackageSummary {
|
||||||
|
kol_bio: string | null;
|
||||||
|
prompts: KolPackagePromptSummary[];
|
||||||
|
subscription?: KolSubscription | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolPackagePromptSummary {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
platform_hint: string | null;
|
||||||
|
status: "draft" | "active" | "archived";
|
||||||
|
published_revision_no: number | null;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolPromptDetail {
|
||||||
|
id: number;
|
||||||
|
package_id: number;
|
||||||
|
name: string;
|
||||||
|
platform_hint: string | null;
|
||||||
|
status: "draft" | "active" | "archived";
|
||||||
|
sort_order: number;
|
||||||
|
published_revision_no: number | null;
|
||||||
|
draft_revision_no: number | null;
|
||||||
|
latest_schema_json: KolSchemaJson | null;
|
||||||
|
latest_card_config_json: Record<string, unknown> | null;
|
||||||
|
latest_prompt_content: string | null;
|
||||||
|
created_at: string;
|
||||||
|
updated_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolSubscription {
|
||||||
|
id: number;
|
||||||
|
package_id: number;
|
||||||
|
status: "pending" | "active" | "expired" | "revoked";
|
||||||
|
start_at: string | null;
|
||||||
|
end_at: string | null;
|
||||||
|
created_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolSubscriptionPromptCard {
|
||||||
|
id: number;
|
||||||
|
package_id: number;
|
||||||
|
package_name: string;
|
||||||
|
prompt_id: number;
|
||||||
|
prompt_name: string;
|
||||||
|
platform_hint: string | null;
|
||||||
|
kol_display_name: string;
|
||||||
|
granted_at: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolSubscriptionPromptSchema {
|
||||||
|
id: number;
|
||||||
|
package_id: number;
|
||||||
|
prompt_id: number;
|
||||||
|
prompt_name: string;
|
||||||
|
package_name: string;
|
||||||
|
platform_hint: string | null;
|
||||||
|
schema_json: KolSchemaJson;
|
||||||
|
card_config_json: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolGenerateRequest {
|
||||||
|
variables: Record<string, string | number | boolean | string[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolGenerateResponse {
|
||||||
|
article_id: number;
|
||||||
|
generation_task_id: number;
|
||||||
|
usage_log_id: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolAssistRequest {
|
||||||
|
mode: "generate" | "optimize";
|
||||||
|
description?: string;
|
||||||
|
current_content?: string;
|
||||||
|
prompt_id?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolAssistTask {
|
||||||
|
id: string;
|
||||||
|
status: "queued" | "running" | "completed" | "failed";
|
||||||
|
result?: { content: string; schema: KolSchemaJson };
|
||||||
|
error_message?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolDashboardOverview {
|
||||||
|
total_subscriber_tenants: number;
|
||||||
|
month_new_subscriptions: number;
|
||||||
|
total_usage: number;
|
||||||
|
month_usage: number;
|
||||||
|
failure_count: number;
|
||||||
|
failure_rate: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolDashboardPackageStat {
|
||||||
|
package_id: number;
|
||||||
|
package_name: string;
|
||||||
|
subscriber_tenants: number;
|
||||||
|
usage_count: number;
|
||||||
|
failure_rate: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolDashboardTrendPoint {
|
||||||
|
date: string;
|
||||||
|
subscriptions: number;
|
||||||
|
usages: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CreateKolPackageRequest {
|
||||||
|
name: string;
|
||||||
|
description?: string;
|
||||||
|
cover_url?: string;
|
||||||
|
industry?: string;
|
||||||
|
tags: string[];
|
||||||
|
price_note?: string;
|
||||||
|
}
|
||||||
|
export type UpdateKolPackageRequest = CreateKolPackageRequest;
|
||||||
|
|
||||||
|
export interface CreateKolPromptRequest {
|
||||||
|
name: string;
|
||||||
|
platform_hint?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface UpdateKolPromptRequest {
|
||||||
|
name: string;
|
||||||
|
platform_hint?: string;
|
||||||
|
sort_order?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface KolSaveDraftRequest {
|
||||||
|
content: string;
|
||||||
|
schema: KolSchemaJson;
|
||||||
|
card_config: Record<string, unknown>;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user