refactor: Improve channel status update logic and clean up code
- Simplified conditional checks in UpdateChannelStatusById function in channel.go to enhance readability. - Commented out unused image number check in relay-gemini.go for clarity. - Updated JSON field in en.json for currency consistency, changing "元" from "RMB/CNY" to "CNY" and added a space in "实付金额:" for formatting.
This commit is contained in:
@@ -292,10 +292,11 @@ func (channel *Channel) Delete() error {
|
||||
}
|
||||
|
||||
var channelStatusLock sync.Mutex
|
||||
|
||||
func UpdateChannelStatusById(id int, status int, reason string) {
|
||||
if (common.MemoryCacheEnabled) {
|
||||
if common.MemoryCacheEnabled {
|
||||
channelStatusLock.Lock()
|
||||
channelCache, err := CacheGetChannel(id)
|
||||
channelCache, _ := CacheGetChannel(id)
|
||||
// 如果缓存渠道存在,且状态已是目标状态,直接返回
|
||||
if channelCache != nil && channelCache.Status == status {
|
||||
channelStatusLock.Unlock()
|
||||
|
||||
@@ -103,9 +103,9 @@ func CovertGemini2OpenAI(textRequest dto.GeneralOpenAIRequest) *GeminiChatReques
|
||||
})
|
||||
} else if part.Type == dto.ContentTypeImageURL {
|
||||
imageNum += 1
|
||||
if imageNum > GeminiVisionMaxImageNum {
|
||||
continue
|
||||
}
|
||||
//if imageNum > GeminiVisionMaxImageNum {
|
||||
// continue
|
||||
//}
|
||||
// 判断是否是url
|
||||
if strings.HasPrefix(part.ImageUrl.(dto.MessageImageUrl).Url, "http") {
|
||||
// 是url,获取图片的类型和base64编码的数据
|
||||
|
||||
@@ -797,7 +797,7 @@
|
||||
"管理员未开启Stripe在线充值!": "The administrator has not enabled Stripe online recharge!",
|
||||
"当前充值1美金=": "Current recharge = 1 USD =",
|
||||
"请选择充值方式!": "Please choose a recharge method!",
|
||||
"元": "RMB/CNY",
|
||||
"元": "CNY",
|
||||
"充值记录": "Recharge record",
|
||||
"返利记录": "Rebate record",
|
||||
"确定要充值 $": "Confirm to top up $",
|
||||
|
||||
Reference in New Issue
Block a user