From 1c052b7c13ae377d0beb48f2cbd64a95b3d64aad Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 24 Feb 2025 22:24:51 +0800 Subject: [PATCH] fix: Fix the issue with AI proxy certificate res error (#7983) --- backend/app/dto/ai.go | 11 ++++++----- backend/app/service/ai.go | 2 ++ frontend/src/api/interface/ai.ts | 1 + frontend/src/views/ai/model/domain/index.vue | 4 +--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/backend/app/dto/ai.go b/backend/app/dto/ai.go index 6c2065cae..f93dc646d 100644 --- a/backend/app/dto/ai.go +++ b/backend/app/dto/ai.go @@ -36,9 +36,10 @@ type OllamaBindDomainReq struct { } type OllamaBindDomainRes struct { - Domain string `json:"domain"` - SSLID uint `json:"sslID"` - AllowIPs []string `json:"allowIPs"` - WebsiteID uint `json:"websiteID"` - ConnUrl string `json:"connUrl"` + Domain string `json:"domain"` + SSLID uint `json:"sslID"` + AcmeAccountID uint `json:"acmeAccountID"` + AllowIPs []string `json:"allowIPs"` + WebsiteID uint `json:"websiteID"` + ConnUrl string `json:"connUrl"` } diff --git a/backend/app/service/ai.go b/backend/app/service/ai.go index 89be57ad6..5d6cf123b 100644 --- a/backend/app/service/ai.go +++ b/backend/app/service/ai.go @@ -297,6 +297,8 @@ func (u *AIToolService) GetBindDomain(req dto.OllamaBindDomainReq) (*dto.OllamaB res.Domain = website.PrimaryDomain if website.WebsiteSSLID > 0 { res.SSLID = website.WebsiteSSLID + ssl, _ := websiteSSLRepo.GetFirst(commonRepo.WithByID(website.WebsiteSSLID)) + res.AcmeAccountID = ssl.AcmeAccountID } res.ConnUrl = fmt.Sprintf("%s://%s", strings.ToLower(website.Protocol), website.PrimaryDomain) res.AllowIPs = GetAllowIps(website) diff --git a/frontend/src/api/interface/ai.ts b/frontend/src/api/interface/ai.ts index a120bea66..46444710d 100644 --- a/frontend/src/api/interface/ai.ts +++ b/frontend/src/api/interface/ai.ts @@ -104,6 +104,7 @@ export namespace AI { export interface BindDomainRes { domain: string; sslID: number; + acmeAccountID: number; allowIPs: string[]; websiteID?: number; connUrl: string; diff --git a/frontend/src/views/ai/model/domain/index.vue b/frontend/src/views/ai/model/domain/index.vue index f1dc00815..2933ceaef 100644 --- a/frontend/src/views/ai/model/domain/index.vue +++ b/frontend/src/views/ai/model/domain/index.vue @@ -202,9 +202,6 @@ const listSSL = () => { const listAcmeAccount = () => { SearchAcmeAccount({ page: 1, pageSize: 100 }).then((res) => { acmeAccounts.value = res.data.items || []; - if (acmeAccounts.value.length > 0) { - req.value.acmeAccountID = acmeAccounts.value[0].id; - } listSSL(); }); }; @@ -238,6 +235,7 @@ const search = async (appInstallID: number) => { if (res.data.sslID > 0) { req.value.enableSSL = true; req.value.sslID = res.data.sslID; + req.value.acmeAccountID = res.data.acmeAccountID; listAcmeAccount(); } }