Fix queue ResultItem schema (#1386)

This commit is contained in:
Chenlei Hu
2024-10-30 20:36:33 -04:00
committed by GitHub
parent ed0592d6e0
commit 0c8fe41b84
2 changed files with 7 additions and 7 deletions

View File

@@ -28,7 +28,7 @@ export enum TaskItemDisplayStatus {
export class ResultItemImpl {
filename: string
subfolder?: string
subfolder: string
type: string
nodeId: NodeId
@@ -40,9 +40,9 @@ export class ResultItemImpl {
frame_rate?: number
constructor(obj: Record<string, any>) {
this.filename = obj.filename
this.subfolder = obj.subfolder
this.type = obj.type
this.filename = obj.filename ?? ''
this.subfolder = obj.subfolder ?? ''
this.type = obj.type ?? ''
this.nodeId = obj.nodeId
this.mediaType = obj.mediaType
@@ -55,7 +55,7 @@ export class ResultItemImpl {
const params = new URLSearchParams()
params.set('filename', this.filename)
params.set('type', this.type)
params.set('subfolder', this.subfolder || '')
params.set('subfolder', this.subfolder)
if (this.format) {
params.set('format', this.format)

View File

@@ -10,9 +10,9 @@ const zNodeType = z.string()
const zQueueIndex = z.number()
const zPromptId = z.string()
const zResultItem = z.object({
filename: z.string(),
filename: z.string().optional(),
subfolder: z.string().optional(),
type: z.string()
type: z.string().optional()
})
export type ResultItem = z.infer<typeof zResultItem>
const zOutputs = z