mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 18:38:28 +00:00
Centralize date/time formatting utilities (#11831)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { GatewayStatusSummary } from "./tui-types.js";
|
||||
import { formatAge } from "../infra/channel-summary.js";
|
||||
import { formatTimeAgo } from "../infra/format-time/format-relative.ts";
|
||||
import { formatTokenCount } from "../utils/usage-format.js";
|
||||
import { formatContextUsageLine } from "./tui-formatters.js";
|
||||
|
||||
@@ -14,7 +14,7 @@ export function formatStatusSummary(summary: GatewayStatusSummary) {
|
||||
const linked = summary.linkChannel.linked === true;
|
||||
const authAge =
|
||||
linked && typeof summary.linkChannel.authAgeMs === "number"
|
||||
? ` (last refreshed ${formatAge(summary.linkChannel.authAgeMs)})`
|
||||
? ` (last refreshed ${formatTimeAgo(summary.linkChannel.authAgeMs)})`
|
||||
: "";
|
||||
lines.push(`${linkLabel}: ${linked ? "linked" : "not linked"}${authAge}`);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export function formatStatusSummary(summary: GatewayStatusSummary) {
|
||||
if (recent.length > 0) {
|
||||
lines.push("Recent sessions:");
|
||||
for (const entry of recent) {
|
||||
const ageLabel = typeof entry.age === "number" ? formatAge(entry.age) : "no activity";
|
||||
const ageLabel = typeof entry.age === "number" ? formatTimeAgo(entry.age) : "no activity";
|
||||
const model = entry.model ?? "unknown";
|
||||
const usage = formatContextUsageLine({
|
||||
total: entry.totalTokens ?? null,
|
||||
|
||||
Reference in New Issue
Block a user