MCPcopy Create free account
hub / github.com/Louisym/MiniCC / append_metadata

Method append_metadata

tutorials/12_session_persistence.py:325–336  ·  view source on GitHub ↗

追加元数据条目(标题、标签等)。 对应 Reference: EP09 §1 条目类型 custom-title, ai-title, last-prompt, tag 等

(self, session_id: str, meta_type: str, data: dict)

Source from the content-addressed store, hash-verified

323 f.write(line)
324
325 def append_metadata(self, session_id: str, meta_type: str, data: dict):
326 """
327 追加元数据条目(标题、标签等)。
328
329 对应 Reference: EP09 §1 条目类型
330 custom-title, ai-title, last-prompt, tag 等
331 """
332 entry = {"type": meta_type, **data}
333 path = self._session_path(session_id)
334 line = json.dumps(entry, ensure_ascii=False) + "\n"
335 with open(path, "a") as f:
336 f.write(line)
337
338 def load_session(self, session_id: str) -> Session:
339 """

Callers 1

mainFunction · 0.95

Calls 1

_session_pathMethod · 0.95

Tested by

no test coverage detected