Build a compact user-facing topic list to ground LLM profile edits.
(profile: Optional[Dict[str, Any]])
| 565 | |
| 566 | |
| 567 | def get_profile_topic_context(profile: Optional[Dict[str, Any]]) -> List[str]: |
| 568 | """Build a compact user-facing topic list to ground LLM profile edits.""" |
| 569 | if not profile: |
| 570 | return [] |
| 571 | |
| 572 | topics: List[str] = [] |
| 573 | for container_name in ("core_directions", "topic_weights"): |
| 574 | container = profile.get(container_name, {}) or {} |
| 575 | for key in container.keys(): |
| 576 | for alias in iter_topic_aliases(key): |
| 577 | if alias not in topics: |
| 578 | topics.append(alias) |
| 579 | return topics |
| 580 | |
| 581 | |
| 582 | def find_profile_topic_key(profile: Dict[str, Any], topic_text: str) -> Optional[str]: |
no test coverage detected