perf(app): performance improvements

This commit is contained in:
adamelmore
2026-01-25 06:42:33 -06:00
parent ddc4e89359
commit dcc8d1a638
4 changed files with 90 additions and 18 deletions

View File

@@ -26,13 +26,17 @@ export function SessionContextUsage(props: SessionContextUsageProps) {
const view = createMemo(() => layout.view(sessionKey))
const messages = createMemo(() => (params.id ? (sync.data.message[params.id] ?? []) : []))
const usd = createMemo(
() =>
new Intl.NumberFormat(language.locale(), {
style: "currency",
currency: "USD",
}),
)
const cost = createMemo(() => {
const locale = language.locale()
const total = messages().reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0)
return new Intl.NumberFormat(locale, {
style: "currency",
currency: "USD",
}).format(total)
return usd().format(total)
})
const context = createMemo(() => {