Repository navigation
feat(chat): 问答页按轮选择检索模式 - #255
Closed
luoshuai990529 wants to merge 7 commits into
Closed
luoshuai990529 wants to merge 7 commits into
luoshuai990529 wants to merge 7 commits into
Conversation
- `Source` 新增 `default_search_strategy`(可空,跟随全局),创建 / 更新接口 接受并返回该字段;取值须是当前部署可用的模式,JEV 付费模式还需已保存 API Key,拒绝时沿用能力原因码 - 新增 `resolve_search_strategy`:显式请求 → Agent 人格 → 范围内信源的共同 默认 → 全局默认;范围内信源默认不一致时不猜测,按全局处理。检索服务、 搜索接口、Agent 工具与预算统一走该解析,结果 `stats.strategy_origin` 标明来源,MCP 自动继承 - `EngineManager.require_strategy_available` 供设置、人格、信源三处共用 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- 新增默认检索模式选择器:首项「跟随全局默认」,各模式附通俗说明、 适用场景与付费标识;因存储能力不可用的模式灰置并给出原因 - 选择 JEV 模式但缺少服务或 Key 时,就地展开 JEV 配置(预设服务商、 Key、测试连接),保存后再创建或更新信源;提交按钮在缺 Key 时禁用并说明 - 信源卡片与详情头部显示默认模式标签;搜索页在所选范围信源默认一致且 用户未手动选择时自动采用并标注「信源默认」 - JEV 预设与校验抽到 `lib/jev-config.ts`,设置页共用;补充中英文案与 vitest 用例 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- 删除会排入后台任务并持续写库,与应用关闭时的清理争抢 SQLite 锁, 导致全量运行偶发 `database is locked`;与其他接口测试一致,保留信源 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- `AskRequest` 新增可选 `strategy`,经 `AskPlan` 与工具上下文的 `requested_strategy` 传入 `search_context`,优先于 Agent 人格与信源默认 - `/ask` 在开始流式生成前校验该模式在当前部署可用,付费 JEV 模式缺 Key 时直接返回 400,不落库用户消息 - 工具结果的 `retrieval_stats.strategy_origin` 标明本轮模式来源 (request / persona / source_default / global),供活动时间线展示 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
- 输入框工具栏在「联网」旁加入与探索页一致的模式控件,默认显示将实际 使用的模式并标注来源(人格默认 / 信源默认),生成中禁用 - 用户选择后仅对本面板后续轮次生效,请求体携带 `strategy`;未选择时不传, 由后端按人格 → 信源默认 → 全局解析 - 模式在当前部署不可用被拒绝时,在输入框上方内联提示并提供设置入口 - 回答活动时间线显示本轮模式来源;补充中英文案与 vitest 用例 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
luoshuai990529
force-pushed
the
feat/sag2-chat-strategy
branch
from
October 24, 2026 15:46
a9cabc8 to
17ae9f4
Compare
luoshuai990529
force-pushed
the
feat/sag2-source-default-mode
branch
from
October 24, 2026 16:06
94b7a94 to
4322e05
Compare
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)
AskRequest新增可选strategy(五种检索模式之一),经AskPlan.strategy与工具上下文requested_strategy传入search_context工具;解析顺序为本轮显式选择 → Agent 人格 → 范围内信源共同默认 → 全局默认,工具预算随之计算。/ask在开始流式生成前用EngineManager.require_strategy_available校验本轮模式;不可用(含付费 JEV 模式缺 API Key、存储不支持)时返回 400 与能力原因码,不落库用户消息。retrieval_stats.strategy_origin标明本轮模式来源,随消息steps持久化。tests/test_chat_turn_strategy.py(请求模型、优先级与来源、工具级覆盖与预算、ask 入口拒绝与未落库、未知值 422、存储不支持)。前端(apps/web)
disabled属性),默认值按 本轮选择 → Agent 人格search_strategy→ 所选范围信源共同默认 → 全局默认 解析并标注「人格默认」/「信源默认」;人格或信源默认在当前部署不可用时客户端跳过,后端仍为最终裁决。strategy;conversation-runtime、sse、app-shell传输层透传,诊断日志记录。strategy_origin为人格或信源默认时显示「按{来源}使用 {模式}」。Persona类型补search_strategy;新增 / 扩展 vitest:输入框控件的默认与提示、固定后携带strategy、生成中禁用、拒绝提示与清除、运行时与 SSE 透传、状态条来源行。文档
影响功能范围
测试覆盖情况
pytest -q(apps/api,串行),1772 passed / 6 skipped。ruff check sag_api tests scripts(apps/api)。npm run typecheck、npx vitest run(105 files / 887 tests)、npm run lint、npm run i18n:check(apps/web)。🤖 Generated with Claude Code