Skip to content

Conversation

@dingyi222666
Copy link
Member

@dingyi222666 dingyi222666 commented Nov 18, 2025

This PR adds support for Gemini 3.0 Pro and implements thinking mode capabilities.

New Features

  • Add Gemini 3.0 Pro model support
  • Implement thinking mode for Gemini 2.5/3.0 Pro models
  • Add Gemini 2.5 Flash thinking mode support
  • Implement thought signature tracking and propagation

Other Changes

  • Optimize thinking model detection logic to exclude image variants
  • Configure Gemini 3.0 Pro context size (1,097,152 tokens)
  • Bump version to 1.3.2

…lities

- Add Gemini 3.0 Pro model detection in client
- Implement thought signature tracking in message chunks
- Extend types to support thought data in chat parts
- Propagate thought data through message conversion pipeline
- Configure context size for Gemini 3.0 Pro (1,097,152 tokens)
- Refactor thinking model detection to include both 2.5 and 3.0 Pro variants
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 18, 2025

Caution

Review failed

The pull request is closed.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

本次更改扩展了 Gemini 适配器的思维模型判定列表,移动了 imagePart 的计算到消息块创建处,统一在消息中传播 thought_data,更新类型以携带 thoughtSignature,并调整/新增共享模型上下文配置(新增 gemini-3.0-pro,将 gemini-2.5-pro 键名调整为 gemini-2.5)。

Changes

内聚 / 文件(s) 变更摘要
Gemini 适配器 - 思维模型判定
packages/adapter-gemini/src/client.ts
引入 thinkingModel 列表(含 gemini-2.5-pro, gemini-2.5-flash, gemini-3.0-pro);用 thinkingModel.some(...) 与忽略包含 "image" 的检查替换原有对 gemini-2.5 的窄条件;匹配时追加 -non-thinking / -thinking / 原始变体
Gemini 适配器 - 请求处理 / 消息块创建
packages/adapter-gemini/src/requester.ts
_processChunks 不再在调用处计算并传入 imagePart,改为传入整个 chunk_createMessageChunk 签名改为接收 chunk 并在内部推导 imagePart(若无 chatluna_storage);messageChunk.additional_kwargs 始终包含来自 chunk 的 thought_data(含 thoughtSignature)
Gemini 适配器 - 类型定义
packages/adapter-gemini/src/types.ts
新增 export type BaseChatPart = { thoughtSignature?: string };将 ChatPart 修改为包含 (ChatMessagePart & BaseChatPart)(ChatFunctionCallingPart & BaseChatPart) 的联合类型,保留其他分支
Gemini 适配器 - 工具与内容处理
packages/adapter-gemini/src/utils.ts
在处理文本与函数调用路径中引入并传播 thought_dataprocessGeminiContentParts 接受并合并 thoughtData 到文本部分;processFunctionMessage 提取并将 thought_data 展开到各工具调用结果及后续处理
共享适配器 - 模型上下文配置
packages/shared-adapter/src/client.ts
模型上下文大小表中将原 gemini-2.5-pro 键调整为 gemini-2.5,并新增 gemini-3.0-pro(上下文大小:1,097,152)

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant P as _processChunks(调用方)
    participant C as _createMessageChunk(集中化)
    participant M as MessageChunk(输出)

    Note over P,C: 变更:P 不再计算 imagePart,直接传 chunk
    P->>C: 调用(content, functionCall, chunk)
    C->>C: 若无 chatluna_storage,从 chunk 派生 imagePart
    C->>C: 提取 thoughtSignature,构建 thought_data
    C->>M: 构建 MessageChunk,additional_kwargs 包含 thought_data
    C-->>P: 返回增强的 MessageChunk
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20-25 minutes

需要额外关注的区域:

  • packages/adapter-gemini/src/requester.ts:方法签名变更,检查所有调用方兼容性与 chatluna_storage 边界情况。
  • packages/adapter-gemini/src/types.ts:ChatPart 类型扩展对库其余部分的影响。
  • packages/adapter-gemini/src/utils.ts:thought_data 在不同内容路径(文本、工具调用、函数响应)的一致性与序列化。
  • packages/shared-adapter/src/client.ts:模型键名变化对查找/回退逻辑和向后兼容性的影响。

Poem

🐰 我把 thought_data 轻轻藏,
把 imagePart 从外面搬到房,
思维模型成双又成三,
消息块里签名亮闪闪,
在代码田野里我跳一圈 🌱✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR标题准确描述了主要变更:添加Gemini 3.0 Pro支持和思维模式功能,与代码改动完全对应。
Description check ✅ Passed PR描述详细说明了新增功能和变更,与代码改动高度相关,包括Gemini 3.0 Pro支持、思维模式实现和上下文大小配置等。

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea88751 and 023e50d.

⛔ Files ignored due to path filters (1)
  • packages/adapter-gemini/package.json is excluded by !**/*.json
📒 Files selected for processing (1)
  • packages/adapter-gemini/src/client.ts (1 hunks)

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dingyi222666, 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!

此拉取请求引入了对最新 Gemini 3.0 Pro 模型的支持,并增强了多个 Gemini 模型的“思维模式”功能。它还改进了模型能力检测和管理方式,以确保更好的兼容性和功能利用,同时实现了思维签名的追踪与传递。

Highlights

  • Gemini 3.0 Pro 支持: 此拉取请求新增了对 Gemini 3.0 Pro 模型的支持。
  • 思维模式扩展: 为 Gemini 2.5/3.0 Pro 模型实现了思维模式(thinking mode)支持,并新增了 Gemini 2.5 Flash 的思维模式支持。
  • 思维签名追踪: 实现了思维签名(thought signature)的追踪和传递机制,以更好地管理模型内部思考过程。
  • 模型检测优化: 优化了思维模型检测逻辑,确保图像模型被正确排除,避免不必要的处理。
  • 上下文大小配置: 为 Gemini 3.0 Pro 模型配置了 1,097,152 tokens 的上下文大小。
  • 版本更新: 项目版本已更新至 1.3.2。
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

此 PR 添加了对 Gemini 3.0 Pro 和思维模式的支持,整体实现思路清晰。代码改动主要集中在 Gemini 适配器中,用于传递和处理思维模式相关的 thoughtSignature。同时更新了模型列表和上下文大小配置。

我在 packages/adapter-gemini/src/client.ts 文件中发现了一个关键问题,这可能会导致思维模式的模型检测逻辑完全失效。请务必修复此问题,具体细节请见我的评论。

@dingyi222666 dingyi222666 changed the title [Feature] Gemini 3.0 Pro 和思维模式支持 [Feature] Add Gemini 3.0 Pro and thinking mode support Nov 18, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40e8793 and e56ede7.

⛔ Files ignored due to path filters (1)
  • packages/adapter-gemini/package.json is excluded by !**/*.json
📒 Files selected for processing (5)
  • packages/adapter-gemini/src/client.ts (1 hunks)
  • packages/adapter-gemini/src/requester.ts (3 hunks)
  • packages/adapter-gemini/src/types.ts (1 hunks)
  • packages/adapter-gemini/src/utils.ts (4 hunks)
  • packages/shared-adapter/src/client.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/adapter-gemini/src/requester.ts (2)
packages/adapter-gemini/src/types.ts (2)
  • ChatPart (10-17)
  • ChatInlineDataPart (32-37)
packages/adapter-gemini/src/utils.ts (1)
  • partAsTypeCheck (242-247)
packages/adapter-gemini/src/utils.ts (1)
packages/core/src/utils/string.ts (1)
  • isMessageContentText (46-50)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: lint
  • GitHub Check: build
🔇 Additional comments (7)
packages/adapter-gemini/src/types.ts (2)

6-8: 类型设计良好!

新增的 BaseChatPart 类型使用可选字段 thoughtSignature,能够很好地支持思维签名的传递而不破坏现有代码。


10-17: 正确扩展了 ChatPart 联合类型。

仅在 ChatMessagePartChatFunctionCallingPart 上添加 BaseChatPart 交集类型是合理的,因为思维签名主要与这些部分相关。

packages/adapter-gemini/src/utils.ts (3)

54-64: 思维数据提取和传播实现正确!

additional_kwargs 中提取 thought_data 并在字符串内容和复杂内容处理中一致地传播,实现得很好。使用 ?? {} 确保了安全的默认值。


220-236: 内容处理函数正确传播思维数据。

更新 processGeminiContentParts 函数签名以接受 thoughtData 参数,并将其传播到文本部分,确保了思维元数据的一致传递。


126-142: 函数消息处理正确传播思维数据。

processFunctionMessage 中提取并将 thought_data 传播到工具调用中,确保了思维签名在函数调用流程中的一致性。

packages/adapter-gemini/src/requester.ts (2)

527-531: 集中化的块处理逻辑改进了代码结构。

chunk 直接传递给 _createMessageChunk 而不是预先推导 imagePart,使得逻辑更加集中和清晰。


657-686: 消息块创建逻辑正确实现了思维数据传播。

_createMessageChunk 中集中处理 imagePart 推导,并始终包含带有 thoughtSignaturethought_data,确保了元数据的一致传递。逻辑封装得很好。

…l support

- Bump version from 1.3.0 to 1.3.4
- Add Gemini 2.5 Flash to thinking models list
- Add Gemini 3.0 Pro to thinking models list
- Fix thinking model detection logic to correctly match model names
- Improve model filtering to exclude image variants from thinking models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants