starfriend commited on
Commit
044424b
·
verified ·
1 Parent(s): 58a1bb6

Update metadata_search/app.py

Browse files
Files changed (1) hide show
  1. metadata_search/app.py +48 -37
metadata_search/app.py CHANGED
@@ -10,43 +10,6 @@ from dotenv import load_dotenv
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.
@@ -141,6 +104,54 @@ from backend.model import llm_backend_name
141
  DEFAULT_TOP_K = 10
142
  ALLOWED_TOP_K = {10, 50, 100, 200}
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  if not Path(PAPER_CSV).is_file():
145
  raise SystemExit(f"Paper dataset not found: {PAPER_CSV}. Set PAPER_CSV in .env.")
146
 
 
10
 
11
  load_dotenv(override=True)
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  # ---------------------------------------------------------------------------
14
  # Hugging Face Dataset bootstrap
15
  # Download only the search-critical metadata + Qdrant index at startup.
 
104
  DEFAULT_TOP_K = 10
105
  ALLOWED_TOP_K = {10, 50, 100, 200}
106
 
107
+
108
+
109
+
110
+
111
+
112
+
113
+ from local_rag.summaries import summary_path, load_summary
114
+
115
+
116
+ @app.get("/api/test-summary")
117
+ def test_summary():
118
+ file_name = request.args.get("file", "").strip()
119
+
120
+ if not file_name:
121
+ return jsonify({
122
+ "ok": False,
123
+ "error": "Missing ?file=..."
124
+ }), 400
125
+
126
+ path = summary_path(file_name)
127
+ text = load_summary(file_name)
128
+
129
+ return jsonify({
130
+ "ok": path is not None and text is not None,
131
+ "file_name": file_name,
132
+ "resolved_path": str(path) if path else None,
133
+ "text_length": len(text) if text else 0,
134
+ "preview": text[:500] if text else None,
135
+ })
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
  if not Path(PAPER_CSV).is_file():
156
  raise SystemExit(f"Paper dataset not found: {PAPER_CSV}. Set PAPER_CSV in .env.")
157