()
| 230 | }) |
| 231 | |
| 232 | function duration() { |
| 233 | const completed = lastAssistantMessage()?.time.completed |
| 234 | const from = DateTime.fromMillis(message()!.time.created) |
| 235 | const to = completed ? DateTime.fromMillis(completed) : DateTime.now() |
| 236 | const interval = Interval.fromDateTimes(from, to) |
| 237 | const unit: DurationUnit[] = interval.length("seconds") > 60 ? ["minutes", "seconds"] : ["seconds"] |
| 238 | |
| 239 | return interval.toDuration(unit).normalize().toHuman({ |
| 240 | notation: "compact", |
| 241 | unitDisplay: "narrow", |
| 242 | compactDisplay: "short", |
| 243 | showZeros: false, |
| 244 | }) |
| 245 | } |
| 246 | |
| 247 | const [store, setStore] = createStore({ |
| 248 | status: rawStatus(), |
no test coverage detected