From f5be2868df041c1cea6587714924fbfca5fa5a07 Mon Sep 17 00:00:00 2001 From: mango Date: Tue, 7 Jan 2025 12:40:36 +0800 Subject: [PATCH] feat(channel model list): modify fetching model list in add channel to fetch by type --- controller/channel.go | 3 ++- web/src/pages/Channel/EditChannel.js | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/controller/channel.go b/controller/channel.go index b1fdd0c3..62f5bc69 100644 --- a/controller/channel.go +++ b/controller/channel.go @@ -510,6 +510,7 @@ func UpdateChannel(c *gin.Context) { func FetchModels(c *gin.Context) { var req struct { BaseURL string `json:"base_url"` + Type int `json:"type"` Key string `json:"key"` } @@ -523,7 +524,7 @@ func FetchModels(c *gin.Context) { baseURL := req.BaseURL if baseURL == "" { - baseURL = "https://api.openai.com" + baseURL = common.ChannelBaseURLs[req.Type] } client := &http.Client{} diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index 457dff42..6f576344 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -218,6 +218,7 @@ const EditChannel = (props) => { try { const res = await API.post('/api/channel/fetch_models', { base_url: inputs['base_url'], + type: inputs['type'], key: inputs['key'] }); @@ -885,7 +886,7 @@ const EditChannel = (props) => {