diff --git a/src/lib/commercial/AccountSwitcher.svelte b/src/lib/commercial/AccountSwitcher.svelte new file mode 100644 index 0000000..f1fc39a --- /dev/null +++ b/src/lib/commercial/AccountSwitcher.svelte @@ -0,0 +1,229 @@ +// SPDX-License-Identifier: LicenseRef-Commercial + + +
+
Accounts
+ + {#if loading} +
Loading accounts...
+ {:else if error} +
{error}
+ {:else if accounts.length === 0} +
No accounts configured.
+ {:else} +
+ {#each accounts as account (account.id)} + + {/each} +
+ {/if} +
+ + diff --git a/src/lib/commercial/AnalyticsDashboard.svelte b/src/lib/commercial/AnalyticsDashboard.svelte new file mode 100644 index 0000000..6923ff3 --- /dev/null +++ b/src/lib/commercial/AnalyticsDashboard.svelte @@ -0,0 +1,303 @@ +// SPDX-License-Identifier: LicenseRef-Commercial + + +
+
+ {#each PERIODS as p} + + {/each} +
+ + {#if loading} +
Loading analytics...
+ {:else if error} +
{error}
+ {:else if summary} +
+
+ Total Cost + ${fmt(summary.totalCostUsd)} +
+
+ Sessions + {summary.totalSessions} +
+
+ Avg $/Session + ${fmt(summary.avgCostPerSession)} +
+
+ Total Tokens + {fmtK(summary.totalTokens)} +
+
+ + {#if daily.length > 0} +
Daily Cost
+
+ + {#each daily as d, i} + {@const h = Math.max((d.costUsd / maxDailyCost) * 90, 1)} + + {/each} + +
+ {#each daily as d, i} + {#if i === 0 || i === daily.length - 1 || i === Math.floor(daily.length / 2)} + {d.date.slice(5)} + {/if} + {/each} +
+
+ {/if} + + {#if models.length > 0} +
Model Breakdown
+ + + + + + + + + + + {#each models as m} + + + + + + + {/each} + +
ModelSessionsCostTokens
{m.model}{m.sessionCount}${fmt(m.totalCostUsd)}{fmtK(m.totalTokens)}
+ {/if} + {/if} +
+ + diff --git a/src/lib/commercial/SessionExporter.svelte b/src/lib/commercial/SessionExporter.svelte new file mode 100644 index 0000000..b8b6cc2 --- /dev/null +++ b/src/lib/commercial/SessionExporter.svelte @@ -0,0 +1,206 @@ +// SPDX-License-Identifier: LicenseRef-Commercial + + +
+
+ + +
+ + {#if mode === 'project'} +
+ {#each SUMMARY_PERIODS as p} + + {/each} +
+ {/if} + +
+ + {#if markdown} + + {/if} +
+ + {#if error} +
{error}
+ {/if} + + {#if markdown} +
{markdown}
+ {/if} +
+ +