|
@@ -242,7 +242,7 @@ func preConsumeQuota(c *gin.Context, preConsumedQuota int, relayInfo *relaycommo
|
|
|
return 0, 0, service.OpenAIErrorWrapperLocal(errors.New("user quota is not enough"), "insufficient_user_quota", http.StatusForbidden)
|
|
return 0, 0, service.OpenAIErrorWrapperLocal(errors.New("user quota is not enough"), "insufficient_user_quota", http.StatusForbidden)
|
|
|
}
|
|
}
|
|
|
if userQuota-preConsumedQuota < 0 {
|
|
if userQuota-preConsumedQuota < 0 {
|
|
|
- return 0, 0, service.OpenAIErrorWrapperLocal(errors.New("pre-consumed quota is more than user quota"), "insufficient_user_quota", http.StatusForbidden)
|
|
|
|
|
|
|
+ return 0, 0, service.OpenAIErrorWrapperLocal(errors.New(fmt.Sprintf("chat pre-consumed quota failed, user quota: %d, need quota: %d", userQuota, preConsumedQuota)), "insufficient_user_quota", http.StatusBadRequest)
|
|
|
}
|
|
}
|
|
|
err = model.CacheDecreaseUserQuota(relayInfo.UserId, preConsumedQuota)
|
|
err = model.CacheDecreaseUserQuota(relayInfo.UserId, preConsumedQuota)
|
|
|
if err != nil {
|
|
if err != nil {
|