mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-19 08:09:51 +00:00
chore: generate
This commit is contained in:
parent
3c6be604ec
commit
1c49b2ed67
2 changed files with 2 additions and 7 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue