Repository navigation
feat(agent,desktop,mobile,tui,cli): unify thinking levels on thinkingLevels - #1382
Merged
Merged
Conversation
- thinkingLevels is now the list of wire values the model accepts; the implicit default level means no thinking parameter is sent, off means explicit disable. - remove compat.reasoningEffortValues, thinkingLevelMap, supportsReasoningEffort, thinkingRequired and the resolve_effort snapping logic; tokenizer heuristics no longer rewrite level values. - reasoning stays as legacy metadata with no runtime behavior. - new sessions start at default; stored levels not offered by a model clamp to default; Anthropic manual budgets extend to max/unknown values. - catalogue thinking levels come from the Future platform (next commit on the server side) and from the generated built-in catalog; the generator declares the standard wire set for reasoning models and drops tlm_json. - ProviderModel carries thinking_levels behind a replace_thinking_levels presence bit so older clients preserve a stored list instead of clearing it.
- the composer, tasks, Vibe and remote conversation pickers render exactly the levels the agent sends (default first, arbitrary wire values included) and disable only when the model offers a single choice. - custom-model editor replaces the Supports thinking checkbox with a per-model multi-select of off/minimal/low/medium/high/xhigh/max; reasoning is kept as a hidden round-trip value and the new proto presence bit preserves lists when an older client edits a provider. - older agents (no thinkingLevels field) keep the legacy six levels and never receive the literal default.
…logue The phone renders the host's declared list verbatim (raw label fallback for wire values), starts new conversations at default, falls back to the legacy six levels plus medium only when an older host omits the field, and lets the custom provider editor choose per-model levels that round-trip through the upsert.
- the workbench model picker's effort slider walks the highlighted model's own list (launchpad starts at default); --thinking and --model id:level accept default and max; the models table prints declared wire values. - provider editing round-trips thinking levels with the same presence-bit semantics as the desktop. - channels accept default/max for /effort and echo the level the agent actually applied.
Resolve the doubao open question (the platform now declares thinking_levels) and add the implementation/verification record for the new semantics.
The chips and the implicit Default are self-explanatory; the extra paragraph only added noise.
The reload test sends an explicit low level on the default test model. Levels are now validated against the model's declared list, so register a model that offers low instead of relying on the old unconstrained behavior.
Declared order was a set, not a display sequence: a hand-written thinkingLevels list such as `off,minimal,low,medium,xhigh,high,max` reached the composer verbatim, so the picker put xhigh before high. Normalize into the product scale (off → minimal → low → medium → high → xhigh → max) at load, with unknown wire values after the known ones in their declaration order, so every client renders the same order no matter how the configuration was written.
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.
背景
当前思考强度由五套并行概念决定:
thinkingLevels(UI)、compat.reasoningEffortValues(wire 词表)、thinkingLevelMap(逐档映射)、reasoning(能力开关)、thinkingRequired(关不掉思考)。客户端还要做“就近吸附”,服务端/内置目录也要各自维护词表,容易出现“界面显示的档位不是实际发送的档位”。本 PR 统一为单一配置:
thinkingLevels就是模型接受的 wire 值列表。契约
thinkingLevels的每一项都是 wire 值,原样发送给 provider。default隐式存在、永远排第一、不落盘;含义是不发送任何 thinking/effort 参数,由服务端默认值决定。off表示显式关闭(按协议发 disable 写法)。default。default(不再按深度就近吸附)。reasoning字段保留(旧客户端/旧配置兼容),但运行期不再参与任何决策。删除:
compat.reasoningEffortValues、thinkingLevelMap、supportsReasoningEffort、thinkingRequired、resolve_effort收敛逻辑、doubao/kimi/deepseek 的 tokenizer 档位启发式。主要改动
ProviderModel增加thinking_levels+replace_thinking_levelspresence 位(老客户端保存 provider 不会清空已有列表);list_models的thinkingLevels恒非空且含default。default、provider upsert 写入/保留语义。["minimal","low","medium","high"](历史实际发送值),删除tlm_json;生成器新增规则与离线回填模式。reasoning隐藏 round-trip。default。--thinking default|max、models输出声明档位、/effort接受 default/max 并回显实际生效值。依赖与发布顺序
/v1/models返回thinking_levels)。thinkingLevels的自定义模型将只剩「默认」,需要在 Providers 页重新勾选;旧thinkingLevelMap/reasoningEffortValues配置被忽略。验证
cargo test -p future-agent --lib2502 passed(13 个失败为沙箱禁止sandbox-exec的既有环境问题);集成测试(cli_smoke/service_startup/http_client/sqlite/session_load/compaction)全通过;clippy-D warningsclean。cargo check --workspace --exclude futureos --all-targetsFinished。openpty),terminal 模块未改动。["low","high"]→future models --json返回["default","low","high"];未声明 →["default"]。REGENERATE_PROTO=1生成物与 proto 一致。环境说明:本机沙箱无法写
~/.cargo/~/.expo、禁止 PTY 与sandbox-exec,且仓库钉的 Rust 1.99.1 未安装(本地用 1.97.0 验证);futureos(Tauri crate)因无法解包依赖未在本机编译,desktop/src-tauri本次未改动。