(sessionId: string)
| 152 | * 删除会话 |
| 153 | */ |
| 154 | export function deleteSession(sessionId: string): boolean { |
| 155 | const dbPath = getDbPath(sessionId) |
| 156 | const walPath = dbPath + '-wal' |
| 157 | const shmPath = dbPath + '-shm' |
| 158 | |
| 159 | try { |
| 160 | if (fs.existsSync(dbPath)) { |
| 161 | fs.unlinkSync(dbPath) |
| 162 | } |
| 163 | if (fs.existsSync(walPath)) { |
| 164 | fs.unlinkSync(walPath) |
| 165 | } |
| 166 | if (fs.existsSync(shmPath)) { |
| 167 | fs.unlinkSync(shmPath) |
| 168 | } |
| 169 | const cacheDir = getPathProvider().getCacheDir() |
| 170 | deleteSessionCache(sessionId, cacheDir) |
| 171 | deleteSessionCache(sessionId, path.join(cacheDir, 'query')) |
| 172 | deleteSessionCache(sessionId, contactsService.getContactsFactsCacheDir(getPathProvider().getUserDataDir())) |
| 173 | deleteSessionCache( |
| 174 | sessionId, |
| 175 | peopleRelationshipsService.getPeopleRelationshipsFactsCacheDir(getPathProvider().getUserDataDir()) |
| 176 | ) |
| 177 | return true |
| 178 | } catch (error) { |
| 179 | console.error('[Database] Failed to delete session:', error) |
| 180 | return false |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * 重命名会话 |
nothing calls this directly
no test coverage detected