mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 11:26:52 +08:00
Feat/auto rule generate (#300)
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import { ssePost, get, IOnData, IOnCompleted, IOnError } from './base'
|
||||
import type { IOnCompleted, IOnData, IOnError } from './base'
|
||||
import { get, post, ssePost } from './base'
|
||||
|
||||
export const sendChatMessage = async (appId: string, body: Record<string, any>, { onData, onCompleted, onError, getAbortController }: {
|
||||
onData: IOnData
|
||||
onCompleted: IOnCompleted
|
||||
onError: IOnError,
|
||||
onError: IOnError
|
||||
getAbortController?: (abortController: AbortController) => void
|
||||
}) => {
|
||||
return ssePost(`apps/${appId}/chat-messages`, {
|
||||
body: {
|
||||
...body,
|
||||
response_mode: 'streaming'
|
||||
}
|
||||
response_mode: 'streaming',
|
||||
},
|
||||
}, { onData, onCompleted, onError, getAbortController })
|
||||
}
|
||||
|
||||
@@ -22,8 +23,8 @@ export const sendCompletionMessage = async (appId: string, body: Record<string,
|
||||
return ssePost(`apps/${appId}/completion-messages`, {
|
||||
body: {
|
||||
...body,
|
||||
response_mode: 'streaming'
|
||||
}
|
||||
response_mode: 'streaming',
|
||||
},
|
||||
}, { onData, onCompleted, onError })
|
||||
}
|
||||
|
||||
@@ -34,7 +35,13 @@ export const fetchSuggestedQuestions = (appId: string, messageId: string) => {
|
||||
export const fetchConvesationMessages = (appId: string, conversation_id: string) => {
|
||||
return get(`apps/${appId}/chat-messages`, {
|
||||
params: {
|
||||
conversation_id
|
||||
}
|
||||
conversation_id,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export const generateRule = (body: Record<string, any>) => {
|
||||
return post('/rule-generate', {
|
||||
body,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user