diff --git a/wwwroot/api/todo_detail.dspy b/wwwroot/api/todo_detail.dspy index 948ebc7..ec218d9 100644 --- a/wwwroot/api/todo_detail.dspy +++ b/wwwroot/api/todo_detail.dspy @@ -546,11 +546,15 @@ async with DBPools().sqlorContext(dbname) as sor: md.append('') _bf = _s(getattr(b0, 'file_path', '')) if _bf: - _file_rows.append(_file_link_row(os.path.basename(_bf), project_id, _bf)) - # 2026-09-16:md 有 docx 同名产物时一并给出(标书最终交付 docx) - _bf_docx = os.path.splitext(_bf)[0] + '.docx' - if _bf_docx != _bf: - _file_rows.append(_file_link_row(os.path.basename(_bf_docx), project_id, _bf_docx)) + # 2026-09-16:标书 md(可在线查看)与 docx(最终交付)同名产物 + # 都给出——file_path 可能指向其中任一,按 basename 派生两个候选, + # 实际存在的才出行(md 走在线查看、docx 走下载)。 + _base, _ext = os.path.splitext(_bf) + for _cand in (_base + '.md', _base + '.docx'): + if _cand and os.path.isfile(_cand): + _file_rows.append(_file_link_row(os.path.basename(_cand), project_id, _cand)) + if not any(os.path.isfile(c) for c in (_base + '.md', _base + '.docx')): + _file_rows.append(_file_link_row(os.path.basename(_bf), project_id, _bf)) else: md.append('## 待确认标书') md.append('')