diff --git a/README.md b/README.md
index 1df2798..aa168b9 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,6 @@ whiskr is a private, self-hosted web chat interface for interacting with AI mode
## TODO
-- total cost tracker
- settings
- auto-retry on edit
- ctrl+enter vs enter for sending
diff --git a/static/css/chat.css b/static/css/chat.css
index 8045261..03d7840 100644
--- a/static/css/chat.css
+++ b/static/css/chat.css
@@ -73,29 +73,26 @@ body.resizing * {
cursor: grabbing !important;
}
+#total,
#version {
position: absolute;
font-size: 12px;
font-style: italic;
top: 3px;
- right: 6px;
+ right: 4px;
color: #a5adcb;
}
+#total {
+ right: unset;
+ left: 4px;
+}
+
#version a {
color: #a5adcb;
text-decoration: none;
}
-body.loading #version {
- font-size: 0;
- animation: rotating 1.2s linear infinite;
- background-image: url(icons/spinner.svg);
- width: 16px;
- height: 16px;
- top: 6px;
-}
-
#loading {
position: absolute;
top: 0;
diff --git a/static/index.html b/static/index.html
index 7162e51..c229a66 100644
--- a/static/index.html
+++ b/static/index.html
@@ -16,6 +16,7 @@
diff --git a/static/js/chat.js b/static/js/chat.js
index 219fd3f..1ce5215 100644
--- a/static/js/chat.js
+++ b/static/js/chat.js
@@ -1,5 +1,6 @@
(() => {
const $version = document.getElementById("version"),
+ $total = document.getElementById("total"),
$messages = document.getElementById("messages"),
$chat = document.getElementById("chat"),
$message = document.getElementById("message"),
@@ -41,7 +42,14 @@
let searchAvailable = false,
activeMessage = null,
isResizing = false,
- scrollResize = false;
+ scrollResize = false,
+ totalCost = 0;
+
+ function updateTotalCost() {
+ storeValue("total-cost", totalCost);
+
+ $total.textContent = formatMoney(totalCost);
+ }
function updateScrollButton() {
const bottom = $messages.scrollHeight - ($messages.scrollTop + $messages.offsetHeight);
@@ -448,8 +456,7 @@
if (this.#statistics) {
const { provider, model, ttft, time, input, output, cost } = this.#statistics;
- const tps = output / (time / 1000),
- price = cost < 1 ? `${fixed(cost * 100, 1)}ct` : `$${fixed(cost, 2)}`;
+ const tps = output / (time / 1000);
html = [
provider ? `
${provider} (${model.split("/").pop()})
` : "",
@@ -462,7 +469,7 @@
=
${input + output}t
`,
- `