-
Notifications
You must be signed in to change notification settings - Fork 18
feat(profile): add extra_body deep-merged into translated request bodies #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -343,6 +343,11 @@ async fn try_forward( | |
| let mut translated = adapter.translate_request(body, profile)?; | ||
| adapter.filter_translated_body(&mut translated.body, profile); | ||
|
|
||
| // extra_body 在 strip_params 之后合并:用户显式配置的字段优先于自动剥离 | ||
| if let Some(extra) = &profile.extra_body { | ||
| super::util::merge_extra_body(&mut translated.body, extra); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For OpenAICompatible profiles that set Useful? React with 👍 / 👎. |
||
| } | ||
|
|
||
| let mut url = format!( | ||
| "{}{}", | ||
| profile.base_url.trim_end_matches('/'), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a profile configures
extra_body.stream, this merge changes the upstream request afteris_streamingwas already computed from the inbound body inhandle_messages, so the response handling can take the wrong branch. For example, a non-streaming client request withextra_body = { stream = true }makes the upstream return SSE while this code still callsresp.json(), and the inverse wraps a JSON response as an SSE stream; either reject/control-field overrides likestreamor derive the response path from the post-merge body.Useful? React with 👍 / 👎.