mirror of
https://github.com/zvx-echo6/recon.git
synced 2026-05-20 06:34:40 +02:00
Fix: review UI domain breakdown from Qdrant
The review items API endpoint still read concept domain counts from on-disk JSON files, which would show empty breakdowns for items with missing concept directories. Replace disk reads with the same _count_domains_from_qdrant function used by domain assignment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3b37d96c4d
commit
043119fbaa
1 changed files with 7 additions and 24 deletions
27
lib/api.py
27
lib/api.py
|
|
@ -395,35 +395,18 @@ def api_peertube_review_stats():
|
|||
|
||||
@app.route('/api/peertube/review/items')
|
||||
def api_peertube_review_items():
|
||||
import json as _json
|
||||
from .recon_domains import VALID_DOMAINS
|
||||
from .domain_assigner import _count_domains_from_qdrant, _get_qdrant_client
|
||||
db = StatusDB()
|
||||
config = get_config()
|
||||
items = db.get_items_by_domain_status('tied_manual', limit=200)
|
||||
|
||||
qdrant = _get_qdrant_client(config)
|
||||
collection = config['vector_db']['collection']
|
||||
|
||||
result = []
|
||||
concepts_dir = config['paths']['concepts']
|
||||
for item in items:
|
||||
file_hash = item['hash']
|
||||
# Count domains from concept files
|
||||
top_domains = []
|
||||
doc_concepts_dir = os.path.join(concepts_dir, file_hash)
|
||||
if os.path.isdir(doc_concepts_dir):
|
||||
from collections import Counter
|
||||
domain_counter = Counter()
|
||||
for fname in os.listdir(doc_concepts_dir):
|
||||
if not fname.startswith('window_') or not fname.endswith('.json'):
|
||||
continue
|
||||
try:
|
||||
with open(os.path.join(doc_concepts_dir, fname)) as f:
|
||||
concepts = _json.load(f)
|
||||
for c in concepts:
|
||||
if isinstance(c, dict):
|
||||
dom = c.get('domain')
|
||||
if isinstance(dom, str) and dom in VALID_DOMAINS:
|
||||
domain_counter[dom] += 1
|
||||
except Exception:
|
||||
continue
|
||||
domain_counter = _count_domains_from_qdrant(qdrant, collection, file_hash)
|
||||
top_domains = [{'domain': d, 'count': cnt}
|
||||
for d, cnt in domain_counter.most_common(5)]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue