feat(api): /api/sessions 账号会话列表(好友+群,今日消息数+最近联系时间,全本地聚合)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-08 14:58:23 +08:00
parent 4cb6cf50c4
commit a418830a90
4 changed files with 190 additions and 1 deletions
+20 -1
View File
@@ -3,7 +3,7 @@
from __future__ import annotations
import datetime as dt
from typing import Any, Generic, TypeVar
from typing import Any, Generic, Literal, TypeVar
from pydantic import BaseModel, ConfigDict
@@ -325,3 +325,22 @@ class StaffChatStatsOut(BaseModel):
end: int # ms-epoch
summary: StaffChatStatsSummary
customers: list[StaffChatCustomerOut]
class SessionOut(BaseModel):
"""账号会话列表的一行(好友或群)。"""
type: Literal["friend", "group"]
talker_id: str | None = None
room_id: str | None = None
name: str | None = None
avatar: str | None = None
today_count: int
last_chat_time: int | None = None
class SessionListOut(BaseModel):
owner_account_id: str
channel: str
today_start: int
sessions: list[SessionOut]