mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-05-25 15:31:10 +08:00
style: format Rust code with cargo fmt
This commit is contained in:
@@ -111,8 +111,9 @@ impl TokenUsage {
|
||||
}
|
||||
// 从 message_delta 中处理缓存命中(cache_read_input_tokens)
|
||||
if usage.cache_read_tokens == 0 {
|
||||
if let Some(cache_read) =
|
||||
delta_usage.get("cache_read_input_tokens").and_then(|v| v.as_u64())
|
||||
if let Some(cache_read) = delta_usage
|
||||
.get("cache_read_input_tokens")
|
||||
.and_then(|v| v.as_u64())
|
||||
{
|
||||
usage.cache_read_tokens = cache_read as u32;
|
||||
}
|
||||
@@ -120,8 +121,9 @@ impl TokenUsage {
|
||||
// 从 message_delta 中处理缓存创建(cache_creation_input_tokens)
|
||||
// 注: 现在 zhipu 没有返回 cache_creation_input_tokens 字段
|
||||
if usage.cache_creation_tokens == 0 {
|
||||
if let Some(cache_creation) =
|
||||
delta_usage.get("cache_creation_input_tokens").and_then(|v| v.as_u64())
|
||||
if let Some(cache_creation) = delta_usage
|
||||
.get("cache_creation_input_tokens")
|
||||
.and_then(|v| v.as_u64())
|
||||
{
|
||||
usage.cache_creation_tokens = cache_creation as u32;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user