fix(rag): route exercise titles to knowledge base
This commit is contained in:
@@ -341,11 +341,14 @@ def test_same_level_practice_headings_are_read_as_one_semantic_unit():
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
for knowledge_id in range(2, 6):
|
||||
_add_published_knowledge(db, knowledge_id=knowledge_id, name=f"其他课程{knowledge_id}")
|
||||
|
||||
content = KnowledgeAgentService._read_complete_section(db, detail)
|
||||
result = asyncio.run(
|
||||
KnowledgeAgentService.build_result(db, question="金色光欧姆静心具体怎么练习?")
|
||||
KnowledgeAgentService.build_result(db, question="金色光欧姆是什么?")
|
||||
)
|
||||
title_route = next(item for item in result.tool_trace if item["tool"] == "route_knowledge_by_titles")
|
||||
|
||||
assert "金色光欧姆静心" in content
|
||||
assert "保持自然呼吸" in content
|
||||
@@ -353,6 +356,7 @@ def test_same_level_practice_headings_are_read_as_one_semantic_unit():
|
||||
assert "下一项练习内容" not in content
|
||||
assert result.chunks
|
||||
assert "保持自然呼吸" in result.chunks[0].content
|
||||
assert title_route["matches"][0]["knowledgeId"] == knowledge.id
|
||||
|
||||
|
||||
def test_parser_merges_practice_title_and_same_level_detail_headings():
|
||||
|
||||
Reference in New Issue
Block a user