This commit is contained in:
zyp
2026-11-25 20:46:42 +08:00
parent 066a5023b7
commit 1ae94dfb1f
17 changed files with 633 additions and 55 deletions
+4 -3
View File
@@ -132,10 +132,11 @@ def compose_verified_answer(payload: AnswerRequest, *, invoke_model=None) -> dic
# Prefixing it again repeats a caveat already explained in context.
rendered['verification'] = 'source_bound'
return rendered
incomplete = bool(payload.investigation_note)
catalog_read = payload.question_spec.get("catalog_read", False)
incomplete = bool(payload.investigation_note) or any(item.status != "ok" for item in payload.evidence)
# A failed synthesis must not trigger another model call just to display
# records. Keep a short, clearly labelled partial result under outages.
selected = {} if incomplete else select_evidence(payload, invoke_model=invoke_model)
selected = {} if incomplete or catalog_read else select_evidence(payload, invoke_model=invoke_model)
definitions = {item["id"]: item for item in payload.available_resources if "id" in item}
blocks, citations, facts = [], [], []
if incomplete:
@@ -151,7 +152,7 @@ def compose_verified_answer(payload: AnswerRequest, *, invoke_model=None) -> dic
indexed = list(enumerate(payload.evidence))
indexed.sort(key=lambda pair: 0 if pair[1].purpose == "primary" else 1)
for index, item in indexed:
if incomplete and len(item.rows) > 3:
if incomplete and not catalog_read and len(item.rows) > 3:
item = item.model_copy(update={"rows": item.rows[:3]})
if item.query == "current-user":
from app.modules.work_assistant.service import compose_answer