mirror of
https://github.com/arc53/DocsGPT
synced 2024-11-17 21:26:26 +00:00
minor fixes on deleting
This commit is contained in:
parent
94f3533c29
commit
8320cca5cd
@ -1,8 +1,7 @@
|
||||
OPENAI_API_KEY=<LLM api key (for example, open ai key)>
|
||||
SELF_HOSTED_MODEL=false
|
||||
API_KEY=<LLM api key (for example, open ai key)>
|
||||
VITE_API_STREAMING=true
|
||||
|
||||
#For Azure
|
||||
#For Azure (you can delete it if you don't use Azure)
|
||||
OPENAI_API_BASE=
|
||||
OPENAI_API_VERSION=
|
||||
AZURE_DEPLOYMENT_NAME=
|
||||
|
@ -84,13 +84,14 @@ def delete_old():
|
||||
path = request.args.get("path")
|
||||
dirs = path.split("/")
|
||||
dirs_clean = []
|
||||
for i in range(1, len(dirs)):
|
||||
for i in range(0, len(dirs)):
|
||||
dirs_clean.append(secure_filename(dirs[i]))
|
||||
# check that path strats with indexes or vectors
|
||||
if dirs[0] not in ["indexes", "vectors"]:
|
||||
|
||||
if dirs_clean[0] not in ["indexes", "vectors"]:
|
||||
return {"status": "error"}
|
||||
path_clean = "/".join(dirs)
|
||||
vectors_collection.delete_one({"location": path})
|
||||
path_clean = "/".join(dirs_clean)
|
||||
vectors_collection.delete_one({"name": dirs_clean[-1], 'user': dirs_clean[-2]})
|
||||
if settings.VECTOR_STORE == "faiss":
|
||||
try:
|
||||
shutil.rmtree(os.path.join(current_dir, path_clean))
|
||||
|
Loading…
Reference in New Issue
Block a user