We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e386b9c commit 3954340Copy full SHA for 3954340
1 file changed
azure/openai.go
@@ -150,7 +150,14 @@ func ChatCompletion(c *gin.Context) {
150
var chatResp ChatCompletionResponse
151
if err := json.Unmarshal(body, &chatResp); err != nil {
152
c.JSON(http.StatusInternalServerError, models.NewErrorResponse("Error parsing response"))
153
- returnasdu
+ return
154
+ }
155
+
156
+ // Update token usage with actual tokens used
157
+ if err := tokenQuotaService.UpdateUsage(userID.(uuid.UUID), chatResp.Usage.TotalTokens); err != nil {
158
+ c.JSON(http.StatusTooManyRequests, models.NewErrorResponse(err.Error()))
159
160
161
162
c.JSON(http.StatusOK, chatResp)
163
}
0 commit comments