mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
chore: add back data-provider
This commit is contained in:
parent
488b373695
commit
77a76f8511
16 changed files with 1323 additions and 1 deletions
28
packages/data-provider/src/createPayload.ts
Normal file
28
packages/data-provider/src/createPayload.ts
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import type { TConversation, TSubmission, EModelEndpoint } from './types';
|
||||
|
||||
export default function createPayload(submission: TSubmission) {
|
||||
const { conversation, message, endpointOption } = submission;
|
||||
const { conversationId } = conversation as TConversation;
|
||||
const { endpoint } = endpointOption as { endpoint: EModelEndpoint };
|
||||
|
||||
const endpointUrlMap = {
|
||||
azureOpenAI: '/api/ask/azureOpenAI',
|
||||
openAI: '/api/ask/openAI',
|
||||
google: '/api/ask/google',
|
||||
bingAI: '/api/ask/bingAI',
|
||||
chatGPT: '/api/ask/chatGPT',
|
||||
chatGPTBrowser: '/api/ask/chatGPTBrowser',
|
||||
gptPlugins: '/api/ask/gptPlugins',
|
||||
anthropic: '/api/ask/anthropic',
|
||||
};
|
||||
|
||||
const server = endpointUrlMap[endpoint];
|
||||
|
||||
const payload = {
|
||||
...message,
|
||||
...endpointOption,
|
||||
conversationId,
|
||||
};
|
||||
|
||||
return { server, payload };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue