初始化提交
This commit is contained in:
commit
887c1f449e
963 files changed
+166869
No files matched your search
@@ -0,0 +1,22 @@
|
||||
"""解析模型返回为小周天记忆候选 + 反思(纯函数,无 IO)。
|
||||
|
||||
模型输出对象 ``{"memories": [...], "reflection": str}``。记忆候选解析复用 extraction
|
||||
的 ``parse_memory_drafts``;``reflection`` 为本轮复盘文本。
|
||||
"""
|
||||
|
||||
from app.modules.extraction.extract import (
|
||||
MemoryCandidateDraft,
|
||||
extract_json_object,
|
||||
parse_memory_drafts,
|
||||
)
|
||||
|
||||
|
||||
def parse_reflection(
|
||||
raw: str,
|
||||
) -> tuple[list[MemoryCandidateDraft], str]:
|
||||
data = extract_json_object(raw)
|
||||
if not isinstance(data, dict):
|
||||
return [], ""
|
||||
memories = parse_memory_drafts(data.get("memories"))
|
||||
reflection = str(data.get("reflection", "")).strip()
|
||||
return memories, reflection
|
||||
Reference in new issue
Block a user