add: batch running function

This commit is contained in:
swugi 2026-01-13 23:47:54 +08:00
parent c4d6dd4aec
commit 6eef2e651c
6 changed files with 3107 additions and 318 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5,8 +5,8 @@ import Sidebar from './components/Sidebar.vue'
const route = useRoute()
// Hide the sidebar on LaunchView
const showSidebar = computed(() => route.path !== '/launch')
// Hide the sidebar on LaunchView, BatchRunView and WorkflowWorkbench
const showSidebar = computed(() => route.path !== '/launch' && route.path !== '/batch-run')
</script>
<template>

View File

@ -9,6 +9,7 @@
:class="{ active: isWorkflowsActive }"
>Workflows</router-link>
<router-link to="/launch" target="_blank" rel="noopener">Launch</router-link>
<router-link to="/batch-run" target="_blank" rel="noopener">Labaratory</router-link>
</nav>
<div class="sidebar-actions">
<button class="settings-nav-btn" @click="showSettingsModal = true" title="Settings">

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,10 @@ const routes = [
path: '/launch',
component: () => import('../pages/LaunchView.vue')
},
{
path: '/batch-run',
component: () => import('../pages/BatchRunView.vue')
},
{
path: '/workflows/:name?',
component: () => import('../pages/WorkflowWorkbench.vue')

View File

@ -424,6 +424,58 @@ export async function getAttachment(sessionId, attachmentId) {
}
}
// Batch workflow execution
export async function postBatchWorkflow({ file, sessionId, yamlFile, maxParallel, logLevel }) {
try {
const formData = new FormData()
// Append required parameters
if (file) {
formData.append('file', file)
}
if (sessionId) {
formData.append('session_id', sessionId)
}
if (yamlFile) {
formData.append('yaml_file', yamlFile)
}
if (maxParallel !== undefined) {
formData.append('max_parallel', maxParallel.toString())
}
if (logLevel) {
formData.append('log_level', logLevel)
}
const response = await fetch(apiUrl('/api/workflows/batch'), {
method: 'POST',
body: formData
})
const data = await response.json().catch(() => ({}))
if (response.ok) {
return {
success: true,
message: data?.message || 'Batch workflow executed successfully',
...data
}
}
return {
success: false,
detail: data?.detail,
message: data?.message || 'Failed to execute batch workflow',
status: response.status
}
} catch (error) {
console.error('Error executing batch workflow:', error)
return {
success: false,
message: 'API error'
}
}
}
// Upload a binary file
export async function postFile(sessionId, file) {
try {