-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathsendMessageQuery.ts
More file actions
31 lines (27 loc) · 899 Bytes
/
sendMessageQuery.ts
File metadata and controls
31 lines (27 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { MessageType } from '@/components/Bot'
import { sendRequest } from '@/utils/index'
export type IncomingInput = {
question: string
history: MessageType[]
overrideConfig?: Record<string, unknown>
socketIOClientId?: string
}
export type MessageRequest = {
chatflowid: string
apiHost?: string
body?: IncomingInput
authToken?: string
}
export const sendMessageQuery = ({ chatflowid, apiHost = 'http://localhost:3000', body, authToken }: MessageRequest) =>
sendRequest<any>({
method: 'POST',
url: `${apiHost}/api/v1/prediction/${chatflowid}`,
body,
authToken
})
export const isStreamAvailableQuery = ({ chatflowid, apiHost = 'http://localhost:3000', authToken }: MessageRequest) =>
sendRequest<any>({
method: 'GET',
url: `${apiHost}/api/v1/chatflows-streaming/${chatflowid}`,
authToken
})