personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

refactor(conversation): remove regex _extract_entities helper

- drop the record_exchange entity-extraction call
- remove the private _extract_entities helper entirely
- trim the stale record_exchange docstring note

-51
-51
think/conversation.py
··· 65 65 1. conversation/exchanges.jsonl — append-only quick-read index 66 66 2. YYYYMMDD/conversation/HHMMSS_1/talents/conversation.md — journal entry 67 67 for FTS5 search indexing (matches */*/*/talents/*.md formatter pattern) 68 - 69 - Also runs lightweight entity extraction on the conversation text. 70 68 """ 71 69 if not user_message or not agent_response: 72 70 return ··· 128 126 f.write(md_content) 129 127 except Exception: 130 128 logger.exception("Failed to write conversation journal entry") 131 - 132 - # 3. Entity extraction 133 - _extract_entities(user_message + " " + agent_response, facet=facet, day=day) 134 - 135 - 136 - def _extract_entities(text: str, *, facet: str, day: str) -> None: 137 - """Detect known entity names mentioned in conversation text. 138 - 139 - Matches against attached entities for the active facet. Any matches 140 - are recorded as detected entities for the day, integrating with the 141 - existing entity signal infrastructure. 142 - """ 143 - if not facet: 144 - return 145 - 146 - try: 147 - from think.entities.loading import load_entities 148 - 149 - entities = load_entities(facet) 150 - if not entities: 151 - return 152 - 153 - text_lower = text.lower() 154 - 155 - for entity in entities: 156 - name = entity.get("name", "") 157 - if not name or len(name) < 3: 158 - continue 159 - 160 - # Word boundary match for entity name 161 - if re.search(r"\b" + re.escape(name.lower()) + r"\b", text_lower): 162 - try: 163 - from think.entities.saving import save_detected_entity 164 - 165 - save_detected_entity( 166 - facet=facet, 167 - day=day, 168 - entity_type=entity.get("type", "Person"), 169 - name=name, 170 - description="Mentioned in conversation", 171 - ) 172 - except ValueError: 173 - pass # Already detected today — expected 174 - except Exception: 175 - logger.debug( 176 - "Failed to record entity detection: %s", name, exc_info=True 177 - ) 178 - except Exception: 179 - logger.debug("Entity extraction from conversation failed", exc_info=True) 180 129 181 130 182 131 # ---------------------------------------------------------------------------