haixunMaster/lib/jobs/types.ts

52 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-06-21 12:50:31 +00:00
export type JobType = "ai-task" | "analyze-topic" | "style-8d" | "scan";
export type JobStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
export type JobTaskStatus =
| "pending"
| "running"
| "done"
| "failed"
| "cancelled";
export interface JobTaskProgress {
id: string;
label: string;
status: JobTaskStatus;
found?: number;
error?: string;
/** 瀏覽器爬蟲目前子步驟(例如:滾動載入更多) */
step?: string;
stepDetail?: string;
/** 任務開始時間ms用於顯示已耗時 */
startedAt?: number;
}
export interface JobProgressDetail {
summary: string;
phase?: "tasks" | "web" | "save" | "quality" | "replies" | "ai" | "accounts" | "session" | "samples" | "style" | "store" | "ai-work";
tasks?: JobTaskProgress[];
}
export interface AnalyzeTopicPayload {
topicId: string;
brief?: string | null;
}
export interface ScanPayload {
topicId: string;
useTags?: boolean;
selectedTags?: string[];
}
export interface Style8DPayload {
accountId: string;
benchmarkUsername: string;
}
export const JOB_LABELS: Record<JobType, string> = {
"ai-task": "AI 任務",
"analyze-topic": "AI 研究地圖",
"style-8d": "帳號 8D 分析",
scan: "海巡",
};