fix: rss classifier think-tag stripping, briefing calendar dict access, embed empty-string guard

- rss_classifier: strip <think>...</think> blocks (qwen3 reasoning output)
  before JSON parse; use strict=False for control chars; bump timeout 30s→120s
- briefing_pipeline: list_events returns dicts not Event objects — fix
  attribute access (.all_day/.start_dt/.title) to dict access
- embeddings: guard upsert_note_embedding and semantic_search_notes against
  empty-string input to prevent Ollama embed 400 errors

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 13:14:55 -04:00
parent b5106441dd
commit db092b113e
3 changed files with 19 additions and 6 deletions
@@ -63,6 +63,8 @@ def _cosine_similarity(a: list[float], b: list[float]) -> float:
async def upsert_note_embedding(note_id: int, user_id: int, text: str) -> None:
"""Generate and persist an embedding for a note. Safe to fire-and-forget."""
if not text or not text.strip():
return
try:
embedding = await get_embedding(text)
except Exception:
@@ -97,6 +99,8 @@ async def semantic_search_notes(
*threshold* are returned, sorted highest-first.
Returns an empty list if the embedding model is unavailable or on any error.
"""
if not query or not query.strip():
return []
try:
query_vec = await get_embedding(query)
except Exception: