Skip to content

Commit e9d4226

Browse files
author
jinjianmingming
committed
feat: 余额不足提示中文增强引导性
1 parent adba54a commit e9d4226

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

relay/controller/audio.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ func RelayAudioHelper(c *gin.Context, relayMode int) *relaymodel.ErrorWithStatus
7171
return openai.ErrorWrapper(err, "get_user_quota_failed", http.StatusInternalServerError)
7272
}
7373

74-
// Check if user quota is enough
74+
// Check if user quota is enough Message prompts the user to use Chinese
7575
if userQuota-preConsumedQuota < 0 {
76-
return openai.ErrorWrapper(errors.New("user quota is not enough"), "insufficient_user_quota", http.StatusForbidden)
76+
return openai.ErrorWrapper(errors.New("请移步充值页面进行充值,可在日志中查阅使用明细"), "insufficient_user_quota", http.StatusForbidden)
7777
}
7878
err = model.CacheDecreaseUserQuota(userId, preConsumedQuota)
7979
if err != nil {

relay/controller/helper.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ func preConsumeQuota(ctx context.Context, textRequest *relaymodel.GeneralOpenAIR
6868
if err != nil {
6969
return preConsumedQuota, openai.ErrorWrapper(err, "get_user_quota_failed", http.StatusInternalServerError)
7070
}
71+
// Check if user quota is enough Message prompts the user to use Chinese
7172
if userQuota-preConsumedQuota < 0 {
72-
return preConsumedQuota, openai.ErrorWrapper(errors.New("user quota is not enough"), "insufficient_user_quota", http.StatusForbidden)
73+
return preConsumedQuota, openai.ErrorWrapper(errors.New("请移步充值页面进行充值,可在日志中查阅使用明细"), "insufficient_user_quota", http.StatusForbidden)
74+
7375
}
7476
err = model.CacheDecreaseUserQuota(meta.UserId, preConsumedQuota)
7577
if err != nil {

relay/controller/image.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ func RelayImageHelper(c *gin.Context, relayMode int) *relaymodel.ErrorWithStatus
173173
userQuota, err := model.CacheGetUserQuota(ctx, meta.UserId)
174174

175175
quota := int64(ratio*imageCostRatio*1000) * int64(imageRequest.N)
176-
176+
// Check if user quota is enough Message prompts the user to use Chinese
177177
if userQuota-quota < 0 {
178-
return openai.ErrorWrapper(errors.New("user quota is not enough"), "insufficient_user_quota", http.StatusForbidden)
178+
return openai.ErrorWrapper(errors.New("请移步充值页面进行充值,可在日志中查阅使用明细"), "insufficient_user_quota", http.StatusForbidden)
179179
}
180180

181181
// do request

0 commit comments

Comments
 (0)