feat: separate contents, abstract and body evidence
This commit is contained in:
@@ -224,7 +224,9 @@ def test_score_citations_link_the_canonical_text_and_image_page(session_factory,
|
||||
assert generated["citations"][0]["url"] == expected
|
||||
assert generated["citations"][0]["image_url"] == expected + "/image"
|
||||
assert generated["citations"][0]["score_url"].startswith("/?page=scores")
|
||||
assert chat_api._answer_citations(generated["citations"])[0]["url"] == expected
|
||||
# An answer keeps only the citations it actually used: naming the page retains it.
|
||||
assert chat_api._answer_citations(generated["citations"], "评分证据见第 2 页。")[0]["url"] == expected
|
||||
assert chat_api._answer_citations(generated["citations"], "没有引用任何页面。") == []
|
||||
conversation_id = conversation.id
|
||||
client = client_for(session_factory)
|
||||
try:
|
||||
@@ -268,8 +270,11 @@ def test_late_citations_and_search_snippets_survive_restoration(session_factory,
|
||||
assert response.status_code == 200
|
||||
detail = client.get(f"/api/conversations/{created['id']}").json()
|
||||
answer = detail['messages'][-1]
|
||||
assert len(answer['citations']) == 30
|
||||
assert [item['page'] for item in answer['citations'][-6:]] == [48] * 6
|
||||
# The answer names page 48 only, so only that page's passages are attached; the
|
||||
# other tool hits were retrieved but not used in the answer.
|
||||
assert len(answer['citations']) == 6
|
||||
assert [item['page'] for item in answer['citations']] == [48] * 6
|
||||
# Every tool hit stays available in the tool record for auditing.
|
||||
assert answer['tool_calls'][-1]['result']['citations'][0]['quote'] == '第48页原文片段0'
|
||||
assert detail['runs'][0]['tool_calls'][-1]['result']['citations'][0]['page'] == 48
|
||||
finally:
|
||||
@@ -383,7 +388,7 @@ def test_upgrade_from_legacy_0003_migrates_pages_and_citations(session_factory,
|
||||
config.set_main_option('script_location', str(root / 'migrations'))
|
||||
command.upgrade(config, 'head')
|
||||
with session_factory() as db:
|
||||
assert db.scalar(text('SELECT version_num FROM alembic_version')) == '0005'
|
||||
assert db.scalar(text('SELECT version_num FROM alembic_version')) == '0006'
|
||||
assert db.get(Conversation, conversation_id).title == '旧记录'
|
||||
assert db.scalar(select(ChatMessage.content).where(ChatMessage.conversation_id == conversation_id)) == '旧问题'
|
||||
run = db.scalar(select(AgentRun).where(AgentRun.conversation_id == conversation_id))
|
||||
|
||||
Reference in New Issue
Block a user