mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
🤖 feat: Private Assistants (#2881)
* 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>
This commit is contained in:
parent
9f2538fcd9
commit
5dc5d875ba
20 changed files with 308 additions and 109 deletions
|
|
@ -1,31 +1,24 @@
|
|||
import type { TSubmission, TMessage, TEndpointOption } from './types';
|
||||
import { tConvoUpdateSchema, EModelEndpoint, isAssistantsEndpoint } from './schemas';
|
||||
import type * as t from './types';
|
||||
import { EndpointURLs } from './config';
|
||||
import * as s from './schemas';
|
||||
|
||||
export default function createPayload(submission: TSubmission) {
|
||||
const { conversation, userMessage, messages, endpointOption, isEdited, isContinued } = submission;
|
||||
const { conversationId } = tConvoUpdateSchema.parse(conversation);
|
||||
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: EModelEndpoint;
|
||||
endpointType?: EModelEndpoint;
|
||||
endpoint: s.EModelEndpoint;
|
||||
endpointType?: s.EModelEndpoint;
|
||||
};
|
||||
|
||||
let server = EndpointURLs[endpointType ?? endpoint];
|
||||
|
||||
if (isEdited && isAssistantsEndpoint(endpoint)) {
|
||||
if (isEdited && s.isAssistantsEndpoint(endpoint)) {
|
||||
server += '/modify';
|
||||
} else if (isEdited) {
|
||||
server = server.replace('/ask/', '/edit/');
|
||||
}
|
||||
|
||||
type Payload = Partial<TMessage> &
|
||||
Partial<TEndpointOption> & {
|
||||
isContinued: boolean;
|
||||
conversationId: string | null;
|
||||
messages?: typeof messages;
|
||||
};
|
||||
|
||||
const payload: Payload = {
|
||||
const payload: t.TPayload = {
|
||||
...userMessage,
|
||||
...endpointOption,
|
||||
isContinued: !!(isEdited && isContinued),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue