mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-03-01 13:50:19 +01:00
refactor(createPayload): streamline all endpoints to agent route
This commit is contained in:
parent
2797aff423
commit
7ad3ef7c23
1 changed files with 3 additions and 6 deletions
|
|
@ -13,20 +13,17 @@ export default function createPayload(submission: t.TSubmission) {
|
||||||
ephemeralAgent,
|
ephemeralAgent,
|
||||||
} = submission;
|
} = submission;
|
||||||
const { conversationId } = s.tConvoUpdateSchema.parse(conversation);
|
const { conversationId } = s.tConvoUpdateSchema.parse(conversation);
|
||||||
const { endpoint: _e, endpointType } = endpointOption as {
|
const { endpoint: _e } = endpointOption as {
|
||||||
endpoint: s.EModelEndpoint;
|
endpoint: s.EModelEndpoint;
|
||||||
endpointType?: s.EModelEndpoint;
|
endpointType?: s.EModelEndpoint;
|
||||||
};
|
};
|
||||||
|
|
||||||
const endpoint = _e as s.EModelEndpoint;
|
const endpoint = _e as s.EModelEndpoint;
|
||||||
let server = EndpointURLs[endpointType ?? endpoint];
|
let server = `${EndpointURLs[s.EModelEndpoint.agents]}/${endpoint}`;
|
||||||
const isEphemeral = s.isEphemeralAgent(endpoint, ephemeralAgent);
|
const isEphemeral = s.isEphemeralAgent(endpoint, ephemeralAgent);
|
||||||
|
|
||||||
if (isEdited && s.isAssistantsEndpoint(endpoint)) {
|
if (isEdited && s.isAssistantsEndpoint(endpoint)) {
|
||||||
server += '/modify';
|
server += '/modify';
|
||||||
} else if (isEdited) {
|
|
||||||
server = server.replace('/ask/', '/edit/');
|
|
||||||
} else if (isEphemeral) {
|
|
||||||
server = `${EndpointURLs[s.EModelEndpoint.agents]}/${endpoint}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const payload: t.TPayload = {
|
const payload: t.TPayload = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue