ocerebro 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/dashboard/api.py +6 -14
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/dashboard/api.py
CHANGED
|
@@ -214,18 +214,14 @@ def create_router(
|
|
|
214
214
|
):
|
|
215
215
|
"""Retorna lista de memórias com metadados"""
|
|
216
216
|
try:
|
|
217
|
-
conn = router.metadata_db._connect()
|
|
218
|
-
|
|
219
217
|
if q:
|
|
220
|
-
# Busca full-text
|
|
221
|
-
rows =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
WHERE content MATCH ?
|
|
225
|
-
LIMIT ?
|
|
226
|
-
""", (q, limit)).fetchall()
|
|
218
|
+
# Busca full-text usando método existente
|
|
219
|
+
rows = router.metadata_db.search_fts(q, project)
|
|
220
|
+
# Limita resultados
|
|
221
|
+
rows = rows[:limit]
|
|
227
222
|
else:
|
|
228
223
|
# Busca com filtros
|
|
224
|
+
conn = router.metadata_db._connect()
|
|
229
225
|
query = "SELECT id, title, type, project, tags, created_at, updated_at FROM memories WHERE 1=1"
|
|
230
226
|
params = []
|
|
231
227
|
|
|
@@ -241,6 +237,7 @@ def create_router(
|
|
|
241
237
|
params.append(limit)
|
|
242
238
|
|
|
243
239
|
rows = conn.execute(query, params).fetchall()
|
|
240
|
+
conn.close()
|
|
244
241
|
|
|
245
242
|
memories = []
|
|
246
243
|
for row in rows:
|
|
@@ -260,7 +257,6 @@ def create_router(
|
|
|
260
257
|
"gc_risk": round(gc_risk, 2)
|
|
261
258
|
})
|
|
262
259
|
|
|
263
|
-
conn.close()
|
|
264
260
|
return memories
|
|
265
261
|
except Exception as e:
|
|
266
262
|
raise HTTPException(status_code=500, detail=str(e))
|
|
@@ -280,10 +276,6 @@ def create_router(
|
|
|
280
276
|
# Procura em official/
|
|
281
277
|
official_path = router.cerebro_path / "official"
|
|
282
278
|
if official_path.exists():
|
|
283
|
-
for root, dirs, files in [(official_path.parent, official_path.name, [])]:
|
|
284
|
-
for dirpath, dirnames, filenames in [(official_path, [], [])]:
|
|
285
|
-
pass
|
|
286
|
-
|
|
287
279
|
# Procura recursivamente
|
|
288
280
|
for md_file in official_path.rglob(f"{memory_id}.md"):
|
|
289
281
|
content = md_file.read_text(encoding="utf-8")
|