Conversation
… properly Request adapters had a KNOWN_FIELDS set that excluded recognized fields (e.g. response_format, presence_penalty, seed) from extraParams passthrough, but those fields were never mapped in parse() either — causing them to be silently dropped when forwarding to upstream providers. Rename to MAPPED_FIELDS containing only fields actually consumed by parse(), so all other fields flow through extraParams to the upstream provider. The response adapter for OpenAI Chat wrapped reasoning_content in <think> tags inside the content field. This was originally only used for DB logging, but was incorrectly carried over into client response serialization during the adapter refactor (09a0ce9). Restore the original behavior: return reasoning_content as a separate field for client responses, keep <think> wrapping only for database storage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthrough重命名并收窄了请求适配器中的已映射字段集合( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
诗歌
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @pescn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses two key issues related to data handling within the backend adapters. It refines how request parameters are processed, ensuring that all unmapped fields are correctly passed through to upstream services, thereby preventing silent data loss. Additionally, it rectifies the serialization of 'reasoning_content' in OpenAI chat responses, separating it from the main content field for improved clarity and adherence to expected API structures. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two main fixes: ensuring extra request parameters are correctly forwarded to upstream providers, and properly serializing reasoning_content as a separate field in responses. The changes to the request adapters are clean and effectively address the parameter passthrough issue by renaming KNOWN_FIELDS to the more accurate MAPPED_FIELDS and refining their contents. The response adapter change correctly separates reasoning content from the main content. I've included one suggestion to refactor two related functions into a single one to improve efficiency by avoiding iterating over the same data twice, which also aligns with our guidelines for returning ready-to-use objects from helper functions. Overall, the changes are well-implemented and improve the adapters' behavior.
… single pass Merge two separate functions that iterated over the same content blocks array into a single extractContent() function that returns both text and reasoning in one pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
KNOWN_FIELDSset that excluded recognized fields (e.g.response_format,presence_penalty,seed,frequency_penalty,logit_bias,user,n,modalities,metadata, etc.) fromextraParamspassthrough, but those fields were never mapped inparse()either — silently dropping them. Renamed toMAPPED_FIELDScontaining only fields actually consumed byparse(), so all other fields flow through to upstream providers.reasoning_contentin<think>tags inside thecontentfield. This was originally only used for DB logging (commitf837650by Koi to Coco), but was incorrectly carried over into client response serialization during the adapter refactor (09a0ce9). Now returnsreasoning_contentas a separate field for client responses, keeping<think>wrapping only for database storage.Test plan
bun run check— type check passesbun run lint— no errorsresponse_format,presence_penalty,seed, and custom fields are forwarded to upstream via unit test scriptreasoning_contentis returned as separate field in non-streaming response (tested with doubao-seed model)reasoning_contentdelta still works (unchanged)stream_optionsdefault behavior preserved (upstream adapter setsinclude_usage: truewhen user doesn't provide it)🤖 Generated with Claude Code
Summary by CodeRabbit
发布说明
新增功能
改进