feat: implement manual SDK session sync and fix UI crash
Some checks failed
Release Binaries / release (push) Has been cancelled
Some checks failed
Release Binaries / release (push) Has been cancelled
This commit is contained in:
@@ -1153,6 +1153,27 @@ async function loadMessages(instanceId: string, sessionId: string, force = false
|
||||
updateSessionInfo(instanceId, sessionId)
|
||||
}
|
||||
|
||||
async function syncSessionsFromSdk(instanceId: string): Promise<void> {
|
||||
const instance = instances().get(instanceId)
|
||||
if (!instance) throw new Error("Instance not ready")
|
||||
|
||||
const folderPath = instance.folder
|
||||
if (!folderPath) throw new Error("No folder path for instance")
|
||||
|
||||
log.info({ instanceId, folderPath }, "Manual SDK sync requested")
|
||||
|
||||
try {
|
||||
const result = await nativeSessionApi.syncFromSdk(instanceId, folderPath)
|
||||
log.info({ instanceId, result }, "Manual SDK sync result")
|
||||
|
||||
// Refresh sessions after sync
|
||||
await fetchSessions(instanceId)
|
||||
} catch (error) {
|
||||
log.error({ instanceId, error }, "Manual SDK sync failed")
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
createSession,
|
||||
deleteSession,
|
||||
@@ -1160,6 +1181,7 @@ export {
|
||||
fetchProviders,
|
||||
|
||||
fetchSessions,
|
||||
syncSessionsFromSdk,
|
||||
forkSession,
|
||||
loadMessages,
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
setActiveParentSession,
|
||||
setActiveSession,
|
||||
setSessionDraftPrompt,
|
||||
} from "./session-state"
|
||||
} from "./session-state"
|
||||
|
||||
import { getDefaultModel } from "./session-models"
|
||||
import {
|
||||
@@ -35,6 +35,7 @@ import {
|
||||
fetchAgents,
|
||||
fetchProviders,
|
||||
fetchSessions,
|
||||
syncSessionsFromSdk,
|
||||
forkSession,
|
||||
loadMessages,
|
||||
} from "./session-api"
|
||||
@@ -88,6 +89,7 @@ export {
|
||||
fetchAgents,
|
||||
fetchProviders,
|
||||
fetchSessions,
|
||||
syncSessionsFromSdk,
|
||||
forkSession,
|
||||
getActiveParentSession,
|
||||
getActiveSession,
|
||||
|
||||
Reference in New Issue
Block a user