|
|
|
@ -141,17 +141,17 @@ def check_docs():
|
|
|
|
|
if os.path.exists(vectorstore):
|
|
|
|
|
return {"status": 'exists'}
|
|
|
|
|
else:
|
|
|
|
|
r = requests.get(base_path + vectorstore + "docs.index")
|
|
|
|
|
r = requests.get(base_path + vectorstore + "index.faiss")
|
|
|
|
|
# save to vectors directory
|
|
|
|
|
# check if the directory exists
|
|
|
|
|
if not os.path.exists(vectorstore):
|
|
|
|
|
os.makedirs(vectorstore)
|
|
|
|
|
|
|
|
|
|
with open(vectorstore + "docs.index", "wb") as f:
|
|
|
|
|
with open(vectorstore + "index.faiss", "wb") as f:
|
|
|
|
|
f.write(r.content)
|
|
|
|
|
# download the store
|
|
|
|
|
r = requests.get(base_path + vectorstore + "faiss_store.pkl")
|
|
|
|
|
with open(vectorstore + "faiss_store.pkl", "wb") as f:
|
|
|
|
|
r = requests.get(base_path + vectorstore + "index.pkl")
|
|
|
|
|
with open(vectorstore + "index.pkl", "wb") as f:
|
|
|
|
|
f.write(r.content)
|
|
|
|
|
|
|
|
|
|
return {"status": 'loaded'}
|
|
|
|
|