import Link from "next/link"; import { PanelShell } from "@/components/panel-shell"; import { getCaregiverActivity } from "@/lib/caregiver-panel"; import { formatDateTime, getConversationRoleLabel, getDeviceName, getUsageLabel, truncateText } from "@/lib/panel-format"; import { requireCaregiverSession } from "@/lib/page-auth"; import { getCaregiverDisplayName } from "@/lib/session"; export const dynamic = "force-dynamic"; export default async function ActivityPage({ searchParams }: PageProps<"/activity">) { const caregiver = await requireCaregiverSession("/activity"); const { usageEvents, conversationTurns, toolCalls } = await getCaregiverActivity(caregiver.id); const rawTab = (await searchParams).tab; const tab = rawTab === "chat" || rawTab === "tool" ? rawTab : "usage"; const rows = tab === "usage" ? usageEvents.map((item) => ({ id: item.id, top: getDeviceName(item.elderDevice.displayName), time: formatDateTime(item.createdAt), body: getUsageLabel(item.eventType) })) : tab === "chat" ? conversationTurns.map((item) => ({ id: item.id, top: getConversationRoleLabel(item.role), time: formatDateTime(item.createdAt), body: truncateText(item.content, 180) })) : toolCalls.map((item) => ({ id: item.id, top: item.toolName, time: formatDateTime(item.createdAt), body: truncateText(item.outputText || item.argumentsJson, 180) })); return (
使用 对话 智能服务
{rows.length ? rows.map((row) => (
{row.top}{row.time}

{row.body}

)) :
这个分类暂时还没有动态。
}

「智能服务」记录数字人助理自主调用的工具,包括照护知识查询与双向留言等。

); }