feat: 支持账号级温度三态策略 - #6322
Open
mordekasiser wants to merge 3 commits into
Open
Conversation
为账号凭据增加 inherit、override、omit 三态温度策略,并在 OpenAI、Anthropic、Gemini 与 Antigravity 网关入口统一应用。保留模型能力清洗优先级,补充管理端校验、映射场景和协议回归测试。
在账号创建、编辑和批量编辑流程中加入温度三态配置,支持固定值 0、继承客户端参数和删除参数,并为中英文文案及凭据构建补充测试。
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.
背景
账号当前只能沿用客户端传入的
temperature。渠道运营需要在账号边界统一控制温度,同时保留客户端默认行为,并支持不向上游发送该参数。行为
账号凭据新增三态策略:
temperature_mode=inherit:保留客户端数值;客户端未传或传null时不补参数。temperature_mode=override:使用账号固定值覆盖客户端参数,固定值支持0。temperature_mode=omit:删除客户端温度,不向上游发送。固定值只校验为有限数字。数值范围由对应上游协议校验,避免用单一范围限制不同供应商。
协议覆盖
generationConfig.temperature。Spark 影子账号读取母账号策略,策略状态只归母账号所有。
模型能力
upstreamModel,避免别名和账号映射绕过模型限制。temperature/top_p;gpt-5.60、gpt-5.6ish不会被误判。temperature/top_p。temperature或top_p时,只删除被拒绝的顶层字段并执行有界重试;嵌套同名字段保持不变。OpenAI 官方资料:
gpt-5.6别名指向 Sol,并支持 Chat Completions 与 Responses 端点。temperature与top_p。管理端
验证
go test -count=1 ./internal/pkg/apicompatgo vet ./internal/pkg/apicompat ./internal/servicegit diff --checkpnpm lint:checkpnpm typecheckpnpm buildgo test ./internal/service的 5 个失败位于 content moderation 和 plugin package installer 既有测试,未触及本 PR 文件。