返回 oh-my-ppt
run-state.ts
根目录 / src / main / image-generation / run-state.ts
1 export type ImageRunStatus = 'running' | 'completed' | 'failed' | 'cancelled'
2
3 export type ImageRunState = {
4 runId: string
5 sessionId: string
6 pageId: string
7 progress: number
8 label: string
9 status: ImageRunStatus
10 error?: string
11 updatedAt: number
12 }
13
14 const imageRunStates = new Map<string, ImageRunState>()
15
16 export function setImageRunState(state: ImageRunState): void {
17 imageRunStates.set(state.sessionId, state)
18 }
19
20 export function getImageRunState(sessionId: string): ImageRunState | undefined {
21 return imageRunStates.get(sessionId)
22 }
23
23 lines TYPESCRIPT