mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-17 19:47:10 +08:00
v0.3.8
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package historymetrics
|
||||
|
||||
type Summary struct {
|
||||
ProviderCallsTotal int `json:"providerCallsTotal"`
|
||||
TurnsTotal int `json:"turnsTotal"`
|
||||
ValidTurnsTotal int `json:"validTurnsTotal"`
|
||||
InvalidTurnsTotal int `json:"invalidTurnsTotal"`
|
||||
RequestTokensTotal int64 `json:"requestTokensTotal"`
|
||||
PromptTokensTotal int64 `json:"promptTokensTotal"`
|
||||
CacheReadTokens int64 `json:"cacheReadTokens"`
|
||||
CacheWriteTokens int64 `json:"cacheWriteTokens"`
|
||||
CacheHitRate *float64 `json:"cacheHitRate"`
|
||||
}
|
||||
|
||||
type Totals struct {
|
||||
InputTokens int64
|
||||
OutputTokens int64
|
||||
CacheReadTokens int64
|
||||
CacheWriteTokens int64
|
||||
PromptTokensTotal int64
|
||||
RequestTokensTotal int64
|
||||
}
|
||||
|
||||
func cacheHitRateFromTotals(totals Totals) *float64 {
|
||||
inputCacheTokensTotal := totals.CacheReadTokens + totals.InputTokens
|
||||
if inputCacheTokensTotal <= 0 {
|
||||
return nil
|
||||
}
|
||||
value := float64(totals.CacheReadTokens) / float64(inputCacheTokensTotal)
|
||||
return &value
|
||||
}
|
||||
Reference in New Issue
Block a user