| 401 | |
| 402 | // Fetch session attachments |
| 403 | export async function getAttachment(sessionId, attachmentId) { |
| 404 | try { |
| 405 | if (!sessionId) { |
| 406 | throw new Error('Missing session id') |
| 407 | } |
| 408 | if (!attachmentId) { |
| 409 | throw new Error('Missing attachment id') |
| 410 | } |
| 411 | |
| 412 | const response = await fetch(apiUrl(`/api/sessions/${encodeURIComponent(sessionId)}/artifacts/${encodeURIComponent(attachmentId)}`)) |
| 413 | |
| 414 | if (!response.ok) { |
| 415 | throw new Error(`Failed to fetch attachment: ${response.status} ${response.statusText}`) |
| 416 | } |
| 417 | |
| 418 | const data = await response.json() |
| 419 | return data?.data_uri |
| 420 | } catch (error) { |
| 421 | console.error('Failed to fetch attachment:', error) |
| 422 | throw error |
| 423 | } |
| 424 | } |
| 425 | |
| 426 | // Batch workflow execution |
| 427 | export async function postBatchWorkflow({ file, sessionId, yamlFile, maxParallel, logLevel }) { |