You should be able to use the Vector Store API to upload files to your Vector Store:
const vectorStore = getYourVectorStoreObjectFromSomewhere(...)
// To upload multiple files
openai.beta.vectorStores.fileBatches.uploadAndPoll(vectorStore.id, { files: [file1, file2] })
// To upload a single file
openai.beta.vectorStores.files.uploadAndPoll(vectorStore.id, file1)
I assume you need to store at least the Vector Store ID somewhere in your stateful app.
You can also use
upload
instead of uploadAndPoll
if you don’t need the polling mechanism.
Is this what you had in mind?