dissorial / doc-chatbot

Document chatbot — multiple files, topics, chat windows and chat history. Powered by GPT.
824 stars 139 forks source link

Issue on upload.ts #31

Open kevinbaroro opened 1 year ago

kevinbaroro commented 1 year ago

``Hi @dissorial, I have tried to deploy the app in the azure web app, I have successfully deployed it but I have encountered one issue which I'm hoping you know what's causing below issue.

A. When I tried to upload a file it says on the network reponse "{"message":"Files /tmp/BSzeVfW4xjD0TZ8ncpF_T99A.pdf uploaded and moved!"}" B. Right after uploaded I add a namespace name "Test" and clicking the Ingest button and the network response "{"message":"Data ingestion complete"}"

I'm assuming the above events will created a pinecone data but it's not happening.

To give you context on what I change on the code to make the deployment worked.

  1. I changed the env to this NODE_ENV=production.
  2. Since the current code when deployed in the azure web app wont work when I upload a file and ingest it will give me an error "EXDEV: cross-device link not permitted" on the file I uploaded.
  3. So I change the upload.ts in the part of if (process.env.NODE_ENV !== 'production') to if (process.env.NODE_ENV == 'production') to force to use the development code instead of the production code and after that I get the A and B results above and it's not creating the Pinecone index and it is also not uploading the file in the web app.

I hope my points above is clear. Hoping for your response. Thank you.

dissorial commented 1 year ago

Hi,

I believe this issue is happening because in upload.ts, we are temporarily uploading files to a tmp directory, which is provided by Vercel once the app is deployed. I'm quite certain that Azure does not provided the exact same thing on deployment, which means that handling uploads will likely be broken. To solve your problem, you may need to look up how to upload files to a temporary storage on Azure, and modify the code in upload.ts accordingly.