fix workflow outputs

This commit is contained in:
JzoNg
2024-03-19 12:33:42 +08:00
parent 978ee93df7
commit cf0c96e0d1
3 changed files with 33 additions and 23 deletions

View File

@ -1,4 +1,4 @@
import type { IOnCompleted, IOnData, IOnError, IOnFile, IOnMessageEnd, IOnMessageReplace, IOnTextChunk, IOnTextReplace, IOnThought, IOnWorkflowFinished, IOnWorkflowStarted } from './base'
import type { IOnCompleted, IOnData, IOnError, IOnFile, IOnMessageEnd, IOnMessageReplace, IOnNodeFinished, IOnNodeStarted, IOnThought, IOnWorkflowFinished, IOnWorkflowStarted } from './base'
import {
del as consoleDel, get as consoleGet, patch as consolePatch, post as consolePost,
delPublic as del, getPublic as get, patchPublic as patch, postPublic as post, ssePost,
@ -68,17 +68,15 @@ export const sendCompletionMessage = async (body: Record<string, any>, { onData,
export const sendWorkflowMessage = async (
body: Record<string, any>,
{
onTextChunk,
onWorkflowStarted,
onTextReplace,
onNodeStarted,
onNodeFinished,
onWorkflowFinished,
onError,
}: {
onTextChunk: IOnTextChunk
onWorkflowStarted: IOnWorkflowStarted
onNodeStarted: IOnNodeStarted
onNodeFinished: IOnNodeFinished
onWorkflowFinished: IOnWorkflowFinished
onTextReplace: IOnTextReplace
onError: IOnError
},
isInstalledApp: boolean,
installedAppId = '',
@ -88,7 +86,7 @@ export const sendWorkflowMessage = async (
...body,
response_mode: 'streaming',
},
}, { onTextChunk, onWorkflowStarted, onWorkflowFinished, isPublicAPI: !isInstalledApp, onError, onTextReplace })
}, { onNodeStarted, onWorkflowStarted, onWorkflowFinished, isPublicAPI: !isInstalledApp, onNodeFinished })
}
export const fetchAppInfo = async () => {