Skip to content

feat: jimeng apiKey format to use | delimiter - #1322

Merged
Calcium-Ion merged 1 commit into
QuantumNous:alphafrom
feitianbubu:pr/jimeng-key-delimiter
Jul 1, 2025
Merged

feat: jimeng apiKey format to use | delimiter#1322
Calcium-Ion merged 1 commit into
QuantumNous:alphafrom
feitianbubu:pr/jimeng-key-delimiter

Conversation

@feitianbubu

@feitianbubu feitianbubu commented Jul 1, 2025

Copy link
Copy Markdown
Member

增加即梦渠道的Access Key ID 和 Secret Access Key使用 | 分隔的提示,保持和其他渠道格式一致

Summary by CodeRabbit

  • New Features

    • Updated the prompt for entering API keys to specify the new format: "Access Key ID|Secret Access Key" for relevant input types.
  • Bug Fixes

    • Improved error messages and validation to support the updated API key format using a pipe (|) separator instead of a comma.

@coderabbitai

coderabbitai Bot commented Jul 1, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the expected API key format from a comma-separated ("access_key,secret_key") to a pipe-separated ("access_key|secret_key") string in both backend and frontend components. The backend parsing and error messages are revised, and the frontend prompt for the relevant input type is updated to instruct users on the new format.

Changes

File(s) Change Summary
relay/channel/task/jimeng/adaptor.go Updated API key parsing and error messages to expect pipe-separated format instead of comma.
web/src/pages/Channel/EditChannel.js Added a new switch case to display the updated prompt for API key input format (type 51).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend

    User->>Frontend: Enter API key in "access_key|secret_key" format
    Frontend->>Backend: Send API key as part of request
    Backend->>Backend: Parse API key using pipe separator
    Backend-->>Frontend: Process task or return error if format invalid
    Frontend-->>User: Show result or error message
Loading

Possibly related PRs

Poem

The keys once split by commas, now joined by a pipe,
Backend and frontend both got a type,
"Access|Secret" is how you must write,
Prompts and errors now guide you right.
🐇—A hop, a skip, and code anew,
The channel’s ready for something new!

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Calcium-Ion
Calcium-Ion merged commit 950f7d2 into QuantumNous:alpha Jul 1, 2025

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b8b982 and 6bd2316.

📒 Files selected for processing (2)
  • relay/channel/task/jimeng/adaptor.go (2 hunks)
  • web/src/pages/Channel/EditChannel.js (1 hunks)
🔇 Additional comments (2)
relay/channel/task/jimeng/adaptor.go (2)

80-81: LGTM: API key parsing updated to use pipe delimiter.

The comment and parsing logic are correctly updated to use the pipe delimiter. The change is consistent with the PR objective.


195-197: Verify backward compatibility for Jimeng API key delimiter

The adapter now only accepts “ak|sk” and will reject any comma-separated keys. Our grep across relay/channel/task/jimeng and related constants didn’t uncover any built-in support for comma delimiters, but please double-check how existing deployments supply the Jimeng key (e.g., env vars, DB records, Helm values) to ensure this won’t break users.

• File to review:
– relay/channel/task/jimeng/adaptor.go (around lines 195–197)

• If you need to support both formats during migration, you can add a fallback:

-   keyParts := strings.Split(key, "|")
-   if len(keyParts) != 2 {
-       return nil, fmt.Errorf("invalid api key format for jimeng: expected 'ak|sk'")
+   var keyParts []string
+   switch {
+   case strings.Contains(key, "|"):
+       keyParts = strings.Split(key, "|")
+   case strings.Contains(key, ","):
+       keyParts = strings.Split(key, ",")
+   default:
+       return nil, fmt.Errorf("invalid api key format for jimeng: expected 'ak|sk' or 'ak,sk'")
+   }
+   if len(keyParts) != 2 {
+       return nil, fmt.Errorf("invalid api key format for jimeng: expected 'ak|sk' or 'ak,sk'")
    }
    accessKey := strings.TrimSpace(keyParts[0])
    secretKey := strings.TrimSpace(keyParts[1])

Please confirm your existing configurations and rollout plans before shipping this change.

Comment on lines +70 to +71
case 51:
return '按照如下格式输入: Access Key ID|Secret Access Key';

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.

💡 Verification agent

🧩 Analysis chain

Frontend prompt correctly aligned with backend format.

The new case 51 provides the appropriate user prompt for the pipe-separated API key format, matching the backend expectation. The prompt text is consistent with other similar cases in the function.

Verify that channel type 51 corresponds to the jimeng channel:


🏁 Script executed:

#!/bin/bash
# Description: Verify that channel type 51 is used for jimeng
# Expected: Find confirmation that type 51 maps to jimeng channel

# Search for channel type definitions or mappings
echo "=== Searching for channel type definitions ==="
rg -i "jimeng.*51|51.*jimeng" -A 3 -B 3

# Search for CHANNEL_OPTIONS or similar constants
echo "=== Searching for channel options/types ==="
rg "CHANNEL_OPTIONS|channel.*type" --type js -A 10 -B 5

Length of output: 10597


🏁 Script executed:

#!/bin/bash
echo "=== Searching for ChannelTypeJimeng usage in Go code ==="
rg -n -A3 -B3 'ChannelTypeJimeng' --type go

Length of output: 1027


🏁 Script executed:

#!/bin/bash
echo "=== Extracting type2secretPrompt function ==="
rg -n 'type2secretPrompt' -A15 -B5 web/src/pages/Channel/EditChannel.js

Length of output: 1765


Unify punctuation in type2secretPrompt for consistency

The new prompts for cases 50 and 51 use an ASCII colon and (in case 50) include a space after it, whereas all earlier cases use a Chinese full-width colon () with no space. To keep the UI copy consistent, please update both to use and remove the extra space:

• File: web/src/pages/Channel/EditChannel.js
– Around lines 68–71

   case 50:
-    return '按照如下格式输入: AccessKey|SecretKey';
+    return '按照如下格式输入:AccessKey|SecretKey';
   case 51:
-    return '按照如下格式输入: Access Key ID|Secret Access Key';
+    return '按照如下格式输入:Access Key ID|Secret Access Key';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
case 51:
return '按照如下格式输入: Access Key ID|Secret Access Key';
case 50:
return '按照如下格式输入:AccessKey|SecretKey';
case 51:
return '按照如下格式输入:Access Key ID|Secret Access Key';
🤖 Prompt for AI Agents
In web/src/pages/Channel/EditChannel.js around lines 68 to 71, the prompt
strings for cases 50 and 51 use an ASCII colon and inconsistent spacing, while
earlier cases use a Chinese full-width colon without a space. Update these
prompt strings to replace the ASCII colon with a Chinese full-width colon (:)
and remove any extra spaces after the colon to unify punctuation and maintain UI
consistency.

x22x22 pushed a commit to x22x22/new-api that referenced this pull request Apr 24, 2026
…limiter

feat: jimeng apiKey format to use `|` delimiter
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