Skip to content

[Feature]: Persist Gemini thoughtSignature to MessageBlock metadata #13002

@EurFelux

Description

@EurFelux

Issue Checklist

  • I understand that issues are for reporting problems and requesting features, not for off-topic comments, and I will provide as much detail as possible to help resolve the issue.
  • I have checked the pinned issues and searched through the existing open issues, closed issues, and discussions and did not find a similar suggestion.
  • I have provided a short and descriptive title so that developers can quickly understand the issue when browsing the issue list, rather than vague titles like "A suggestion" or "Stuck."
  • The latest version of Cherry Studio does not include the feature I am suggesting.

Platform

macOS

Version

Latest

Is your feature request related to an existing issue?

Gemini 模型返回的 thoughtSignature 目前未被持久化存储。在请求时通过中间件注入了跳过验证的魔串,但在响应时 aisdk 解析出的 providerMetadata 被丢弃了。

Desired Solution

将 Gemini 的 thoughtSignature 持久化存储到 MessageBlock 的 metadata 中:

  1. Chunk 层:修改 AiSdkToChunkAdapter.ts 保留 providerMetadata
  2. 类型定义:修改 Chunk 类型(TextStartChunk/TextDeltaChunk/ThinkingDeltaChunk 等)添加 providerMetadata 字段
  3. Callbacks 层:修改 textCallbacks/thinkingCallbacks 接收并存储 metadata
  4. 存储层:在 createMainTextBlock/createThinkingBlock 或更新时写入 metadata

Alternative Solutions

暂无

Additional Information

数据流问题

aisdk google provider
    ↓ (每个text-start/text-delta都有providerMetadata)
AiSdkToChunkAdapter.convertAndEmitChunk()
    ↓ (只取chunk.text,丢弃chunk.providerMetadata!)
CherryStudio Chunk
    ↓
textCallbacks/thinkingCallbacks
    ↓
MainTextMessageBlock/ThinkingMessageBlock (metadata未使用)

依赖:需要等待 #12023 (Migrate to AI sdk v6) 完成后再处理

Metadata

Metadata

Assignees

Labels

AI-SDKCategorized issue as related to AI-SDKModelsCategorizes an issue or PR as relevant to SIG LLMP3Low priority, fix in future

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions