mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-29 08:33:20 +00:00
(feat:dir-reader) maintain dir structure in db
This commit is contained in:
@@ -50,16 +50,16 @@ def upload_index_files():
|
||||
sync_frequency = request.form["sync_frequency"] if "sync_frequency" in request.form else None
|
||||
|
||||
file_path = request.form.get("file_path")
|
||||
file_token_counts = request.form.get("file_token_counts")
|
||||
directory_structure = request.form.get("directory_structure")
|
||||
|
||||
if file_token_counts:
|
||||
if directory_structure:
|
||||
try:
|
||||
file_token_counts = json.loads(file_token_counts)
|
||||
directory_structure = json.loads(directory_structure)
|
||||
except:
|
||||
logger.error("Error parsing file_token_counts")
|
||||
file_token_counts = {}
|
||||
logger.error("Error parsing directory_structure")
|
||||
directory_structure = {}
|
||||
else:
|
||||
file_token_counts = {}
|
||||
directory_structure = {}
|
||||
|
||||
storage = StorageCreator.get_storage()
|
||||
index_base_path = f"indexes/{id}"
|
||||
@@ -99,7 +99,7 @@ def upload_index_files():
|
||||
"remote_data": remote_data,
|
||||
"sync_frequency": sync_frequency,
|
||||
"file_path": file_path,
|
||||
"file_token_counts": file_token_counts,
|
||||
"directory_structure": directory_structure,
|
||||
}
|
||||
},
|
||||
)
|
||||
@@ -118,7 +118,7 @@ def upload_index_files():
|
||||
"remote_data": remote_data,
|
||||
"sync_frequency": sync_frequency,
|
||||
"file_path": file_path,
|
||||
"file_token_counts": file_token_counts,
|
||||
"directory_structure": directory_structure,
|
||||
}
|
||||
)
|
||||
return {"status": "ok"}
|
||||
|
||||
Reference in New Issue
Block a user