mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-08 22:48:25 -05:00
bring tinychat more inline with tinyos' version (#5358)
This commit is contained in:
25
examples/tinychat/favicon.svg
Normal file
25
examples/tinychat/favicon.svg
Normal file
@@ -0,0 +1,25 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-10 -10 150 70" shape-rendering="crispEdges">
|
||||
<g id="logo">
|
||||
<!-- t -->
|
||||
<polygon points="10,40 10,20 0,20 0,10 10,10 10,0 20,0 20,10 30,10 30,20 20,20 20,30 30,30 30,40" />
|
||||
<!-- i -->
|
||||
<polygon points="40,40 40,20 50,20 50,40" />
|
||||
<polygon points="40,10 40,0 50,0 50,10" />
|
||||
<!-- n -->
|
||||
<polygon points="60,40 60,10 80,10 80,40 90,40 90,20 70,20 70,40" />
|
||||
<!-- y -->
|
||||
<polygon points="100,50 100,40 130,40 130,10 120,10 120,20 110,20 110,10 100,10 100,30 120,30 120,50" />
|
||||
</g>
|
||||
<style>
|
||||
@media (prefers-color-scheme: dark) {
|
||||
#logo {
|
||||
fill: #fff;
|
||||
}
|
||||
}
|
||||
@media (prefers-color-scheme: light) {
|
||||
#logo {
|
||||
fill: #000;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 750 B |
@@ -47,7 +47,8 @@ main {
|
||||
|
||||
.title {
|
||||
font-size: 3rem;
|
||||
margin: 3rem 0;
|
||||
margin: 1rem 0;
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
.histories-container-container {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<title>tinychat</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" href="favicon.svg" type="image/svg+xml">
|
||||
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/@alpine-collective/toolkit@1.0.2/dist/cdn.min.js"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/intersect@3.x.x/dist/cdn.min.js"></script>
|
||||
|
||||
@@ -74,7 +74,7 @@ document.addEventListener("alpine:init", () => {
|
||||
start_time = Date.now();
|
||||
this.time_till_first = start_time - prefill_start;
|
||||
} else {
|
||||
const diff = Date.now() - start_time
|
||||
const diff = Date.now() - start_time;
|
||||
if (diff > 0) {
|
||||
this.tokens_per_second = tokens / (diff / 1000);
|
||||
}
|
||||
@@ -108,10 +108,10 @@ document.addEventListener("alpine:init", () => {
|
||||
|
||||
updateTotalTokens(messages) {
|
||||
fetch(`${this.endpoint}/chat/token/encode`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ messages })
|
||||
}).then(response => response.json()).then(data => {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ messages }),
|
||||
}).then((response) => response.json()).then((data) => {
|
||||
this.total_tokens = data.length;
|
||||
}).catch(console.error);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user