From a471c026f1c3e13766f755ed950ea0dbe94243ab Mon Sep 17 00:00:00 2001 From: Wang Zichong Date: Mon, 16 Nov 2026 18:19:27 +0800 Subject: [PATCH] fix: measure a turn's duration when its prompt is not loaded A long turn's prompt can fall before the loaded message page. Measure from the first record of the run then, so historical turns still show a duration in the footer. Bump version to 0.1.8 (build 9). --- asuka.json | 4 ++-- internal/appui/chat.go | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/asuka.json b/asuka.json index 36b0c2a..efc0028 100644 --- a/asuka.json +++ b/asuka.json @@ -1,7 +1,7 @@ { "name": "OpenChamber", "id": "com.openchamber.native", - "version": "0.1.7", - "build": 8, + "version": "0.1.8", + "build": 9, "orientations": ["portrait", "landscape"] } diff --git a/internal/appui/chat.go b/internal/appui/chat.go index cbcf0a6..0e43b03 100644 --- a/internal/appui/chat.go +++ b/internal/appui/chat.go @@ -176,6 +176,20 @@ func (ch *chat) turnDuration(id string) string { break } } + if start <= 0 { + // The prompt fell outside the loaded page (a long turn). Measure + // from the first record of this run instead, so historical turns + // still show a duration. + j := idx + for j > 0 { + prev := msgs[j-1].Type + if prev == "user" || prev == "synthetic" { + break + } + j-- + } + start = msgs[j].Time.Created + } if start <= 0 || msgs[idx].Time.Completed <= start { return "" }