MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / getSession

Function getSession

apps/desktop/main/worker/query/sessions.ts:128–147  ·  view source on GitHub ↗
(sessionId: string)

Source from the content-addressed store, hash-verified

126 * 获取单个会话信息
127 */
128export function getSession(sessionId: string): any | null {
129 const db = openDatabase(sessionId)
130 if (!db) return null
131
132 const coreDb = asCoreDb(db)
133 const meta = getSessionMeta(coreDb)
134 if (!meta) return null
135
136 const overview = resolveOverview(db, sessionId, getCacheDir())
137 const info = buildSessionInfo(meta, overview)
138
139 return {
140 ...info,
141 id: sessionId,
142 dbPath: getDbPath(sessionId),
143 firstTimestamp: overview.firstMessageTs,
144 lastTimestamp: overview.lastMessageTs,
145 lastPlatformMessageId: getLastPlatformMessageId(coreDb),
146 }
147}
148
149/**
150 * 获取聊天概览(AI 工具使用)

Callers 1

dbWorker.tsFile · 0.90

Calls 8

openDatabaseFunction · 0.90
getSessionMetaFunction · 0.90
getCacheDirFunction · 0.90
buildSessionInfoFunction · 0.90
getDbPathFunction · 0.90
getLastPlatformMessageIdFunction · 0.90
asCoreDbFunction · 0.85
resolveOverviewFunction · 0.85

Tested by

no test coverage detected