openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

nextjs-with-flask-server persistence

Open marioishikawa opened this issue 2 years ago • 6 comments
trafficstars

The app example nextjs-with-flask-server seems to work fine. It populates the index and answer the questions. But after a refresh, it asks to upload the source files again, although they are already vectorized on Pinecone. Is this really the behavior expected?

marioishikawa avatar Mar 09 '23 15:03 marioishikawa

I hacked client/src/components/FileQandAArea.tsx to get round this for now. Commented out the if (props.files.length === 0) { block. Works fine after that with existing data from before.

AndyTNumikon avatar Mar 15 '23 13:03 AndyTNumikon

I hacked client/src/components/FileQandAArea.tsx to get round this for now. Commented out the if (props.files.length === 0) { block. Works fine after that with existing data from before.

Thanks. I did the same change and I also hard-coded the session-id for the function create_app on server/app.py It worked better because it seemed that it was trying to look on a wrong pinecone namespace attacched to the session. But still, it does not reply as well, as it needed something from the file. From the code and doc it was not clear to me if it needed to use the file name or content to send to the API.

marioishikawa avatar Mar 21 '23 21:03 marioishikawa

Im gonna try hardcoding the sessions ID, seemed for me when commenting out that line it stopped playing nice.

Side note have you tested uploading multiple files, seems that if i upload more than one file with the second being larger it breaks.

ismailntl avatar Mar 22 '23 19:03 ismailntl

yes, in my case it was multiple

marioishikawa avatar Mar 22 '23 20:03 marioishikawa

Im gonna try hardcoding the sessions ID, seemed for me when commenting out that line it stopped playing nice.

Side note have you tested uploading multiple files, seems that if i upload more than one file with the second being larger it breaks.

That was it. Fixing the session ID actually solves the problem, but it gets quite buggy with multiple files.

marioishikawa avatar Mar 27 '23 21:03 marioishikawa

In my case, merely hardcoding the "session_id" is insufficient. It's possible that I am using a different version, but I also need to persist the "file_text_dict" variable. Otherwise, attempting to access the vector without the accompanying text would result in no text being sent to ChatGPT.

rcaziraghi avatar Apr 09 '23 23:04 rcaziraghi

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Oct 25 '23 01:10 github-actions[bot]

This issue was closed because it has been stalled for 10 days with no activity.

github-actions[bot] avatar Nov 05 '23 01:11 github-actions[bot]