Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: token speed

Louis52c02aa9ca43
diff --git a/web-app/src/lib/custom-chat-transport.ts b/web-app/src/lib/custom-chat-transport.ts
index 89e288814..47a6b0610 100644
--- a/web-app/src/lib/custom-chat-transport.ts
+++ b/web-app/src/lib/custom-chat-transport.ts
@@ -252,11 +252,11 @@ export class CustomChatTransport implements ChatTransport<UIMessage> {
return result.toUIMessageStream({
messageMetadata: ({ part }) => {
+ if (!streamStartTime) {
+ streamStartTime = Date.now()
+ }
// Track stream start time on first text delta
if (part.type === 'text-delta') {
- if (!streamStartTime) {
- streamStartTime = Date.now()
- }
// Count text deltas as a rough token approximation
// Each delta typically represents one token in streaming
textDeltaCount++