Skip to content

fix: edit vertex key type - #2311

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/edit-vertex-key-type
Nov 30, 2025
Merged

fix: edit vertex key type#2311
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
seefs001:fix/edit-vertex-key-type

Conversation

@seefs001

@seefs001 seefs001 commented Nov 26, 2025

Copy link
Copy Markdown
Collaborator

fix #2303

Summary by CodeRabbit

  • Bug Fixes
    • Improved Vertex channel settings management to ensure configuration is correctly preserved and isolated to Vertex channels.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Nov 26, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds logic to persist Vertex channel key format configuration to settings during submission. When a Vertex AI channel (type 41) is saved, the vertex_key_type setting is captured from user input with a 'json' default. For non-Vertex channels, any existing vertex_key_type setting is removed to prevent carryover.

Changes

Cohort / File(s) Summary
Vertex channel key format persistence
web/src/components/table/channels/modals/EditChannelModal.jsx
Added conditional logic in submission handler to set or remove vertex_key_type in settings based on channel type (41 for Vertex), enabling format conversion configuration for Vertex AI channels

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • Verify the conditional logic correctly identifies Vertex channels (type 41)
  • Confirm default 'json' value is appropriate for vertex_key_type
  • Ensure removal of the setting for non-Vertex channels doesn't affect other channel types
  • Check that localInputs.vertex_key_type is properly initialized in the form state

Poem

🐰 A Vertex key format now finds its place,
In settings it hides, with gentle grace,
When channels align with type forty-one,
Format conversions can finally run!
Claude Code through Gemini—oh what fun! 🎉

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: edit vertex key type' is concise and directly describes the main code change, which adds logic to persist and manage vertex_key_type in settings.
Linked Issues check ✅ Passed The PR addresses issue #2301 by adding vertex_key_type handling to settings, enabling format conversion configuration for Vertex AI channels.
Out of Scope Changes check ✅ Passed The changes are focused on vertex_key_type persistence in EditChannelModal.jsx, which is directly related to configuring Vertex AI channel settings as requested.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 0

🧹 Nitpick comments (1)
web/src/components/table/channels/modals/EditChannelModal.jsx (1)

1191-1197: Vertex vertex_key_type persistence and cleanup look correct

The new block correctly guarantees that for Vertex channels (type === 41) the selected vertex_key_type is always written into settings, even if the user never toggles the selector, and that any stale vertex_key_type is removed when the channel type is no longer Vertex. This lines up with how the field is loaded and later stripped from the top-level payload.

As a small optional cleanup, you might consider mirroring this pattern for aws_key_type (removing it from settings when type !== 33) to avoid stale AWS-specific config on channels whose type has been changed, even if the backend currently ignores it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ac1d02 and a25d00b.

📒 Files selected for processing (1)
  • web/src/components/table/channels/modals/EditChannelModal.jsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
Repo: QuantumNous/new-api PR: 1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the database stores mapped keys (display names) in the models field after applying model mapping transformations. When loading a channel, data.models contains the mapped keys, not the original model names. The filtering logic if (data.models.includes(key)) in the initialization is correct.

Applied to files:

  • web/src/components/table/channels/modals/EditChannelModal.jsx
📚 Learning: 2025-08-27T02:15:25.448Z
Learnt from: AAEE86
Repo: QuantumNous/new-api PR: 1658
File: web/src/components/table/channels/modals/EditChannelModal.jsx:555-569
Timestamp: 2025-08-27T02:15:25.448Z
Learning: In EditChannelModal.jsx, the applyModelMapping function transforms the models list by replacing original model names (mapping values) with display names (mapping keys). The database stores this transformed list containing mapped keys. On channel load, data.models contains these mapped display names, making the initialization filter if (data.models.includes(key)) correct.

Applied to files:

  • web/src/components/table/channels/modals/EditChannelModal.jsx

@Calcium-Ion
Calcium-Ion merged commit 287a59e into QuantumNous:main Nov 30, 2025
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
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.

Vertex AI渠道的API Key在编辑模式下丢失

2 participants