(sessionId: string)
| 126 | * 获取单个会话信息 |
| 127 | */ |
| 128 | export 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 工具使用) |
no test coverage detected