import { fetchWithAuth } from "./client"; // ── 类型定义 ──────────────────────────────────────────────────────────────────── export interface ContentGenerateRequest { target_keyword: string; target_platform?: string; knowledge_base_ids?: string[]; content_style?: string; word_count?: number; brand_name?: string; brand_description?: string; run_deai?: boolean; run_geo?: boolean; } export interface PipelineStage { stage: string; status: string; word_count?: number; } export interface ContentGenerateResponse { status: string; content: string; optimized_content: string; seo_score: number | null; topics: Record[]; pipeline_stages: PipelineStage[]; } export interface TopicItem { title: string; reason?: string; [key: string]: unknown; } export interface GenerateTopicsResponse { status: string; topics: TopicItem[]; } // ── API ──────────────────────────────────────────────────────────────────────── export const contentGenerationApi = { generateContent: (token?: string, params?: ContentGenerateRequest) => fetchWithAuth( "/api/v1/content/generate", { method: "POST", body: JSON.stringify(params) }, token ) as Promise, generateTopics: ( token?: string, params?: Pick ) => fetchWithAuth( "/api/v1/content/generate-topics", { method: "POST", body: JSON.stringify(params) }, token ) as Promise, };