diff --git a/frontend-web/src/components/workspace/agents/agent-card.tsx b/frontend-web/src/components/workspace/agents/agent-card.tsx index 21c710f4..cfd7e8c2 100644 --- a/frontend-web/src/components/workspace/agents/agent-card.tsx +++ b/frontend-web/src/components/workspace/agents/agent-card.tsx @@ -2,6 +2,7 @@ import { BotIcon, + ClockIcon, CopyIcon, EyeOffIcon, GlobeIcon, @@ -78,6 +79,7 @@ import type { Agent, AgentQuestion, UpdateAgentRequest } from "@/core/agents"; import { getStoredAuth } from "@/core/auth"; import { useI18n } from "@/core/i18n/hooks"; import { useSkills } from "@/core/skills/hooks"; +import { formatDateTime } from "@/core/utils/datetime"; import { desensitize } from "@/lib/desensitize"; import { cn } from "@/lib/utils"; @@ -605,6 +607,17 @@ export function AgentCard({ agent, layout = "card", onPublisherClick }: AgentCar ) : null; + const createdAtText = formatDateTime(agent.created_at); + const createdAtNode = createdAtText ? ( +
+ + 创建时间:{createdAtText} +
+ ) : null; + // 技能英文名 → 中文名映射,用于把智能体的技能徽章显示为中文(agent.skills 只存英文名)。 const skillNameZhMap = useMemo(() => { const map = new Map(); @@ -820,6 +833,7 @@ export function AgentCard({ agent, layout = "card", onPublisherClick }: AgentCar )} {publisherNode &&
{publisherNode}
} + {createdAtNode &&
{createdAtNode}
} {(agent.tags?.length ?? 0) > 0 && ( @@ -866,6 +880,7 @@ export function AgentCard({ agent, layout = "card", onPublisherClick }: AgentCar

)} {publisherNode &&
{publisherNode}
} + {createdAtNode &&
{createdAtNode}
}
{showActionRow && actionButtons} diff --git a/frontend-web/src/components/workspace/settings/skill-settings-page.tsx b/frontend-web/src/components/workspace/settings/skill-settings-page.tsx index 916c83ca..9c16d7e9 100644 --- a/frontend-web/src/components/workspace/settings/skill-settings-page.tsx +++ b/frontend-web/src/components/workspace/settings/skill-settings-page.tsx @@ -86,6 +86,7 @@ import { } from "@/core/skills/hooks"; import { usePublishSquares, useViewMode } from "@/core/system-settings/hooks"; import type { Skill } from "@/core/skills/type"; +import { formatDateTime } from "@/core/utils/datetime"; import { env } from "@/env"; import { desensitize } from "@/lib/desensitize"; import { cn } from "@/lib/utils"; @@ -848,6 +849,14 @@ export function SkillRow({ : t.settings.skills.useCountInlineZero}
)} + {formatDateTime(skill.created_at) && ( +
+ + + 创建时间:{formatDateTime(skill.created_at)} + +
+ )} {(skill.tags?.length ?? 0) > 0 && ( )} diff --git a/frontend-web/src/core/utils/datetime.ts b/frontend-web/src/core/utils/datetime.ts index 3ec7203d..fea6af99 100644 --- a/frontend-web/src/core/utils/datetime.ts +++ b/frontend-web/src/core/utils/datetime.ts @@ -25,3 +25,18 @@ export function formatTimeAgo(date: Date | string | number, locale?: Locale) { locale: getDateFnsLocale(effectiveLocale), }); } + +/** + * Format a created/updated timestamp as `YYYY-MM-DD HH:mm`. + * Returns an empty string for missing or unparseable values. + */ +export function formatDateTime(value?: Date | string | number | null): string { + if (value === null || value === undefined || value === "") return ""; + const date = value instanceof Date ? value : new Date(value); + if (Number.isNaN(date.getTime())) return ""; + const pad = (n: number) => String(n).padStart(2, "0"); + return ( + `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())} ` + + `${pad(date.getHours())}:${pad(date.getMinutes())}` + ); +}