Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,8 @@ def load_retrievers_metadata():
|
|
| 46 |
with open(RETRIEVERS_JSON_PATH, 'r', encoding='utf-8') as f:
|
| 47 |
return json.load(f)
|
| 48 |
except Exception as e:
|
| 49 |
-
|
|
|
|
| 50 |
return {}
|
| 51 |
|
| 52 |
retrievers_metadata = load_retrievers_metadata()
|
|
@@ -58,7 +59,7 @@ indices: Dict[str, VectorStoreIndex] = {}
|
|
| 58 |
for source, rel_path in SOURCES.items():
|
| 59 |
full_path = os.path.join(DOCUMENTS_BASE_PATH, rel_path)
|
| 60 |
if not os.path.exists(full_path):
|
| 61 |
-
|
| 62 |
continue
|
| 63 |
|
| 64 |
for root, dirs, files in os.walk(full_path):
|
|
@@ -68,9 +69,10 @@ for source, rel_path in SOURCES.items():
|
|
| 68 |
storage_context = StorageContext.from_defaults(persist_dir=storage_path)
|
| 69 |
index_name = os.path.basename(root)
|
| 70 |
indices[index_name] = load_index_from_storage(storage_context) #, index_id="vector_index"
|
| 71 |
-
|
| 72 |
except Exception as e:
|
| 73 |
-
|
|
|
|
| 74 |
|
| 75 |
|
| 76 |
|
|
|
|
| 46 |
with open(RETRIEVERS_JSON_PATH, 'r', encoding='utf-8') as f:
|
| 47 |
return json.load(f)
|
| 48 |
except Exception as e:
|
| 49 |
+
print(f"Error cargando retrievers.json: {str(e)}")
|
| 50 |
+
print(f"Detalles del error: {traceback.format_exc()}") # Necesitar铆as importar traceback
|
| 51 |
return {}
|
| 52 |
|
| 53 |
retrievers_metadata = load_retrievers_metadata()
|
|
|
|
| 59 |
for source, rel_path in SOURCES.items():
|
| 60 |
full_path = os.path.join(DOCUMENTS_BASE_PATH, rel_path)
|
| 61 |
if not os.path.exists(full_path):
|
| 62 |
+
print(f"Advertencia: No se encontr贸 la ruta para {source}")
|
| 63 |
continue
|
| 64 |
|
| 65 |
for root, dirs, files in os.walk(full_path):
|
|
|
|
| 69 |
storage_context = StorageContext.from_defaults(persist_dir=storage_path)
|
| 70 |
index_name = os.path.basename(root)
|
| 71 |
indices[index_name] = load_index_from_storage(storage_context) #, index_id="vector_index"
|
| 72 |
+
print(f"脥ndice cargado correctamente: {index_name}")
|
| 73 |
except Exception as e:
|
| 74 |
+
print(f"Error cargando 铆ndice {index_name}: {str(e)}")
|
| 75 |
+
print(f"Detalles del error: {traceback.format_exc()}")
|
| 76 |
|
| 77 |
|
| 78 |
|