feat: jimeng apiKey format to use | delimiter

This commit is contained in:
skynono
2025-06-21 21:03:57 +08:00
parent 9b8b982d8a
commit 6bd2316d9c
2 changed files with 6 additions and 4 deletions

View File

@@ -77,8 +77,8 @@ func (a *TaskAdaptor) Init(info *relaycommon.TaskRelayInfo) {
a.ChannelType = info.ChannelType
a.baseURL = info.BaseUrl
// apiKey format: "access_key,secret_key"
keyParts := strings.Split(info.ApiKey, ",")
// apiKey format: "access_key|secret_key"
keyParts := strings.Split(info.ApiKey, "|")
if len(keyParts) == 2 {
a.accessKey = strings.TrimSpace(keyParts[0])
a.secretKey = strings.TrimSpace(keyParts[1])
@@ -192,9 +192,9 @@ func (a *TaskAdaptor) FetchTask(baseUrl, key string, body map[string]any) (*http
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
keyParts := strings.Split(key, ",")
keyParts := strings.Split(key, "|")
if len(keyParts) != 2 {
return nil, fmt.Errorf("invalid api key format for jimeng: expected 'ak,sk'")
return nil, fmt.Errorf("invalid api key format for jimeng: expected 'ak|sk'")
}
accessKey := strings.TrimSpace(keyParts[0])
secretKey := strings.TrimSpace(keyParts[1])

View File

@@ -67,6 +67,8 @@ function type2secretPrompt(type) {
return '按照如下格式输入Ak|Sk|Region';
case 50:
return '按照如下格式输入: AccessKey|SecretKey';
case 51:
return '按照如下格式输入: Access Key ID|Secret Access Key';
default:
return '请输入渠道对应的鉴权密钥';
}