Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
|
@@ -59,7 +59,7 @@ def load_retrievers_metadata():
|
|
| 59 |
with open(RETRIEVERS_JSON_PATH, 'r', encoding='utf-8') as f:
|
| 60 |
return json.load(f)
|
| 61 |
except Exception as e:
|
| 62 |
-
|
| 63 |
return {}
|
| 64 |
|
| 65 |
retrievers_metadata = load_retrievers_metadata()
|
|
@@ -71,7 +71,7 @@ indices: Dict[str, VectorStoreIndex] = {}
|
|
| 71 |
for source, rel_path in SOURCES.items():
|
| 72 |
full_path = os.path.join(DOCUMENTS_BASE_PATH, rel_path)
|
| 73 |
if not os.path.exists(full_path):
|
| 74 |
-
|
| 75 |
continue
|
| 76 |
|
| 77 |
for root, dirs, files in os.walk(full_path):
|
|
@@ -81,9 +81,9 @@ for source, rel_path in SOURCES.items():
|
|
| 81 |
storage_context = StorageContext.from_defaults(persist_dir=storage_path)
|
| 82 |
index_name = os.path.basename(root)
|
| 83 |
indices[index_name] = load_index_from_storage(storage_context, index_id="vector_index")
|
| 84 |
-
|
| 85 |
except Exception as e:
|
| 86 |
-
|
| 87 |
|
| 88 |
|
| 89 |
|
|
|
|
| 59 |
with open(RETRIEVERS_JSON_PATH, 'r', encoding='utf-8') as f:
|
| 60 |
return json.load(f)
|
| 61 |
except Exception as e:
|
| 62 |
+
logger.error(f"Error cargando retrievers.json: {str(e)}", exc_info=True)
|
| 63 |
return {}
|
| 64 |
|
| 65 |
retrievers_metadata = load_retrievers_metadata()
|
|
|
|
| 71 |
for source, rel_path in SOURCES.items():
|
| 72 |
full_path = os.path.join(DOCUMENTS_BASE_PATH, rel_path)
|
| 73 |
if not os.path.exists(full_path):
|
| 74 |
+
logger.warning(f"No se encontr贸 la ruta para {source}")
|
| 75 |
continue
|
| 76 |
|
| 77 |
for root, dirs, files in os.walk(full_path):
|
|
|
|
| 81 |
storage_context = StorageContext.from_defaults(persist_dir=storage_path)
|
| 82 |
index_name = os.path.basename(root)
|
| 83 |
indices[index_name] = load_index_from_storage(storage_context, index_id="vector_index")
|
| 84 |
+
logger.info(f"脥ndice cargado correctamente: {index_name}")
|
| 85 |
except Exception as e:
|
| 86 |
+
logger.error(f"Error cargando 铆ndice {index_name}: {str(e)}", exc_info=True)
|
| 87 |
|
| 88 |
|
| 89 |
|