import Link from "next/link"; import { BindDeviceForm } from "@/components/dashboard-actions"; import { PanelShell } from "@/components/panel-shell"; import { PwaControls } from "@/components/pwa-controls"; import { getCaregiverDevices } from "@/lib/caregiver-panel"; import { formatDateTime, getDeviceName, truncateText } from "@/lib/panel-format"; import { requireCaregiverSession } from "@/lib/page-auth"; export const dynamic = "force-dynamic"; export default async function DevicesPage() { const caregiver = await requireCaregiverSession("/devices"); const devices = await getCaregiverDevices(caregiver.id); return ( } >

设备入口说明

一台设备一个详情页

1. 先通过扫码或粘贴设备码建立连接。

2. 进入设备详情页给这位老人写留言,不再在首页里混排。

3. 每台设备都有自己的最近留言、对话片段和工具调用摘要。

打开扫码页 去留言中心
{devices.length === 0 ? (

还没有绑定设备

等待绑定成功后,每台设备都会在这里生成自己的专属入口,后续写留言和查看状态都从设备详情页进入。

) : (
{devices.map((binding) => { const latestMessage = binding.elderDevice.messages[0]; return (

设备详情

{getDeviceName(binding.elderDevice.displayName)}

最近在线:{formatDateTime(binding.elderDevice.lastSeenAt)} 老人新留言 {binding.elderUnreadCount} 待老人查看 {binding.familyUnreadCount}

留言总数

{binding.elderDevice._count.messages}

对话条数

{binding.elderDevice._count.conversationTurns}

工具调用

{binding.elderDevice._count.toolCalls}

最近一条动态

{latestMessage ? truncateText(latestMessage.content, 96) : "这台设备还没有同步到新的留言或问候。"}

打开设备页 去留言中心
); })}
)}
); }