mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-26 04:06:12 +01:00
* 📦 chore: bump librechat-data-provider version to 0.7.89 * 🐛 fix: Assistants endpoint handling in createPayload function
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import type * as t from './types';
|
|
import { EndpointURLs } from './config';
|
|
import * as s from './schemas';
|
|
|
|
export default function createPayload(submission: t.TSubmission) {
|
|
const {
|
|
conversation,
|
|
userMessage,
|
|
endpointOption,
|
|
isEdited,
|
|
isContinued,
|
|
isTemporary,
|
|
ephemeralAgent,
|
|
} = submission;
|
|
const { conversationId } = s.tConvoUpdateSchema.parse(conversation);
|
|
const { endpoint: _e, endpointType } = endpointOption as {
|
|
endpoint: s.EModelEndpoint;
|
|
endpointType?: s.EModelEndpoint;
|
|
};
|
|
|
|
const endpoint = _e as s.EModelEndpoint;
|
|
let server = `${EndpointURLs[s.EModelEndpoint.agents]}/${endpoint}`;
|
|
if (s.isAssistantsEndpoint(endpoint)) {
|
|
server =
|
|
EndpointURLs[(endpointType ?? endpoint) as 'assistants' | 'azureAssistants'] +
|
|
(isEdited ? '/modify' : '');
|
|
}
|
|
|
|
const payload: t.TPayload = {
|
|
...userMessage,
|
|
...endpointOption,
|
|
endpoint,
|
|
ephemeralAgent: s.isAssistantsEndpoint(endpoint) ? undefined : ephemeralAgent,
|
|
isContinued: !!(isEdited && isContinued),
|
|
conversationId,
|
|
isTemporary,
|
|
};
|
|
|
|
return { server, payload };
|
|
}
|