Add automatic session migration when switching from SDK to Native mode
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:
@@ -165,6 +165,34 @@ export const nativeSessionApi = {
|
||||
return data.messages
|
||||
},
|
||||
|
||||
/**
|
||||
* Import sessions from SDK mode to Native mode
|
||||
*/
|
||||
async importSessions(workspaceId: string, sessions: Array<{
|
||||
id: string
|
||||
title?: string
|
||||
parentId?: string | null
|
||||
createdAt?: number
|
||||
updatedAt?: number
|
||||
model?: { providerId: string; modelId: string }
|
||||
agent?: string
|
||||
messages?: Array<{
|
||||
id: string
|
||||
role: "user" | "assistant" | "system" | "tool"
|
||||
content?: string
|
||||
createdAt?: number
|
||||
}>
|
||||
}>): Promise<{ success: boolean; imported: number; skipped: number }> {
|
||||
const response = await fetch(`${CODENOMAD_API_BASE}/api/native/workspaces/${encodeURIComponent(workspaceId)}/sessions/import`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ sessions })
|
||||
})
|
||||
if (!response.ok) throw new Error("Failed to import sessions")
|
||||
return response.json()
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Send a prompt to the session and get a streaming response
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user