fix(ui): also fix floating point precision in mTokToPerToken

This commit is contained in:
erio
2026-04-01 23:18:03 +08:00
parent a9e5fc8539
commit 1b2ea7a1df

View File

@@ -36,7 +36,7 @@ export function toNullableNumber(val: number | string | null | undefined): numbe
/** 前端显示值($/MTok) → 后端存储值(per-token) */
export function mTokToPerToken(val: number | string | null | undefined): number | null {
const num = toNullableNumber(val)
return num === null ? null : num / MTOK
return num === null ? null : parseFloat((num / MTOK).toPrecision(10))
}
/** 后端存储值(per-token) → 前端显示值($/MTok) */