Repository navigation
feat(search): 探索页多模式对比与 SAG2 专用事件循环 - #256
Closed
luoshuai990529 wants to merge 3 commits into
Closed
luoshuai990529 wants to merge 3 commits into
luoshuai990529 wants to merge 3 commits into
Conversation
- zleap-sag2 构建内存语料时在事件循环线程同步分词、建倒排表,范围大时会 阻塞 API 循环;`Sag2EngineHolder` 新增 `_EngineLoop`,引擎的创建、范围 扫描、检索与关闭全部在专用线程的事件循环执行 - API 循环只保留并发闸门、整次超时与取消:超时会同步取消专用循环中的协程, `aclose` 等待在途检索后关闭引擎并停掉线程 - 测试:阻塞式引擎不影响 API 循环心跳;超时取消到达引擎协程;跨线程并发 上限在线调整;真实 zleap-sag2 直读集成测试在新执行模型下通过 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- 搜索栏「对比」开关:开启后以 2–3 个模式芯片替代单模式控件,同一问题 并发对比;可选 LLM 评审,范围沿用 @ 选择 - 分栏结果:各列显示耗时、召回数、SAG2 的 JEV 用量与降级状态,跨列共同 命中的片段加标记,失败列内联显示原因;下方列出两两评审结论 - 任一列可「按此模式检索」,固定该模式并回到普通搜索;关闭对比保留上次 普通结果 - 对比列、片段行与评审列表抽为共享组件,信源页检索测试对话框改为复用; 补充中英文案与 vitest 用例 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Collaborator
Author
|
已整合进 #254,此 PR 关闭。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动范围
后端(apps/api)
sag_api/sag/sag2_engine.py:新增_EngineLoop,zleap-sag2 只读引擎的创建、范围扫描、检索与关闭全部在专用线程的事件循环执行;API 循环只保留并发闸门、整次超时与取消。超时会同步取消专用循环中的协程;aclose等待在途检索后关闭引擎并停掉线程。对比端点eval-compare本已并发执行、单策略失败隔离并透传stats,未改动。tests/test_sag2_retrieval.py新增「阻塞式引擎不影响 API 循环心跳」「超时取消到达引擎协程」,跨线程并发上限在线调整改用线程安全信号;tests/test_sag2_engine_integration.py在新执行模型下通过。前端(apps/web)
search-panel.tsx):开启后单模式控件替换为多选模式芯片(仅列出当前部署可用的模式,JEV 模式带付费标识,强制 2–3 个),下方为「LLM 评审」开关(仅在已配置 LLM 时显示)与范围芯片;回车或搜索按钮调用现有POST /search/eval-compare,范围与普通搜索一致。search/search-compare-results.tsx:2–3 列响应式并排,列头含模式图标、标签、付费标识与指标条(耗时、召回数、SAG2 的 JEV 用量),发生降级或实际模式不同时显示检索状态条;跨列共同命中的片段标「共同命中」;失败列内联显示原因并禁用采用;加载骨架、整次失败可重试;下方为两两评审结论或未评审原因。search/use-search-compare.ts(本地状态、默认芯片选择、取消);对比列、片段行、指标条与评审列表抽到retrieval-compare-parts.tsx,信源页「检索测试」对话框改为复用,行为不变。Search文案(中英);新增 vitest:对比钩子、对比结果、搜索面板对比交互、检索测试对话框回归。文档
影响功能范围
SAG_SAG2_*配置不变。测试覆盖情况
pytest -q(apps/api,串行),1773 passed / 6 skipped;全量中test_source_default_strategy.py一次 teardown 出现database is locked,根因是该用例收尾删除信源与应用关闭争抢 SQLite 锁,已在 feat(retrieval): 信源默认检索模式、问答按轮选择与探索页多模式对比 #254 追加修复提交并重跑三次通过。ruff check sag_api tests scripts(apps/api)。npm run typecheck、npx vitest run(109 files / 912 tests)、npm run lint、npm run i18n:check(apps/web)。🤖 Generated with Claude Code