Skip to content

feat(media): 支持按 Provider 选择媒体模型 - #2940

Merged
MagicLizi merged 5 commits into
makecindy:mainfrom
GaoWeiLiuXD:fix/art-provider-media-preferences
Aug 19, 2026
Merged

feat(media): 支持按 Provider 选择媒体模型#2940
MagicLizi merged 5 commits into
makecindy:mainfrom
GaoWeiLiuXD:fix/art-provider-media-preferences

Conversation

@GaoWeiLiuXD

Copy link
Copy Markdown
Collaborator

这次改了什么

摘要

让 Cindy 媒体能力以 providerId + modelId 精确区分执行来源:同一个 GPT Image 2 同时来自 Cindy AI 和 OpenAI 时都会展示,Art 配置页用 Provider 图标区分,并把用户选择的来源原样交给 Agent/Core。新增 OpenAI Provider 的 GPT Image 2 发现与执行支持,同时在本地日志记录媒体请求的实际 URL、参数、状态和耗时;凭证、data URL 与二进制内容会脱敏或摘要。

变更类型

  • feat 新功能
  • fix 缺陷修复
  • refactor / perf 重构或性能优化
  • docs / test / chore 文档、测试或工程维护
  • 其他:

范围

  • 关联 Issue / 需求:Cindy 媒体模型按 Provider 发现、选择和调用
  • 本 PR 包含:Gateway 与本地 Provider 媒体模型合并;Provider 精确偏好;OpenAI GPT Image 2 客户端执行;Art 配置页 Provider 图标;媒体请求本地脱敏日志;工具契约与 Forge Guide 同步
  • 明确不包含:新增其它第三方媒体 Provider;Server/Gateway Guide 内容;Art 插件仓实现;媒体价格统计;异步任务反查
  • 用户可见变化:同名媒体模型可按来源分别选择;列表在原轻量下拉前显示 Provider 图标
  • 是否存在 breaking change:无。新增字段为 additive;prepare 仍兼容只传 model_id

UI 变化

  • 引用的设计规范:docs/design-rules/DESIGN.md §3 Typography、§4 Select & Dropdown。保持原 300px 轻量下拉、12/13px 字体与现有颜色 token,只在条目前增加 Provider 图标,没有改成重型模型列表。

怎么验证的

自动验证

pnpm --filter desktop typecheck
结果:通过

TMPDIR=/private/var/folders/wv/nth8p1d14rb3cnl7zgw4j0dw0000gn/T pnpm test:unit:related
结果:desktop、mobile、cindy-tools、model-providers、responses-chat-bridge 全部通过

pnpm --filter desktop exec vitest run src/main/cindy-media/__tests__/mediaRequestLog.test.ts --pool=threads --maxWorkers=1
结果:2/2 通过

git diff --cached --check
结果:通过

手工验证

  • macOS 本地开发实例:验证 Cindy AI 与 OpenAI 的同名 GPT Image 2 同时展示,Provider 图标可区分,选择器字体与原样式一致。
  • 已验证 Art 配置的 Provider/模型选择能进入 Core prepare,不再只按裸 model id 去重。

未执行的验证

  • 未在 Windows/Linux 手工操作 UI;相关 TypeScript 与单元验证已通过,交由 PR CI 覆盖平台构建。

风险

风险分类

  • 无已知风险
  • SQLite / migration
  • system prompt
  • 协议兼容
  • 权限 / 安全 / 用户数据
  • 存量插件兼容(批准状态 / 指纹 / manifest 校验 / 安装布局 / 包格式)
  • 原生层 / fingerprint / OTA
  • 跨平台差异
  • 其他:

影响与回滚

  • 影响范围:Desktop 媒体模型目录、Core media 工具、Ghost Cindy 偏好 UI、OpenAI 图片通道与本地诊断日志。日志 scope 维持 deny-by-default,不进入上传白名单;凭证与媒体正文不会落日志。
  • 存量插件影响:无。旧 Art 不传 provider_id 时继续按历史 model_id 兼容路径工作,不需要重装或重新确认;要精确区分同名模型的 Provider 需使用新版 Art。
  • 跨平台差异:改动为 Electron/TypeScript 逻辑;UI 使用现有跨平台 Popover 与 token,没有新增原生依赖。
  • 回滚 / 降级方式:revert 本提交即可恢复按裸 model id 的历史行为;Gateway 媒体链路和插件安装数据没有迁移。

提交前检查

  • 已 review 完整 diff
  • 每个 commit 都带 DCO 签名(git commit -s,见 DCO
  • UI 改动已在「UI 变化」注明引用的设计规范章节(不涉及 UI 则跳过)
  • 未提交凭证、令牌或授权文件
  • 已补充必要文档
  • 已确认测试结果或说明未执行原因

Signed-off-by: liugaowei <liugaowei@xd.com>
@GaoWeiLiuXD
GaoWeiLiuXD requested a review from a team as a code owner August 18, 2026 08:52
@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown

Greptile Summary

本 PR 将媒体模型选择从裸 modelId 扩展为 providerId + modelId,使同名模型可按执行来源分别发现、选择和调用。

  • 合并 Gateway 与本地 Provider 的媒体模型目录,并贯穿 Provider-aware 偏好与执行路由
  • 新增 OpenAI GPT Image 2 的发现、生成及编辑支持
  • 在 Art 配置界面显示 Provider 图标,并同步 preload、共享类型和工具契约
  • 新增媒体请求的 URL、参数、状态与耗时诊断日志及脱敏处理

Confidence Score: 5/5

当前没有仍需阻止合并的已确认故障,PR 看起来可以安全合并。

当前没有仍然存在的阻塞性故障。

Important Files Changed

Filename Overview
apps/desktop/src/main/cindy-brain/cindySlot.ts 将 Provider-aware 媒体覆盖贯穿能力校验、执行参数和结果标签,并保留旧版裸 modelId 兼容路径。
apps/desktop/src/main/cindy-brain/index.ts 接入 Provider 媒体目录、偏好解析、执行前可用性复核及图片通道路由。
apps/desktop/src/main/cindy-media/invocationService.ts 扩展 prepare/submit 流程以支持本地 Provider 媒体调用,并在提交时重新确认来源可用性。
apps/desktop/src/main/cindy-media/providerMediaRuntime.ts 新增 Provider 媒体模型解析与运行时调用桥接。
apps/desktop/src/main/cindy-brain/codexImageClient.ts 为 OpenAI GPT Image 2 请求增加取消信号支持及脱敏诊断日志。
apps/desktop/src/main/cindy-media/mediaRequestLog.ts 提供媒体请求 URL 和参数的递归脱敏、data URL 摘要与日志安全投影。
apps/desktop/src/main/model-access/mediaModels.ts 将媒体模型发现扩展到 Provider 维度并应用当前启停配置。
apps/desktop/src/renderer/cindy-brain/CindyCapabilityPrefs.tsx 在媒体模型偏好选择器中区分同名来源并展示 Provider 图标。
packages/model-providers/src/types.ts 扩展 Provider 目录类型以声明媒体模型及其能力。
packages/cindy-tools/src/ghost/mcpServer.ts 更新 Ghost 工具契约,使媒体 prepare 请求可携带精确 Provider 选择。

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  UI["Art Provider/模型选择"] --> Prefs["Ghost 媒体偏好<br/>providerId + modelId"]
  Prefs --> Slot["Cindy Slot / Core prepare"]
  Catalog["Gateway + 本地 Provider 目录"] --> Slot
  Slot --> Check["执行前可用性复核"]
  Check -->|Gateway| Gateway["Gateway 图片通道"]
  Check -->|OpenAI| OpenAI["OpenAI GPT Image 2 通道"]
  Gateway --> Media["生成媒体并落库"]
  OpenAI --> Media
  Gateway --> Log["脱敏媒体请求日志"]
  OpenAI --> Log
Loading

Reviews (5): Last reviewed commit: "fix(media): reject ambiguous legacy mode..." | Re-trigger Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 871ebee5fd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/cindy-brain/index.ts Outdated
Signed-off-by: liugaowei <liugaowei@xd.com>
@GaoWeiLiuXD

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46cefa0e91

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/cindy-media/invocationService.ts
Comment thread apps/desktop/src/renderer/cindy-brain/CindyCapabilityPrefs.tsx
Signed-off-by: liugaowei <liugaowei@xd.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbedd9ef7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/renderer/cindy-brain/CindyCapabilityPrefs.tsx Outdated
Signed-off-by: liugaowei <liugaowei@xd.com>
@GaoWeiLiuXD

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Signed-off-by: liugaowei <liugaowei@xd.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b72faef4a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/desktop/src/main/cindy-brain/codexImageClient.ts
@MagicLizi MagicLizi added awaiting-discussion 等待维护者讨论(review-pr) touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示) labels Aug 18, 2026
@MagicLizi

Copy link
Copy Markdown
Contributor

⏸️ 本 PR 触发 product 维护者确认门。

媒体生成模型支持按 Provider 选择,涉及插件基座和架构变更。 需维护者在 PR 上 Approve 后方可合并。

讨论 issue 已创建,详见上方链接。

讨论 issue:#2962

@MagicLizi MagicLizi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ 审查通过:媒体模型按 providerId + modelId 复合身份选择,7 项维护者讨论条件(旧调用歧义 fail-closed、双来源端到端矩阵、诊断日志 deny-by-default + 脱敏、插件基座纯加法向后兼容、FORGE_GUIDE 已同步、PR 范围干净、UI 符合 DESIGN.md)均已在代码中核实。CI 全绿,无 P0/P1。同意合并。

@MagicLizi

Copy link
Copy Markdown
Contributor

维护者确认已通过(product / pluginBase / arch,由 magiclizi 确认),PR 恢复正常推进。

@MagicLizi MagicLizi removed the awaiting-discussion 等待维护者讨论(review-pr) label Aug 19, 2026
@MagicLizi
MagicLizi merged commit 75d779b into makecindy:main Aug 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

touches:core 改动碰到架构核心路径(review-pr 自动维护,仅展示) touches:large-diff 改动量较大(review-pr 自动维护,仅展示) touches:plugin-base 改动碰到插件基座(review-pr 自动维护,仅展示) touches:product-ui 改动碰到产品 / UI 面(review-pr 自动维护,仅展示)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants