mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2026-04-25 11:18:06 +00:00
add: batch running function
This commit is contained in:
parent
c4d6dd4aec
commit
6eef2e651c
800
frontend/package-lock.json
generated
800
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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>
|
||||
|
||||
@ -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">
|
||||
|
||||
2564
frontend/src/pages/BatchRunView.vue
Normal file
2564
frontend/src/pages/BatchRunView.vue
Normal file
File diff suppressed because it is too large
Load Diff
@ -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')
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user