collab: Set cached token values when initially creating lifetime usage records (#18865)

This PR fixes an issue where we weren't setting the cached token fields
when initially creating a lifetime usage record.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-10-08 13:16:17 -04:00 committed by GitHub
parent 77bf2ad0f1
commit 3f2de172ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -382,6 +382,10 @@ impl LlmDatabase {
user_id: ActiveValue::set(user_id),
model_id: ActiveValue::set(model.id),
input_tokens: ActiveValue::set(input_token_count as i64),
cache_creation_input_tokens: ActiveValue::set(
cache_creation_input_tokens as i64,
),
cache_read_input_tokens: ActiveValue::set(cache_read_input_tokens as i64),
output_tokens: ActiveValue::set(output_token_count as i64),
..Default::default()
}