Skip to content

Commit

Permalink
another fix for Billing
Browse files Browse the repository at this point in the history
  • Loading branch information
radiantspace committed Oct 25, 2023
1 parent d6389a1 commit e144987
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions backend/app/openai/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ func (a *API) ChatCompleteStreaming(ctx context.Context, completion models.ChatC

backgroundContext := context.WithValue(context.Background(), models.UserContext{}, ctx.Value(models.UserContext{}).(string))
backgroundContext = context.WithValue(backgroundContext, models.SubscriptionContext{}, ctx.Value(models.SubscriptionContext{}).(models.MongoSubscriptionName))
backgroundContext = context.WithValue(backgroundContext, models.ClientContext{}, ctx.Value(models.ClientContext{}).(string))
usage.Usage.TotalTokens = usage.Usage.PromptTokens + usage.Usage.CompletionTokens
go payments.Bill(backgroundContext, usage)
config.CONFIG.DataDogClient.Timing("openai.chat_complete_streaming.latency", time.Since(timeNow), []string{"model:" + completion.Model}, 1)
Expand Down

0 comments on commit e144987

Please sign in to comment.