Open curvejumpinc opened 1 month ago
The same use case as mine where I described it in here #294. This change adds support for Buffer
instead of file path.
Here's an example I use in my SvelteKit App:
const file = formData.get("file") as File | null
const fileBuffer = await file?.arrayBuffer();
if (!fileBuffer) return
const filename = Date.now() + file?.name
const fileResult = await fileManager.uploadFile(Buffer.from(fileBuffer), {
displayName: filename.split("/")[2],
mimeType: "application/pdf",
})
Description of the bug:
I have a use case where the user will upload some file that will be sent to Gemini and then a conversation begins. I'm using the GoogleAIFileManager. The error I get is
Error: ENOENT: no such file or directory, open 'http://127.0.0.1:54321/storage/v1/object/sign/resumes/31a03e74-1639-45b6-bfa7-77447f1a4762/resume-yep5k4.pdf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJyZXN1bWVzLzMxYTAzZTc0LTE2MzktNDViNi1iZmE3LTc3NDQ3ZjFhNDc2Mi9yZXN1bWUteWVwNWs0LnBkZiIsImlhdCI6MTcyOTE0MzQwOCwiZXhwIjoxNzI5MTQ0MDA4fQ.Kjcfaaseb_vo6TRoNZq9td7_4Tr5zQS_gPSiyDaCUJI'
Is the API work for files with URLs like this?
Does it need to be a file hosted in a different way?
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response