mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-25 12:48:53 +01:00
* feat: add configuration for user private assistants * filter private assistant message requests * add test for privateAssistants * add privateAssistants configuration to tests * fix: destructuring error when assistants config is not added * chore: revert chat controller changes * chore: add payload type, add metadata types * feat: validateAssistant * refactor(fetchAssistants): allow for flexibility * feat: validateAuthor * refactor: return all assistants to ADMIN role * feat: add assistant doc on assistant creation * refactor(listAssistants): use `listAllAssistants` to exhaustively fetch all assistants * chore: add suggestion to tts error * refactor(validateAuthor): attempt database check first * refactor: author validation when patching/deleting assistant --------- Co-authored-by: Leon Juenemann <leon.juenemann@maibornwolff.de>
29 lines
862 B
TypeScript
29 lines
862 B
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 } = submission;
|
|
const { conversationId } = s.tConvoUpdateSchema.parse(conversation);
|
|
const { endpoint, endpointType } = endpointOption as {
|
|
endpoint: s.EModelEndpoint;
|
|
endpointType?: s.EModelEndpoint;
|
|
};
|
|
|
|
let server = EndpointURLs[endpointType ?? endpoint];
|
|
|
|
if (isEdited && s.isAssistantsEndpoint(endpoint)) {
|
|
server += '/modify';
|
|
} else if (isEdited) {
|
|
server = server.replace('/ask/', '/edit/');
|
|
}
|
|
|
|
const payload: t.TPayload = {
|
|
...userMessage,
|
|
...endpointOption,
|
|
isContinued: !!(isEdited && isContinued),
|
|
conversationId,
|
|
};
|
|
|
|
return { server, payload };
|
|
}
|