- Add logviewer/: Dozzle web UI (port 9999) + analyze.py CLI tool - docker-compose.yml: add json-file logging with rotation and labels for index/search - Fix Dockerfiles: COPY *.py . so all modules are included in image - Convert all relative imports to flat absolute imports for Docker flat layout - Rename index/schemas.py → index/index_schemas.py to avoid module name collision with search/schemas.py in test runner - Update all tests to add service dir to sys.path and use flat imports Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
605 B
Python
23 lines
605 B
Python
from typing import Any
|
|
|
|
from config import TOP_K
|
|
from retrieval import extract_message_ids
|
|
|
|
|
|
def aggregate_message_ids(
|
|
reranked_head: list[Any],
|
|
retrieval_tail: list[Any],
|
|
) -> list[str]:
|
|
"""Deduplicate and collect top-K message_ids, reranked head first."""
|
|
seen: set[str] = set()
|
|
result: list[str] = []
|
|
|
|
for point in reranked_head + retrieval_tail:
|
|
for mid in extract_message_ids(point):
|
|
if mid not in seen:
|
|
seen.add(mid)
|
|
result.append(mid)
|
|
if len(result) >= TOP_K:
|
|
return result
|
|
|
|
return result
|