diff --git a/common/constants.go b/common/constants.go index 212649a..06986e5 100644 --- a/common/constants.go +++ b/common/constants.go @@ -21,6 +21,7 @@ var Footer = "" var Logo = "" var TopUpLink = "" var ChatLink = "" +var ChatLink2 = "" var QuotaPerUnit = 500 * 1000.0 // $0.002 / 1K tokens var DisplayInCurrencyEnabled = true var DisplayTokenStatEnabled = true diff --git a/controller/misc.go b/controller/misc.go index e8dc843..1264f5d 100644 --- a/controller/misc.go +++ b/controller/misc.go @@ -31,6 +31,7 @@ func GetStatus(c *gin.Context) { "turnstile_site_key": common.TurnstileSiteKey, "top_up_link": common.TopUpLink, "chat_link": common.ChatLink, + "chat_link2": common.ChatLink2, "quota_per_unit": common.QuotaPerUnit, "display_in_currency": common.DisplayInCurrencyEnabled, "enable_batch_update": common.BatchUpdateEnabled, diff --git a/model/option.go b/model/option.go index 5a1b453..94b5bee 100644 --- a/model/option.go +++ b/model/option.go @@ -76,6 +76,7 @@ func InitOptionMap() { common.OptionMap["GroupRatio"] = common.GroupRatio2JSONString() common.OptionMap["TopUpLink"] = common.TopUpLink common.OptionMap["ChatLink"] = common.ChatLink + common.OptionMap["ChatLink2"] = common.ChatLink2 common.OptionMap["QuotaPerUnit"] = strconv.FormatFloat(common.QuotaPerUnit, 'f', -1, 64) common.OptionMap["RetryTimes"] = strconv.Itoa(common.RetryTimes) common.OptionMap["DataExportInterval"] = strconv.Itoa(common.DataExportInterval) @@ -241,6 +242,8 @@ func updateOptionMap(key string, value string) (err error) { common.TopUpLink = value case "ChatLink": common.ChatLink = value + case "ChatLink2": + common.ChatLink2 = value case "ChannelDisableThreshold": common.ChannelDisableThreshold, _ = strconv.ParseFloat(value, 64) case "QuotaPerUnit": diff --git a/web/src/App.js b/web/src/App.js index 02db609..e980397 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -57,6 +57,11 @@ function App() { } else { localStorage.removeItem('chat_link'); } + if (data.chat_link2) { + localStorage.setItem('chat_link2', data.chat_link2); + } else { + localStorage.removeItem('chat_link2'); + } // if ( // data.version !== process.env.REACT_APP_VERSION && // data.version !== 'v0.0.0' && diff --git a/web/src/components/OperationSetting.js b/web/src/components/OperationSetting.js index 88f2d92..7ed7d47 100644 --- a/web/src/components/OperationSetting.js +++ b/web/src/components/OperationSetting.js @@ -15,6 +15,7 @@ const OperationSetting = () => { GroupRatio: '', TopUpLink: '', ChatLink: '', + ChatLink2: '', // 添加的新状态变量 QuotaPerUnit: 0, AutomaticDisableChannelEnabled: '', ChannelDisableThreshold: 0, @@ -141,6 +142,9 @@ const OperationSetting = () => { if (originInputs['ChatLink'] !== inputs.ChatLink) { await updateOption('ChatLink', inputs.ChatLink); } + if (originInputs['ChatLink2'] !== inputs.ChatLink2) { + await updateOption('ChatLink2', inputs.ChatLink2); + } if (originInputs['QuotaPerUnit'] !== inputs.QuotaPerUnit) { await updateOption('QuotaPerUnit', inputs.QuotaPerUnit); } @@ -187,6 +191,15 @@ const OperationSetting = () => { type='link' placeholder='例如 ChatGPT Next Web 的部署地址' /> +