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

Function addImportSessions

src/stores/apiServer.ts:394–411  ·  view source on GitHub ↗
(sourceId: string, sessions: Array<{ name: string; remoteSessionId: string }>)

Source from the content-addressed store, hash-verified

392 // ==================== 导入会话管理 ====================
393
394 async function addImportSessions(sourceId: string, sessions: Array<{ name: string; remoteSessionId: string }>) {
395 try {
396 const added = await transport.addImportSessions(sourceId, sessions)
397 await fetchDataSources()
398 if (added.length > 0) {
399 for (const s of added) pullingIds.value.add(s.id)
400 pullingIds.value = new Set(pullingIds.value)
401 pollDataSourceUpdates(
402 sourceId,
403 added.map((s) => s.id)
404 )
405 }
406 return added
407 } catch (err) {
408 console.error('[ApiServerStore] Failed to add import sessions:', err)
409 return []
410 }
411 }
412
413 function pollDataSourceUpdates(sourceId: string, sessionIds: string[], maxAttempts = 24, intervalMs = 5000) {
414 let attempt = 0

Callers

nothing calls this directly

Calls 5

fetchDataSourcesFunction · 0.85
pollDataSourceUpdatesFunction · 0.85
addImportSessionsMethod · 0.80
errorMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected