fix: Improve Image Generation Request Handling and Error Messaging

- Implemented error messages with request details and request parameter validation for image requests
- Added URL logic and Azure channel support for image generation requests
- Integrated quota management and updated quota usage logging for image generation requests
- Mapped original model names to mapped model names and unmarshalled image responses into a struct for further processing
This commit is contained in:
Laisky.Cai 2024-03-08 03:42:58 +00:00
parent cad6f9d3ba
commit 758378e45a

View File

@ -131,7 +131,7 @@ func RelayImageHelper(c *gin.Context, relayMode int) *relaymodel.ErrorWithStatus
if err != nil {
logger.SysError("error update user quota cache: " + err.Error())
}
if quota != 0 {
if quota >= 0 {
tokenName := c.GetString("token_name")
logContent := fmt.Sprintf("模型倍率 %.2f,分组倍率 %.2f", modelRatio, groupRatio)
model.RecordConsumeLog(ctx, meta.UserId, meta.ChannelId, 0, 0, imageRequest.Model, tokenName, quota, logContent)