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

Function electronStreamImport

apps/desktop/main/internal-api.ts:134–155  ·  view source on GitHub ↗
(dm: DatabaseManager, filePath: string)

Source from the content-addressed store, hash-verified

132 }
133
134 const electronStreamImport = async (dm: DatabaseManager, filePath: string) => {
135 const deps: StreamImportDeps = {
136 openDatabase(sessionId: string) {
137 return dm.openRawSessionDatabase(sessionId, { create: true, initializeChatTables: true })
138 },
139 deleteDatabase(sessionId: string) {
140 dm.deleteSessionDatabaseFiles(sessionId)
141 },
142 onProgress() {
143 /* no progress for merge-triggered import */
144 },
145 }
146 const result = await streamingImport(filePath, deps)
147 if (!result.sessionId) throw new Error('Import succeeded but no sessionId returned')
148 try {
149 raiseChatDbCompatibilityGate(pathProvider, runtime)
150 } catch (error) {
151 dm.deleteSessionDatabaseFiles(result.sessionId)
152 throw error
153 }
154 return { sessionId: result.sessionId }
155 }
156
157 const { shell } = await import('electron')
158 const { getDefaultUserDataDir, getUserDataDir, getDownloadsDir } = await import('./paths')

Callers

nothing calls this directly

Calls 3

streamingImportFunction · 0.90

Tested by

no test coverage detected