🐛 fix: Fix conditional caching in RelayHandler
This commit is contained in:
parent
755dbf79be
commit
36653c2ce5
@ -111,8 +111,11 @@ func RelayHandler(relay RelayBaseInterface) (err *types.OpenAIErrorWithStatusCod
|
|||||||
}
|
}
|
||||||
|
|
||||||
quota.Consume(relay.getContext(), usage)
|
quota.Consume(relay.getContext(), usage)
|
||||||
|
if usage.CompletionTokens > 0 {
|
||||||
cacheProps := relay.GetChatCache()
|
cacheProps := relay.GetChatCache()
|
||||||
go cacheProps.StoreCache(relay.getContext().GetInt("channel_id"), usage.PromptTokens, usage.CompletionTokens, relay.getModelName())
|
go cacheProps.StoreCache(relay.getContext().GetInt("channel_id"), usage.PromptTokens, usage.CompletionTokens, relay.getModelName())
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user