feat: 引入deepseek结构化输出

This commit is contained in:
yangshilin
2026-03-19 11:27:43 +08:00
parent f3629efec3
commit 4c75c6f4f4
10 changed files with 74 additions and 26 deletions

View File

@@ -58,7 +58,8 @@ class ProcessMemoirSegmentsImageEnqueueTest(unittest.TestCase):
get_state_mock.return_value = SimpleNamespace(current_stage="childhood", slots={})
update_slot_mock.return_value = SimpleNamespace(current_stage="childhood", slots={})
llm = Mock()
llm.invoke.side_effect = [
bound_llm = Mock()
bound_llm.invoke.side_effect = [
SimpleNamespace(
content="""```json
{
@@ -69,8 +70,12 @@ class ProcessMemoirSegmentsImageEnqueueTest(unittest.TestCase):
}
```"""
),
SimpleNamespace(content='{"paragraphs":[{"content":"新的章节正文","image_description":"南方小镇的青石板路"}]}'),
]
llm.bind.return_value = bound_llm
llm.invoke.side_effect = [
SimpleNamespace(content="childhood"),
SimpleNamespace(content="童年的门前"),
SimpleNamespace(content="新的章节正文\n\n{{IMAGE:南方小镇的青石板路}}"),
]
get_llm_mock.return_value = llm