mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
Move data provider to shared package (#582)
* create data-provider package and move code from data-provider folder to be shared between apps * fix type issues * add packages to ignore * add new data-provider package to apps * refactor: change client imports to use @librechat/data-provider package * include data-provider build script in frontend build * fix type issue after rebasing * delete admin/package.json from this branch * update test ci script to include building of data-provider package * Try using regular build for test action * Switch frontend-review back to build:ci * Remove loginRedirect from Login.tsx * Add ChatGPT back to EModelEndpoint
This commit is contained in:
parent
d0078d478d
commit
04e4259005
48 changed files with 1472 additions and 141 deletions
27
packages/data-provider/src/createPayload.ts
Normal file
27
packages/data-provider/src/createPayload.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
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'
|
||||
};
|
||||
|
||||
const server = endpointUrlMap[endpoint];
|
||||
|
||||
const payload = {
|
||||
...message,
|
||||
...endpointOption,
|
||||
conversationId
|
||||
};
|
||||
|
||||
return { server, payload };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue