mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-23 12:54:21 +00:00
chore: generate
This commit is contained in:
@@ -294,9 +294,7 @@ const mapUsage = (usage: GeminiUsage | undefined) => {
|
|||||||
// when the visible component is reported — otherwise we'd fabricate an
|
// when the visible component is reported — otherwise we'd fabricate an
|
||||||
// inclusive number from a partial breakdown.
|
// inclusive number from a partial breakdown.
|
||||||
const outputTokens =
|
const outputTokens =
|
||||||
usage.candidatesTokenCount !== undefined
|
usage.candidatesTokenCount !== undefined ? usage.candidatesTokenCount + (usage.thoughtsTokenCount ?? 0) : undefined
|
||||||
? usage.candidatesTokenCount + (usage.thoughtsTokenCount ?? 0)
|
|
||||||
: undefined
|
|
||||||
return new Usage({
|
return new Usage({
|
||||||
inputTokens: usage.promptTokenCount,
|
inputTokens: usage.promptTokenCount,
|
||||||
outputTokens,
|
outputTokens,
|
||||||
|
|||||||
@@ -71,10 +71,7 @@ export const totalTokens = (
|
|||||||
* counts). If `subtrahend` is `undefined`, returns `total` unchanged. The
|
* counts). If `subtrahend` is `undefined`, returns `total` unchanged. The
|
||||||
* provider-native breakdown stays available on `Usage.native` for debugging.
|
* provider-native breakdown stays available on `Usage.native` for debugging.
|
||||||
*/
|
*/
|
||||||
export const subtractTokens = (
|
export const subtractTokens = (total: number | undefined, subtrahend: number | undefined): number | undefined => {
|
||||||
total: number | undefined,
|
|
||||||
subtrahend: number | undefined,
|
|
||||||
): number | undefined => {
|
|
||||||
if (total === undefined) return undefined
|
if (total === undefined) return undefined
|
||||||
if (subtrahend === undefined) return total
|
if (subtrahend === undefined) return total
|
||||||
return Math.max(0, total - subtrahend)
|
return Math.max(0, total - subtrahend)
|
||||||
|
|||||||
Reference in New Issue
Block a user