feat(chat): getSessions + ChatSidebar 会话列表组件

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-08 15:13:30 +08:00
parent a418830a90
commit 394bfa8a7c
3 changed files with 132 additions and 0 deletions
+18
View File
@@ -15,6 +15,7 @@ import type {
Message,
Page,
PhoneCall,
SessionList,
Sms,
Staff,
StaffChatStats,
@@ -238,6 +239,22 @@ export function getStaffChatStats(query: StaffChatStatsQuery): Promise<StaffChat
)
}
// ---------------------------------------------------------------------------
// Chat sessions (账号会话列表:好友+群,今日消息数+最近联系时间)
// ---------------------------------------------------------------------------
export interface SessionQuery {
owner_account_id: string
channel?: Channel
}
export function getSessions(query: SessionQuery): Promise<SessionList> {
return getJson<SessionList>(
'/sessions',
clean({ owner_account_id: query.owner_account_id, channel: query.channel }),
)
}
// ---------------------------------------------------------------------------
// Sync monitor
// ---------------------------------------------------------------------------
@@ -300,6 +317,7 @@ export type {
Message,
Page,
PhoneCall,
SessionList,
Sms,
Staff,
StaffChatStats,
+18
View File
@@ -277,3 +277,21 @@ export interface StaffChatStats {
summary: StaffChatStatsSummary
customers: StaffChatCustomer[]
}
/** 账号会话列表一行(好友或群),镜像 backend SessionOut。 */
export interface ChatSession {
type: 'friend' | 'group'
talker_id?: string | null
room_id?: string | null
name?: string | null
avatar?: string | null
today_count: number
last_chat_time?: number | null
}
export interface SessionList {
owner_account_id: string
channel: string
today_start: number
sessions: ChatSession[]
}