fix(openai): failover 切换账号时重建请求体,避免 alias 模型因缓存泄漏到下一账号#2920
Open
wucm667 wants to merge 1 commit into
Open
Conversation
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.
背景
/v1/responses failover 时 handler 每轮都会把原始 raw body 传给 Forward。Forward 会在 gin context 中缓存解析后的 body map,账号 A 的 model_mapping 修改缓存后,如果返回可 failover 错误,下一轮账号 B 可能复用这份已被 A 改写的缓存,导致 bodyModified 判定和实际 raw body 分离,alias 模型泄漏到下一账号。
改动
测试
Fixes #2897