MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / record_turn

Method record_turn

openkb/agent/chat_session.py:162–175  ·  view source on GitHub ↗
(
        self,
        user_message: str,
        assistant_text: str,
        new_history: list[dict[str, Any]],
    )

Source from the content-addressed store, hash-verified

160 os.replace(tmp, self.path)
161
162 def record_turn(
163 self,
164 user_message: str,
165 assistant_text: str,
166 new_history: list[dict[str, Any]],
167 ) -> None:
168 self.history = sanitize_history(new_history)
169 self.user_turns.append(user_message)
170 self.assistant_texts.append(assistant_text)
171 self.turn_count = len(self.user_turns)
172 if not self.title:
173 self.title = _title_from(user_message)
174 self.updated_at = _utcnow_iso()
175 self.save()
176
177
178def load_session(kb_dir: Path, session_id: str) -> ChatSession:

Calls 4

saveMethod · 0.95
sanitize_historyFunction · 0.85
_title_fromFunction · 0.85
_utcnow_isoFunction · 0.85