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).
This commit is contained in:
1 parent
8268bdecc2
commit
a471c026f1
2 files changed
+16
-2
No files matched your search
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "OpenChamber",
|
"name": "OpenChamber",
|
||||||
"id": "com.openchamber.native",
|
"id": "com.openchamber.native",
|
||||||
"version": "0.1.7",
|
"version": "0.1.8",
|
||||||
"build": 8,
|
"build": 9,
|
||||||
"orientations": ["portrait", "landscape"]
|
"orientations": ["portrait", "landscape"]
|
||||||
}
|
}
|
||||||
@@ -176,6 +176,20 @@ func (ch *chat) turnDuration(id string) string {
|
|||||||
break
|
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 {
|
if start <= 0 || msgs[idx].Time.Completed <= start {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user