Add total token cost to variant stats (#13)

* Add total token cost to variant stats

* Copy over token counts for new variants

* Update invalidate call
This commit is contained in:
arcticfly
2023-07-06 15:33:49 -07:00
committed by GitHub
parent 1fa0d7bc62
commit fe501a80cb
8 changed files with 91 additions and 40 deletions

View File

@@ -1,8 +1,9 @@
import { isObject } from "lodash";
import { type JSONSerializable, type SupportedModel } from "../types";
import { type Prisma } from "@prisma/client";
export function getModelName(config: JSONSerializable): SupportedModel | null {
export function getModelName(config: JSONSerializable | Prisma.JsonValue): SupportedModel | null {
if (!isObject(config)) return null;
if ("model" in config && typeof config.model === "string") return config.model as SupportedModel;
return null
return null;
}