For some reason, v0-sdk (platform) doesn’t allow uploading attachments with proper names.
sendMessage() asks only for the url field, which doesn’t make sense since it implies that v0 expects you to handle the upload from my side, so I would need first to upload the file to some bucket, and then send the generated URL to V0. But then V0 handles the attachments internally in its own buckets, and now the document has no name at all, so V0 assigns a random ID.
This scenario also implies that I would be uploading files to my own bucket and not even using it, since V0 later tries to handle it on its own and falls back to the CDN generated by Vercel instead of the one I provided. By reading their docs. I couldn’t find a way to upload files in an ongoing chat using sendMessage() too.
Yes you are expected to upload the file yourself and pass v0 the download link. Keeping the file contents out of the chat history is important for minimizing context and replayability and works around the current platform limitations of a 4.5MB request body size.
You can use Vercel Blob to quickly upload files before passing to the v0 Platform SDK
Can you explain more about the behaviour with the filename? It should maintain the order so you can remap yourself, although it’s likely we can improve our developer experience here
You can use Vercel Blob to quickly upload files before passing to the v0 Platform SDK
Yep, I’m already using Vercel Blob for files.
Can you explain more about the behaviour with the filename? It should maintain the order so you can remap yourself
Sorry, I didn’t understand this one. What do you mean by keeping the order? Explaining the problem further, let’s imagine you were building a V0 clone or something similar and allowing users to upload their files. With the current SDK, it expects you to upload the file yourself (so you’ve used Vercel Blob) and pass the download URL, and the problem starts there. v0-sdk doesn’t allow you to set the file name for these download URLs, nor get it from the URL, so if you upload some file using the SDK, and then check the same chat but on V0 Platform, the file doesn’t have a name; it shows the fallback name “attachment”.
It creates a scenario where, when you load the chat history and try to show previously uploaded files, I now also need to show “attachment” because V0 loses file names during the process. It would greatly improve the DX if the SDK could keep these names or something similar. Otherwise, I would need to track somehow what Vercel generated and map their IDs with my IDs (from my Vercel Blob, but this solution sucks)