mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-06 10:38:50 +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
|
|
@ -144,6 +144,7 @@ export const assistantEndpointSchema = z.object({
|
|||
version: z.union([z.string(), z.number()]).default(2),
|
||||
supportedIds: z.array(z.string()).min(1).optional(),
|
||||
excludedIds: z.array(z.string()).min(1).optional(),
|
||||
privateAssistants: z.boolean().optional(),
|
||||
retrievalModels: z.array(z.string()).min(1).optional().default(defaultRetrievalModels),
|
||||
capabilities: z
|
||||
.array(z.nativeEnum(Capabilities))
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -37,6 +37,13 @@ export type TEndpointOption = {
|
|||
thread_id?: string;
|
||||
};
|
||||
|
||||
export type TPayload = Partial<TMessage> &
|
||||
Partial<TEndpointOption> & {
|
||||
isContinued: boolean;
|
||||
conversationId: string | null;
|
||||
messages?: TMessages;
|
||||
};
|
||||
|
||||
export type TSubmission = {
|
||||
plugin?: TResPlugin;
|
||||
plugins?: TResPlugin[];
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ export type Schema = OpenAPIV3.SchemaObject & { description?: string };
|
|||
export type Reference = OpenAPIV3.ReferenceObject & { description?: string };
|
||||
|
||||
export type Metadata = {
|
||||
avatar?: string;
|
||||
author?: string;
|
||||
} & {
|
||||
[key: string]: unknown;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue