feat: Breakdown 前端接收后台执行 ID

This commit is contained in:
GouJ committed 2026-09-26 20:05:39 +08:00
1 parent 9cd01eeec4
commit 3b7ef23774
1 file changed
+11 -5
+11 -5
View File
@@ -1,5 +1,6 @@
import { optionalResource, request } from '../../lib/http'
import type { BreakdownAction, BreakdownInput, BreakdownPreview, BreakdownState } from './types'
import type { WorkflowExecutionStart } from '../workflows/execution.types'
/** Breakdown API;预览为 GET,启动和恢复为等待完成的长 POST。 */
export const breakdownApi = {
@@ -10,9 +11,14 @@ export const breakdownApi = {
latest: (id: string, signal?: AbortSignal) =>
optionalResource(request<BreakdownState>(`/projects/${encodeURIComponent(id)}/breakdown/latest`, { signal })),
run: (id: string, action: BreakdownAction, input?: BreakdownInput) =>
request<BreakdownState>(`/projects/${encodeURIComponent(id)}/breakdown/${action}`, {
method: 'POST',
body: input,
timeoutMs: 0
})
action === 'start'
? request<WorkflowExecutionStart>(`/projects/${encodeURIComponent(id)}/breakdown/start`, {
method: 'POST',
body: input
})
: request<BreakdownState>(`/projects/${encodeURIComponent(id)}/breakdown/${action}`, {
method: 'POST',
body: input,
timeoutMs: 0
})
}