llm-api/plan_router.py aktualisiert
All checks were successful
Deploy Trainer_LLM to llm-node / deploy (push) Successful in 1s

This commit is contained in:
Lars 2025-08-13 07:51:53 +02:00
parent d9eefcb1fa
commit 9fd41ce3f0

View File

@ -325,11 +325,17 @@ def create_plan(p: Plan):
if isinstance(payload.get("created_at"), datetime): if isinstance(payload.get("created_at"), datetime):
payload["created_at"] = payload["created_at"].astimezone(timezone.utc).isoformat() payload["created_at"] = payload["created_at"].astimezone(timezone.utc).isoformat()
# Materialisierte Section-Namen für robuste Filter/Indizes # Materialisierte Section-Namen für robuste Filter/Indizes
"""
try: try:
payload["plan_section_names"] = _norm_list([s.get("name", "") for s in (payload.get("sections") or [])]) payload["plan_section_names"] = _norm_list([s.get("name", "") for s in (payload.get("sections") or [])])
except Exception: except Exception:
payload["plan_section_names"] = _norm_list([s.name for s in (p.sections or [])]) payload["plan_section_names"] = _norm_list([s.name for s in (p.sections or [])])
"""
try:
payload["plan_section_names"] = sorted({ (s.get("name") or "").strip() for s in (payload.get("sections") or []) if s.get("name") })
except Exception:
payload["plan_section_names"] = sorted({ (s.name or "").strip() for s in (p.sections or []) if getattr(s, "name", None) })
vec = _embed(_plan_embed_text(p)) vec = _embed(_plan_embed_text(p))
qdrant.upsert(collection_name=PLAN_COLLECTION, points=[PointStruct(id=str(p.id), vector=vec, payload=payload)]) qdrant.upsert(collection_name=PLAN_COLLECTION, points=[PointStruct(id=str(p.id), vector=vec, payload=payload)])
return p return p
@ -391,7 +397,7 @@ def list_plans(
must.append(FieldCondition(key="goals", match=MatchValue(value=goal))) must.append(FieldCondition(key="goals", match=MatchValue(value=goal)))
if section: if section:
must.append(FieldCondition(key="plan_section_names", match=MatchValue(value=section))) must.append(FieldCondition(key="plan_section_names", match=MatchValue(value=section)))
flt = Filter(must=must or None) if must else None flt = Filter(must=must or None) if must else None
fetch_n = max(offset + limit, 1) fetch_n = max(offset + limit, 1)