Spaces:
Sleeping
Sleeping
Update metadata_search/app.py
Browse files- metadata_search/app.py +37 -0
metadata_search/app.py
CHANGED
|
@@ -10,6 +10,43 @@ from dotenv import load_dotenv
|
|
| 10 |
|
| 11 |
load_dotenv(override=True)
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
# ---------------------------------------------------------------------------
|
| 14 |
# Hugging Face Dataset bootstrap
|
| 15 |
# Download only the search-critical metadata + Qdrant index at startup.
|
|
|
|
| 10 |
|
| 11 |
load_dotenv(override=True)
|
| 12 |
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
from local_rag.summaries import summary_path, load_summary
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
@app.get("/api/test-summary")
|
| 22 |
+
def test_summary():
|
| 23 |
+
file_name = request.args.get("file", "").strip()
|
| 24 |
+
|
| 25 |
+
if not file_name:
|
| 26 |
+
return jsonify({
|
| 27 |
+
"ok": False,
|
| 28 |
+
"error": "Missing ?file=..."
|
| 29 |
+
}), 400
|
| 30 |
+
|
| 31 |
+
path = summary_path(file_name)
|
| 32 |
+
text = load_summary(file_name)
|
| 33 |
+
|
| 34 |
+
return jsonify({
|
| 35 |
+
"ok": path is not None and text is not None,
|
| 36 |
+
"file_name": file_name,
|
| 37 |
+
"resolved_path": str(path) if path else None,
|
| 38 |
+
"text_length": len(text) if text else 0,
|
| 39 |
+
"preview": text[:500] if text else None,
|
| 40 |
+
})
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
# ---------------------------------------------------------------------------
|
| 51 |
# Hugging Face Dataset bootstrap
|
| 52 |
# Download only the search-critical metadata + Qdrant index at startup.
|