fix(api): return files download url for "files" output
This commit is contained in:
		
							parent
							
								
									61d3e2f65a
								
							
						
					
					
						commit
						3e55efe0a5
					
				@ -48,13 +48,20 @@ export async function GET(request: Request) {
 | 
			
		||||
    for (let i = 0; i < run.outputs.length; i++) {
 | 
			
		||||
      const output = run.outputs[i];
 | 
			
		||||
 | 
			
		||||
      if (output.data?.images === undefined) continue;
 | 
			
		||||
 | 
			
		||||
      for (let j = 0; j < output.data?.images.length; j++) {
 | 
			
		||||
        const element = output.data?.images[j];
 | 
			
		||||
        element.url = replaceCDNUrl(
 | 
			
		||||
          `${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
 | 
			
		||||
        );
 | 
			
		||||
      if (output.data?.images !== undefined) {
 | 
			
		||||
        for (let j = 0; j < output.data?.images.length; j++) {
 | 
			
		||||
          const element = output.data?.images[j];
 | 
			
		||||
          element.url = replaceCDNUrl(
 | 
			
		||||
            `${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      } else if (output.data?.files !== undefined) {
 | 
			
		||||
        for (let j = 0; j < output.data?.files.length; j++) {
 | 
			
		||||
          const element = output.data?.files[j];
 | 
			
		||||
          element.url = replaceCDNUrl(
 | 
			
		||||
            `${process.env.SPACES_ENDPOINT}/${process.env.SPACES_BUCKET}/outputs/runs/${run.id}/${element.filename}`
 | 
			
		||||
          );
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user