v0.2.20 : corrige le tok/s de decode qui retombait à 0 en fin de génération (timings llama.cpp sur le chunk final sans choices, lus avant le garde)

This commit is contained in:
nathaninline committed 2026-07-10 11:30:49 +02:00
1 parent 18b8903603
commit e16c43715e
5 files changed
+18 -16

No files matched your search

+14 -12
View File
@@ -478,8 +478,20 @@ func runChat(ctx context.Context, messages []Message, temperature float64, caps
if err := json.Unmarshal([]byte(data), &chunk); err != nil {
continue
}
// Le chunk d'usage (include_usage) arrive seul, sans choices : on l'émet
// avant le guard pour ne pas le perdre.
// Timings ET usage (include_usage) arrivent sur le CHUNK FINAL qui, sur ce
// build llama.cpp (MTP/spéculatif), a `choices:[]` — on les traite AVANT le
// garde de choices, sinon `gen_tokens`/`gen_per_second` (decode) sont jetés
// et l'UI retombe à « 0 tok/s » à la fin de la génération.
if chunk.Timings != nil {
stats.PromptTokens = chunk.Timings.PromptN
stats.PromptPerSecond = chunk.Timings.PromptPerSecond
stats.PromptMs = chunk.Timings.PromptMs
stats.GenTokens = chunk.Timings.PredictedN
stats.GenPerSecond = chunk.Timings.PredictedPerSec
stats.GenMs = chunk.Timings.PredictedMs
s := stats
cb(StreamEvent{Stats: &s})
}
if chunk.Usage != nil && chunk.Usage.PromptTokens > 0 {
stats.PromptTokensTotal = chunk.Usage.PromptTokens
s := stats
@@ -492,16 +504,6 @@ func runChat(ctx context.Context, messages []Message, temperature float64, caps
if ch.FinishReason != "" {
finishReason = ch.FinishReason
}
if chunk.Timings != nil {
stats.PromptTokens = chunk.Timings.PromptN
stats.PromptPerSecond = chunk.Timings.PromptPerSecond
stats.PromptMs = chunk.Timings.PromptMs
stats.GenTokens = chunk.Timings.PredictedN
stats.GenPerSecond = chunk.Timings.PredictedPerSec
stats.GenMs = chunk.Timings.PredictedMs
s := stats
cb(StreamEvent{Stats: &s})
}
if len(ch.Delta.ToolCalls) > 0 {
for i, tc := range ch.Delta.ToolCalls {
// llama.cpp's stream may omit index; fall back to slot i.
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"strings"
)
const Version = "0.2.19"
const Version = "0.2.20"
func main() {
// Migration one-shot des anciens skills (SKILLS/<nom>/SKILL.md) vers la
Binary file not shown.
Binary file not shown.
+3 -3
View File
@@ -3,13 +3,13 @@
"FileVersion": {
"Major": 0,
"Minor": 2,
"Patch": 19,
"Patch": 20,
"Build": 0
},
"ProductVersion": {
"Major": 0,
"Minor": 2,
"Patch": 19,
"Patch": 20,
"Build": 0
},
"FileFlagsMask": "3f",
@@ -25,7 +25,7 @@
"LegalCopyright": "Copyright (c) 2026 Jean contributors. MIT License.",
"OriginalFilename": "jean.exe",
"ProductName": "Jean",
"ProductVersion": "0.2.19",
"ProductVersion": "0.2.20",
"Comments": "https://github.com/nathaninline/jean — projet open source (MIT)"
},
"VarFileInfo": {