mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-30 23:28:52 +01:00
24 lines
597 B
TypeScript
24 lines
597 B
TypeScript
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 };
|
|
}
|