haixunMaster/lib/jobs/types.ts

52 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: "海巡",
};