mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-11 03:54:23 +01:00
🚧 chore: merge latest dev build (#4288)
* fix: agent initialization, add `collectedUsage` handling * style: improve side panel styling * refactor(loadAgent): Optimize order agent project ID retrieval * feat: code execution * fix: typing issues * feat: ExecuteCode content part * refactor: use local state for default collapsed state of analysis content parts * fix: code parsing in ExecuteCode component * chore: bump agents package, export loadAuthValues * refactor: Update handleTools.js to use EnvVar for code execution tool authentication * WIP * feat: download code outputs * fix(useEventHandlers): type issues * feat: backend handling for code outputs * Refactor: Remove console.log statement in Part.tsx * refactor: add attachments to TMessage/messageSchema * WIP: prelim handling for code outputs * feat: attachments rendering * refactor: improve attachments rendering * fix: attachments, nullish edge case, handle attachments from event stream, bump agents package * fix filename download * fix: tool assignment for 'run code' on agent creation * fix: image handling by adding attachments * refactor: prevent agent creation without provider/model * refactor: remove unnecessary space in agent creation success message * refactor: select first model if selecting provider from empty on form * fix: Agent avatar bug * fix: `defaultAgentFormValues` causing boolean typing issue and typeerror * fix: capabilities counting as tools, causing duplication of them * fix: formatted messages edge case where consecutive content text type parts with the latter having tool_call_ids would cause consecutive AI messages to be created. furthermore, content could not be an array for tool_use messages (anthropic limitation) * chore: bump @librechat/agents dependency to version 1.6.9 * feat: bedrock agents * feat: new Agents icon * feat: agent titling * feat: agent landing * refactor: allow sharing agent globally only if user is admin or author * feat: initial AgentPanelSkeleton * feat: AgentPanelSkeleton * feat: collaborative agents * chore: add potential authorName as part of schema * chore: Remove unnecessary console.log statement * WIP: agent model parameters * chore: ToolsDialog typing and tool related localization chnages * refactor: update tool instance type (latest langchain class), and rename google tool to 'google' proper * chore: add back tools * feat: Agent knowledge files upload * refactor: better verbiage for disabled knowledge * chore: debug logs for file deletions * chore: debug logs for file deletions * feat: upload/delete agent knowledge/file-search files * feat: file search UI for agents * feat: first pass, file search tool * chore: update default agent capabilities and info
This commit is contained in:
parent
f33e75e2ee
commit
ad74350036
123 changed files with 3611 additions and 1541 deletions
|
|
@ -139,6 +139,13 @@ export enum Capabilities {
|
|||
tools = 'tools',
|
||||
}
|
||||
|
||||
export enum AgentCapabilities {
|
||||
execute_code = 'execute_code',
|
||||
file_search = 'file_search',
|
||||
actions = 'actions',
|
||||
tools = 'tools',
|
||||
}
|
||||
|
||||
export const defaultAssistantsVersion = {
|
||||
[EModelEndpoint.assistants]: 2,
|
||||
[EModelEndpoint.azureAssistants]: 1,
|
||||
|
|
@ -1121,6 +1128,8 @@ export enum LocalStorageKeys {
|
|||
LAST_PROMPT_CATEGORY = 'lastPromptCategory',
|
||||
/** Key for rendering User Messages as Markdown */
|
||||
ENABLE_USER_MSG_MARKDOWN = 'enableUserMsgMarkdown',
|
||||
/** Key for displaying analysis tool code input */
|
||||
SHOW_ANALYSIS_CODE = 'showAnalysisCode',
|
||||
}
|
||||
|
||||
export enum ForkOptions {
|
||||
|
|
|
|||
|
|
@ -482,13 +482,23 @@ export const getFileDownload = async (userId: string, file_id: string): Promise<
|
|||
});
|
||||
};
|
||||
|
||||
export const deleteFiles = async (
|
||||
files: f.BatchFile[],
|
||||
assistant_id?: string,
|
||||
tool_resource?: a.EToolResources,
|
||||
): Promise<f.DeleteFilesResponse> =>
|
||||
export const getCodeOutputDownload = async (url: string): Promise<AxiosResponse> => {
|
||||
return request.getResponse(url, {
|
||||
responseType: 'blob',
|
||||
headers: {
|
||||
Accept: 'application/octet-stream',
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
export const deleteFiles = async (payload: {
|
||||
files: f.BatchFile[];
|
||||
agent_id?: string;
|
||||
assistant_id?: string;
|
||||
tool_resource?: a.EToolResources;
|
||||
}): Promise<f.DeleteFilesResponse> =>
|
||||
request.deleteWithOptions(endpoints.files(), {
|
||||
data: { files, assistant_id, tool_resource },
|
||||
data: payload,
|
||||
});
|
||||
|
||||
/* Speech */
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ export const fileConfig = {
|
|||
endpoints: {
|
||||
[EModelEndpoint.assistants]: assistantsFileConfig,
|
||||
[EModelEndpoint.azureAssistants]: assistantsFileConfig,
|
||||
[EModelEndpoint.agents]: assistantsFileConfig,
|
||||
default: {
|
||||
fileLimit: 10,
|
||||
fileSizeLimit: defaultSizeLimit,
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ export type DynamicSettingProps = Partial<SettingDefinition> & {
|
|||
readonly?: boolean;
|
||||
settingKey: string;
|
||||
setOption: TSetOption;
|
||||
conversation: TConversation | TPreset | null;
|
||||
conversation: Partial<TConversation> | Partial<TPreset> | null;
|
||||
defaultValue?: number | boolean | string | string[];
|
||||
className?: string;
|
||||
inputClassName?: string;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ export enum Permissions {
|
|||
SHARED_GLOBAL = 'SHARED_GLOBAL',
|
||||
USE = 'USE',
|
||||
CREATE = 'CREATE',
|
||||
UPDATE = 'UPDATE',
|
||||
READ = 'READ',
|
||||
READ_AUTHOR = 'READ_AUTHOR',
|
||||
SHARE = 'SHARE',
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -140,9 +140,9 @@ export const defaultAgentFormValues = {
|
|||
tools: [],
|
||||
provider: {},
|
||||
projectIds: [],
|
||||
code_interpreter: false,
|
||||
image_vision: false,
|
||||
retrieval: false,
|
||||
isCollaborative: false,
|
||||
[Tools.execute_code]: false,
|
||||
[Tools.file_search]: false,
|
||||
};
|
||||
|
||||
export const ImageVisionTool: FunctionTool = {
|
||||
|
|
@ -468,6 +468,13 @@ export const tMessageSchema = z.object({
|
|||
iconURL: z.string().optional(),
|
||||
});
|
||||
|
||||
export type TAttachmentMetadata = { messageId: string; toolCallId: string };
|
||||
export type TAttachment =
|
||||
| (TFile & TAttachmentMetadata)
|
||||
| (Pick<TFile, 'filename' | 'filepath' | 'conversationId'> & {
|
||||
expiresAt: number;
|
||||
} & TAttachmentMetadata);
|
||||
|
||||
export type TMessage = z.input<typeof tMessageSchema> & {
|
||||
children?: TMessage[];
|
||||
plugin?: TResPlugin | null;
|
||||
|
|
@ -476,6 +483,7 @@ export type TMessage = z.input<typeof tMessageSchema> & {
|
|||
files?: Partial<TFile>[];
|
||||
depth?: number;
|
||||
siblingIndex?: number;
|
||||
attachments?: TAttachment[];
|
||||
};
|
||||
|
||||
export const coerceNumber = z.union([z.number(), z.string()]).transform((val) => {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ export type Metadata = {
|
|||
};
|
||||
|
||||
export enum Tools {
|
||||
execute_code = 'execute_code',
|
||||
code_interpreter = 'code_interpreter',
|
||||
file_search = 'file_search',
|
||||
retrieval = 'retrieval',
|
||||
|
|
@ -23,6 +24,7 @@ export enum Tools {
|
|||
|
||||
export enum EToolResources {
|
||||
code_interpreter = 'code_interpreter',
|
||||
execute_code = 'execute_code',
|
||||
file_search = 'file_search',
|
||||
}
|
||||
|
||||
|
|
@ -142,32 +144,61 @@ export type File = {
|
|||
|
||||
/* Agent types */
|
||||
|
||||
export type AgentParameterValue = number | null;
|
||||
|
||||
export type AgentModelParameters = {
|
||||
temperature: number | null;
|
||||
max_context_tokens: number | null;
|
||||
max_output_tokens: number | null;
|
||||
top_p: number | null;
|
||||
frequency_penalty: number | null;
|
||||
presence_penalty: number | null;
|
||||
temperature: AgentParameterValue;
|
||||
max_context_tokens: AgentParameterValue;
|
||||
max_output_tokens: AgentParameterValue;
|
||||
top_p: AgentParameterValue;
|
||||
frequency_penalty: AgentParameterValue;
|
||||
presence_penalty: AgentParameterValue;
|
||||
};
|
||||
|
||||
export interface AgentToolResources {
|
||||
execute_code?: ExecuteCodeResource;
|
||||
file_search?: AgentFileSearchResource;
|
||||
}
|
||||
export interface ExecuteCodeResource {
|
||||
/**
|
||||
* A list of file IDs made available to the `execute_code` tool.
|
||||
* There can be a maximum of 20 files associated with the tool.
|
||||
*/
|
||||
file_ids?: Array<string>;
|
||||
}
|
||||
|
||||
export interface AgentFileSearchResource {
|
||||
/**
|
||||
* The ID of the vector store attached to this agent. There
|
||||
* can be a maximum of 1 vector store attached to the agent.
|
||||
*/
|
||||
vector_store_ids?: Array<string>;
|
||||
/**
|
||||
* A list of file IDs made available to the `file_search` tool.
|
||||
* To be used before vector stores are implemented.
|
||||
*/
|
||||
file_ids?: Array<string>;
|
||||
}
|
||||
|
||||
export type Agent = {
|
||||
id: string;
|
||||
name: string | null;
|
||||
author?: string | null;
|
||||
authorName?: string | null;
|
||||
description: string | null;
|
||||
created_at: number;
|
||||
avatar: AgentAvatar | null;
|
||||
file_ids: string[];
|
||||
instructions: string | null;
|
||||
tools?: string[];
|
||||
projectIds?: string[];
|
||||
tool_kwargs?: Record<string, unknown>;
|
||||
tool_resources?: ToolResources;
|
||||
metadata?: Record<string, unknown>;
|
||||
provider: AgentProvider;
|
||||
model: string | null;
|
||||
model_parameters: AgentModelParameters;
|
||||
object: string;
|
||||
conversation_starters?: string[];
|
||||
isCollaborative?: boolean;
|
||||
tool_resources?: AgentToolResources;
|
||||
};
|
||||
|
||||
export type TAgentsMap = Record<string, Agent | undefined>;
|
||||
|
|
@ -197,6 +228,7 @@ export type AgentUpdateParams = {
|
|||
model_parameters?: AgentModelParameters;
|
||||
projectIds?: string[];
|
||||
removeProjectIds?: string[];
|
||||
isCollaborative?: boolean;
|
||||
};
|
||||
|
||||
export type AgentListParams = {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export enum FileSources {
|
|||
openai = 'openai',
|
||||
s3 = 's3',
|
||||
vectordb = 'vectordb',
|
||||
execute_code = 'execute_code',
|
||||
}
|
||||
|
||||
export const checkOpenAIStorage = (source: string) =>
|
||||
|
|
@ -15,7 +16,9 @@ export const checkOpenAIStorage = (source: string) =>
|
|||
export enum FileContext {
|
||||
avatar = 'avatar',
|
||||
unknown = 'unknown',
|
||||
agents = 'agents',
|
||||
assistants = 'assistants',
|
||||
execute_code = 'execute_code',
|
||||
image_generation = 'image_generation',
|
||||
assistants_output = 'assistants_output',
|
||||
message_attachment = 'message_attachment',
|
||||
|
|
@ -128,6 +131,7 @@ export type BatchFile = {
|
|||
|
||||
export type DeleteFilesBody = {
|
||||
files: BatchFile[];
|
||||
agent_id?: string;
|
||||
assistant_id?: string;
|
||||
tool_resource?: EToolResources;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue