Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix image generated not available after some time #496

Closed
mingming-ma opened this issue Mar 13, 2024 · 3 comments · Fixed by #549
Closed

Fix image generated not available after some time #496

mingming-ma opened this issue Mar 13, 2024 · 3 comments · Fixed by #549
Assignees
Milestone

Comments

@mingming-ma
Copy link
Collaborator

The image generated will be not available due to URL lifetime ( #493 )

image

Need to figure out how to store so user can back check them later.

DALL-E API Image URL lifetime

@rjwignar
Copy link
Collaborator

I ran into this issue while working on a class project.
We ended up using Cloudinary's free tier to store DALL-E-generated images, but
a better solution for ChatCraft might be to use a local object storage instance.

@humphd we're already using R2 to store local chats, would it be a good idea to store these images in R2 as well?

@humphd
Copy link
Collaborator

humphd commented Mar 27, 2024

For shared chats, yes. For local ones, they will be in db.

@mingming-ma
Copy link
Collaborator Author

so a possible fix maybe, don't know fetch again in the response is a good idea

    const imageDataUrls = await Promise.all(response.data.map(async (img: any) => {
      const imageResponse = await fetch(img.url);
      const imageBlob = await imageResponse.blob();
      const imageDataUrl = URL.createObjectURL(imageBlob);
      return imageDataUrl;
    }));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants