From 147ac5392cf01cc1e992e72ea7c69176ce1e5b22 Mon Sep 17 00:00:00 2001 From: SkyLi Date: Sun, 27 Sep 2026 12:59:14 +0800 Subject: [PATCH] refactor: remove legacy session recovery UI --- HANDOFF.md | 4 ++-- frontend/src/Chat.tsx | 13 +++++-------- frontend/src/style.css | 2 -- frontend/tests/chat.spec.ts | 10 +++------- 4 files changed, 10 insertions(+), 19 deletions(-) diff --git a/HANDOFF.md b/HANDOFF.md index 2466fe2..19587b2 100644 --- a/HANDOFF.md +++ b/HANDOFF.md @@ -93,6 +93,6 @@ uv run pytest -q 正式回答上方的工具过程现在先整体折叠,每次调用再单独折叠;引用移至回答最后并整体折叠。会话页面移除了全局“后台进度”卡片。`get_scores` 改为按项目和评分项分页,每次最多一个项目、六项评分,并提供后续偏移量;长结果不再以空泛的截断提示替代全部评分。新检索调用会在运行记录中保存最多六条有界原文片段;回答引用对全部工具结果去重,不再只保存前 20 条。 -业务数据库 6 号会话的旧回答原先只有前 20 条引用。已在备份 `data/backups/wisegrade-pre-chat-citation-20260927.dump`(权限 `600`,不提交)后,用当前项目知识库中逐字匹配的片段补入 14 条来源引用,包括综合报告第 48 页;旧记录的三个 `get_scores` 截断调用附上明确标注的**当前数据库重查结果**,不宣称模型当时读过这些值。旧 `search_project_material` 调用仅持久化了引用数量,查询文本和每次调用的六条原文当时未保存,无法精确还原调用归属;工具详情会展示本轮已核验的相关原文,并明确标明不能归属到这一次调用,也可跳转到回答末尾的引用。新调用保存实际每次找到的片段。 +本地业务数据库 6 号会话曾为定位问题补入来源引用和当前评分重查值;用户计划自行删除该会话,界面不保留针对这条旧记录的提示或特殊展示。操作前备份保存在 `data/backups/wisegrade-pre-chat-citation-20260927.dump`(权限 `600`,不提交)。新调用会保存实际每次找到的片段。 -隔离 PostgreSQL 测试库执行 `pytest -q -m 'not integration'`:35 通过、2 个集成测试未运行。前端 `npm run build` 通过,Chromium `npm run test:e2e`:3 通过。API 与 Web 镜像已重新构建并以 `docker compose up -d --wait api web` 更新,Web 真实会话 6 的引用第 48 页、默认折叠、旧工具详情中的 14 条已核验来源片段及无后台进度卡片已用浏览器核对;新评分工具对该会话范围返回六项,序列化后 6,820 字符。用真实项目检索“视觉检测 Otsu 光照鲁棒性 第48页”返回六条带原文与链接的结果,其中包含第 48 页。前端产物仍有 Vite 大块警告。 +隔离 PostgreSQL 测试库执行 `pytest -q -m 'not integration'`:35 通过、2 个集成测试未运行。前端 `npm run build` 通过,Chromium `npm run test:e2e`:3 通过。API 与 Web 镜像已重新构建并以 `docker compose up -d --wait api web` 更新;新评分工具对限定范围返回六项,序列化后 6,820 字符。用真实项目检索“视觉检测 Otsu 光照鲁棒性 第48页”返回六条带原文与链接的结果,其中包含第 48 页。前端产物仍有 Vite 大块警告。 diff --git a/frontend/src/Chat.tsx b/frontend/src/Chat.tsx index bdab88d..0cec72c 100644 --- a/frontend/src/Chat.tsx +++ b/frontend/src/Chat.tsx @@ -100,15 +100,15 @@ function CitationCards({ items }: { items: any[] }) { {safeUrl(item.image_url) && 查看图像}; })}; } -function Citations({ items, messageId }: { items: any[]; messageId: number }) { +function Citations({ items }: { items: any[] }) { const seen = new Set(); const unique = (items || []).filter(item => { if (!item || typeof item !== 'object') return false; const key = JSON.stringify([item.title || item.document, item.page, item.quote, item.url, item.image_url]); if (seen.has(key)) return false; seen.add(key); return true; }); if (!unique.length) return null; - return
引用 · {unique.length}
; + return
引用 · {unique.length}
; } -function Tools({ calls, messageId, legacyEvidence = [] }: { calls: any[]; messageId?: number; legacyEvidence?: any[] }) { +function Tools({ calls }: { calls: any[] }) { if (!calls?.length) return null; const active = calls.filter(call => call.status === 'running').length; const failed = calls.filter(call => call.status === 'failed').length; @@ -118,10 +118,7 @@ function Tools({ calls, messageId, legacyEvidence = [] }: { calls: any[]; messag {call.status === 'running' ? '进行中' : call.status === 'failed' ? '失败' : '成功'} {call.status === 'running' ? '正在执行' : call.error ? String(call.error).slice(0, 80) : call.summary || (typeof call.result === 'string' ? call.result : '已完成')}
调用参数
{JSON.stringify(call.arguments || {}, null, 2)}
- {call.error ? '错误' : '调用结果'}
{call.error || (typeof call.result === 'string' ? call.result : JSON.stringify(call.result ?? '运行中', null, 2))}
- {call.result?.citations?.count !== undefined &&
旧运行只保存了引用数量,无法还原各次检索对应的原文。{messageId && } - {legacyEvidence.length > 0 &&
本轮回答已核验的相关原文(无法确认属于当前这一次检索)
}
} - {call.result?.truncated && 旧运行的原始结果未保存。{call.result?.rechecked_current ? '附带的是当前数据库重查结果,不代表当时模型看到的内容。' : '再次提问可使用分页评分查询。'}}
+ {call.error ? '错误' : '调用结果'}
{call.error || (typeof call.result === 'string' ? call.result : JSON.stringify(call.result ?? '运行中', null, 2))}
)}; } export default function Chat() { @@ -229,7 +226,7 @@ export default function Chat() {