feat(adapter-gemini): 支持 camelCase 媒体字段配置
摘要
- 为 Gemini 适配器增加对
inlineData和mimeType字段的驼峰命名(camelCase)选项支持。 - 默认禁用上述两项配置。
- 为 zh-CN 和 en-US 补充模式标签(Schema labels)。
[!CAUTION]
Review failed
The pull request is closed.
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 576de0bb-7acf-4ec4-96e3-962035c71f9d
📥 Commits
Reviewing files that changed from the base of the PR and between bf82425aeb250bbd7705d258967c8b8dc6a0a82d and 17147d68bfdcdb1c81db52a00c622f8964a95d8c.
⛔ Files ignored due to path filters (2)
packages/adapter-gemini/src/locales/en-US.schema.ymlis excluded by!**/*.ymlpackages/adapter-gemini/src/locales/zh-CN.schema.ymlis excluded by!**/*.yml
📒 Files selected for processing (2)
packages/adapter-gemini/src/index.tspackages/adapter-gemini/src/utils.ts
Walkthrough
在 Gemini 适配器中新增布尔配置 useCamelCaseMediaFields(默认 false),并新增/使用 createGeminiInlineDataPart 以根据该配置在生成媒体 inline data part 时切换字段命名风格(camelCase vs snake_case)。
Gemini 适配器内联数据命名约定支持
| Layer / File(s) | Summary |
|---|---|
配置接口与模式定义 packages/adapter-gemini/src/index.ts |
在 Config 接口新增 useCamelCaseMediaFields: boolean,并在 Config 的 Schema 中添加对应布尔校验和默认值(false)。 |
inline data 生成器与调用 packages/adapter-gemini/src/utils.ts |
新增 createGeminiInlineDataPart,根据 useCamelCaseMediaFields 在 inlineData/mimeType 与 inline_data/mime_type 之间切换输出;将图片与文件/音视频内容的 inline part 构造改为复用该生成器;并收窄若干内部函数的 plugin 参数类型注解。 |
🎯 3 (Moderate) | ⏱️ ~20 minutes
兔兔跳进代码园,字段名悄然换新颜,
camel 或 snake 随你挑,🧩
内联数据整一整,生成器里跳舞旋。🐰✨
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | 标题准确总结了主要变化:为 Gemini 适配器添加驼峰命名媒体字段配置支持,与代码变更内容完全匹配。 |
| Description check | ✅ Passed | 描述详细说明了功能的目的、默认行为和相关的文档更新,与代码改动内容完全对应。 |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
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 @coderabbitai help to get the list of available commands and usage tips.
还有你的的 commit 记得签名,让 codex 去 git rebase 给你签名了,不弄我就 ntr 了
还有,两个开关直接合并成一个而不是两个