publish all priced relay groups
This commit is contained in:
1 parent
a80896e3c7
commit
a022162382
4 files changed
+200
-1
No files matched your search
@@ -144,10 +144,18 @@ public class CatalogService {
|
||||
validateBaseUrl(baseUrl);
|
||||
String credentialType=optional(value,"credentialType","none");
|
||||
if (!List.of("none","api-key","bearer","access-token").contains(credentialType)) throw new ApiException("INVALID_CREDENTIAL_TYPE","凭据类型无效");
|
||||
jdbc.update("UPDATE model_providers SET code=?, name=?, protocol=?, source_type=?, base_url=?, description=?, credential_type=?, status=?, updated_at=now() WHERE id=?", code,name,protocol,sourceType,baseUrl,optional(value,"description",""),credentialType,status(value),id);
|
||||
String nextStatus = status(value);
|
||||
boolean publishingChannel = !"active".equals(previous.get("status")) && "active".equals(nextStatus);
|
||||
jdbc.update("UPDATE model_providers SET code=?, name=?, protocol=?, source_type=?, base_url=?, description=?, credential_type=?, status=?, updated_at=now() WHERE id=?", code,name,protocol,sourceType,baseUrl,optional(value,"description",""),credentialType,nextStatus,id);
|
||||
String secret=optional(input,"credentialSecret","");
|
||||
if ("none".equals(credentialType)) jdbc.update("UPDATE model_providers SET credential_ciphertext=NULL, credential_masked=NULL WHERE id=?",id);
|
||||
else if (!secret.isBlank()) jdbc.update("UPDATE model_providers SET credential_ciphertext=?, credential_masked=? WHERE id=?",secretCipher.encrypt(secret),mask(secret),id);
|
||||
if (publishingChannel) {
|
||||
// V14 intentionally staged relay routes as disabled. Publishing a
|
||||
// channel should make its already-priced routes available together;
|
||||
// an administrator can still disable individual groups afterwards.
|
||||
jdbc.update("UPDATE model_catalog SET status='active', updated_at=now() WHERE provider_id=? AND status='disabled' AND pricing IS NOT NULL AND deleted_at IS NULL", id);
|
||||
}
|
||||
auth.audit("provider.updated",admin.id(),new AuthService.RequestMeta(null,null),Map.of("providerId",id));
|
||||
return findProvider(id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user