Spaces:
Sleeping
Sleeping
File size: 380 Bytes
097eaf0 | 1 2 3 4 5 6 7 8 9 10 11 12 | export const BROWSER_CREDITS_PER_HOUR = 120;
export const INTERACT_CREDITS_PER_HOUR = 420;
export function calculateBrowserSessionCredits(
durationMs: number,
creditsPerHour = BROWSER_CREDITS_PER_HOUR,
): number {
const hours = durationMs / 3_600_000;
const minCredits = Math.ceil(creditsPerHour / 60);
return Math.max(minCredits, Math.ceil(hours * creditsPerHour));
}
|