mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-15 23:15:30 +01:00
Move createPayload and sse to data-provider, create TSubmission type
This commit is contained in:
parent
0fb9820110
commit
7b7ba96786
4 changed files with 38 additions and 19 deletions
24
client/src/data-provider/createPayload.ts
Normal file
24
client/src/data-provider/createPayload.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import type { TSubmission } from './types';
|
||||
|
||||
export default function createPayload(submission: TSubmission) {
|
||||
const { conversation, message, endpointOption } = submission;
|
||||
const { conversationId } = conversation;
|
||||
const { endpoint } = endpointOption;
|
||||
|
||||
const endpointUrlMap = {
|
||||
azureOpenAI: '/api/ask/azureOpenAI',
|
||||
openAI: '/api/ask/openAI',
|
||||
bingAI: '/api/ask/bingAI',
|
||||
chatGPTBrowser: '/api/ask/chatGPTBrowser'
|
||||
};
|
||||
|
||||
const server = endpointUrlMap[endpoint];
|
||||
|
||||
let payload = {
|
||||
...message,
|
||||
...endpointOption,
|
||||
conversationId
|
||||
};
|
||||
|
||||
return { server, payload };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue