mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 18:08:07 +08:00
feat: add a stop run button to the published app UI (#27509)
Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com>
This commit is contained in:
@ -78,18 +78,19 @@ export const stopChatMessageResponding = async (appId: string, taskId: string, i
|
||||
return getAction('post', isInstalledApp)(getUrl(`chat-messages/${taskId}/stop`, isInstalledApp, installedAppId))
|
||||
}
|
||||
|
||||
export const sendCompletionMessage = async (body: Record<string, any>, { onData, onCompleted, onError, onMessageReplace }: {
|
||||
export const sendCompletionMessage = async (body: Record<string, any>, { onData, onCompleted, onError, onMessageReplace, getAbortController }: {
|
||||
onData: IOnData
|
||||
onCompleted: IOnCompleted
|
||||
onError: IOnError
|
||||
onMessageReplace: IOnMessageReplace
|
||||
getAbortController?: (abortController: AbortController) => void
|
||||
}, isInstalledApp: boolean, installedAppId = '') => {
|
||||
return ssePost(getUrl('completion-messages', isInstalledApp, installedAppId), {
|
||||
body: {
|
||||
...body,
|
||||
response_mode: 'streaming',
|
||||
},
|
||||
}, { onData, onCompleted, isPublicAPI: !isInstalledApp, onError, onMessageReplace })
|
||||
}, { onData, onCompleted, isPublicAPI: !isInstalledApp, onError, onMessageReplace, getAbortController })
|
||||
}
|
||||
|
||||
export const sendWorkflowMessage = async (
|
||||
@ -146,6 +147,12 @@ export const sendWorkflowMessage = async (
|
||||
})
|
||||
}
|
||||
|
||||
export const stopWorkflowMessage = async (_appId: string, taskId: string, isInstalledApp: boolean, installedAppId = '') => {
|
||||
if (!taskId)
|
||||
return
|
||||
return getAction('post', isInstalledApp)(getUrl(`workflows/tasks/${taskId}/stop`, isInstalledApp, installedAppId))
|
||||
}
|
||||
|
||||
export const fetchAppInfo = async () => {
|
||||
return get('/site') as Promise<AppData>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user