MCPcopy Create free account
hub / github.com/ChatLab/ChatLab / toTokenUsage

Function toTokenUsage

src/stores/aiChat.ts:226–234  ·  view source on GitHub ↗
(data: { [K in keyof TokenUsage]?: number })

Source from the content-addressed store, hash-verified

224}
225
226function toTokenUsage(data: { [K in keyof TokenUsage]?: number }): TokenUsage {
227 return {
228 promptTokens: data.promptTokens ?? 0,
229 completionTokens: data.completionTokens ?? 0,
230 totalTokens: data.totalTokens ?? 0,
231 cacheReadTokens: data.cacheReadTokens ?? 0,
232 cacheWriteTokens: data.cacheWriteTokens ?? 0,
233 }
234}
235
236function normalizeSerializedError(error: unknown): SerializedErrorInfo {
237 if (error && typeof error === 'object') {

Callers 2

loadAIChatFunction · 0.85
editCurrentRoundOnlyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected