mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
🚧 WIP: Merge Dev Build (#4611)
* refactor: Agent CodeFiles, abortUpload WIP * feat: code environment file upload * refactor: useLazyEffect * refactor: - Add `watch` from `useFormContext` to check if code execution is enabled - Disable file upload button if `agent_id` is not selected or code execution is disabled * WIP: primeCodeFiles; refactor: rename sessionId to session_id for uniformity * Refactor: Rename session_id to sessionId for uniformity in AuthService.js * chore: bump @librechat/agents to version 1.7.1 * WIP: prime code files * refactor: Update code env file upload method to use read stream * feat: reupload code env file if no longer active * refactor: isAssistantTool -> isEntityTool + address type issues * feat: execute code tool hook * refactor: Rename isPluginAuthenticated to checkPluginAuth in PluginController.js * refactor: Update PluginController.js to use AuthType constant for comparison * feat: verify tool authentication (execute_code) * feat: enter librechat_code_api_key * refactor: Remove unused imports in BookmarkForm.tsx * feat: authenticate code tool * refactor: Update Action.tsx to conditionally render the key and revoke key buttons * refactor(Code/Action): prevent uncheck-able 'Run Code' capability when key is revoked * refactor(Code/Action): Update Action.tsx to conditionally render the key and revoke key buttons * fix: agent file upload edge cases * chore: bump @librechat/agents * fix: custom endpoint providerValue icon * feat: ollama meta modal token values + context * feat: ollama agents * refactor: Update token models for Ollama models * chore: Comment out CodeForm * refactor: Update token models for Ollama and Meta models
This commit is contained in:
parent
1909efd6ba
commit
95011ce349
58 changed files with 1418 additions and 1002 deletions
|
|
@ -125,10 +125,10 @@ export const assistants = ({
|
|||
return url;
|
||||
};
|
||||
|
||||
export const agents = ({ path, options }: { path?: string; options?: object }) => {
|
||||
export const agents = ({ path = '', options }: { path?: string; options?: object }) => {
|
||||
let url = '/api/agents';
|
||||
|
||||
if (path) {
|
||||
if (path && path !== '') {
|
||||
url += `/${path}`;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -584,6 +584,7 @@ export const alternateName = {
|
|||
[EModelEndpoint.anthropic]: 'Anthropic',
|
||||
[EModelEndpoint.custom]: 'Custom',
|
||||
[EModelEndpoint.bedrock]: 'AWS Bedrock',
|
||||
ollama: 'Ollama',
|
||||
};
|
||||
|
||||
const sharedOpenAIModels = [
|
||||
|
|
|
|||
|
|
@ -304,6 +304,16 @@ export const getAvailableTools = (
|
|||
return request.get(path);
|
||||
};
|
||||
|
||||
export const getVerifyAgentToolAuth = (
|
||||
params: q.VerifyToolAuthParams,
|
||||
): Promise<q.VerifyToolAuthResponse> => {
|
||||
return request.get(
|
||||
endpoints.agents({
|
||||
path: `tools/${params.toolId}/auth`,
|
||||
}),
|
||||
);
|
||||
};
|
||||
|
||||
/* Files */
|
||||
|
||||
export const getFiles = (): Promise<f.TFile[]> => {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ export enum QueryKeys {
|
|||
files = 'files',
|
||||
fileConfig = 'fileConfig',
|
||||
tools = 'tools',
|
||||
toolAuth = 'toolAuth',
|
||||
agentTools = 'agentTools',
|
||||
actions = 'actions',
|
||||
assistantDocs = 'assistantDocs',
|
||||
|
|
|
|||
|
|
@ -408,16 +408,16 @@ export const useAvailablePluginsQuery = <TData = s.TPlugin[]>(
|
|||
);
|
||||
};
|
||||
|
||||
export const useUpdateUserPluginsMutation = (): UseMutationResult<
|
||||
t.TUser,
|
||||
unknown,
|
||||
t.TUpdateUserPlugins,
|
||||
unknown
|
||||
> => {
|
||||
export const useUpdateUserPluginsMutation = (
|
||||
_options?: m.UpdatePluginAuthOptions,
|
||||
): UseMutationResult<t.TUser, unknown, t.TUpdateUserPlugins, unknown> => {
|
||||
const queryClient = useQueryClient();
|
||||
const { onSuccess, ...options } = _options ?? {};
|
||||
return useMutation((payload: t.TUpdateUserPlugins) => dataService.updateUserPlugins(payload), {
|
||||
onSuccess: () => {
|
||||
...options,
|
||||
onSuccess: (...args) => {
|
||||
queryClient.invalidateQueries([QueryKeys.user]);
|
||||
onSuccess?.(...args);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export const isUUID = z.string().uuid();
|
|||
export enum AuthType {
|
||||
OVERRIDE_AUTH = 'override_auth',
|
||||
USER_PROVIDED = 'user_provided',
|
||||
SYSTEM_DEFINED = 'SYSTEM_DEFINED',
|
||||
SYSTEM_DEFINED = 'system_defined',
|
||||
}
|
||||
|
||||
export const authTypeSchema = z.nativeEnum(AuthType);
|
||||
|
|
@ -369,7 +369,7 @@ export const tPluginSchema = z.object({
|
|||
pluginKey: z.string(),
|
||||
description: z.string(),
|
||||
icon: z.string(),
|
||||
authConfig: z.array(tPluginAuthConfigSchema),
|
||||
authConfig: z.array(tPluginAuthConfigSchema).optional(),
|
||||
authenticated: z.boolean().optional(),
|
||||
isButton: z.boolean().optional(),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -72,14 +72,13 @@ export type TPluginAction = {
|
|||
pluginKey: string;
|
||||
action: 'install' | 'uninstall';
|
||||
auth?: unknown;
|
||||
isAssistantTool?: boolean;
|
||||
isEntityTool?: boolean;
|
||||
};
|
||||
|
||||
export type GroupedConversations = [key: string, TConversation[]][];
|
||||
|
||||
export type TUpdateUserPlugins = {
|
||||
isAssistantTool?: boolean;
|
||||
isAgentTool?: boolean;
|
||||
isEntityTool?: boolean;
|
||||
pluginKey: string;
|
||||
action: string;
|
||||
auth?: unknown;
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ export type TFile = {
|
|||
height?: number;
|
||||
expiresAt?: string | Date;
|
||||
preview?: string;
|
||||
metadata?: { fileIdentifier?: string };
|
||||
createdAt?: string | Date;
|
||||
updatedAt?: string | Date;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -248,3 +248,6 @@ export type AcceptTermsMutationOptions = MutationOptions<
|
|||
unknown,
|
||||
void
|
||||
>;
|
||||
|
||||
/* Tools */
|
||||
export type UpdatePluginAuthOptions = MutationOptions<types.TUser, types.TUpdateUserPlugins>;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import type { InfiniteData } from '@tanstack/react-query';
|
||||
import type * as s from '../schemas';
|
||||
import type * as t from '../types';
|
||||
import type { TMessage, TConversation, TSharedLink, TConversationTag } from '../schemas';
|
||||
|
||||
export type Conversation = {
|
||||
id: string;
|
||||
createdAt: number;
|
||||
participants: string[];
|
||||
lastMessage: string;
|
||||
conversations: TConversation[];
|
||||
conversations: s.TConversation[];
|
||||
};
|
||||
|
||||
// Parameters for listing conversations (e.g., for pagination)
|
||||
|
|
@ -24,33 +24,33 @@ export type ConversationListParams = {
|
|||
|
||||
// Type for the response from the conversation list API
|
||||
export type ConversationListResponse = {
|
||||
conversations: TConversation[];
|
||||
conversations: s.TConversation[];
|
||||
pageNumber: string;
|
||||
pageSize: string | number;
|
||||
pages: string | number;
|
||||
messages: TMessage[];
|
||||
messages: s.TMessage[];
|
||||
};
|
||||
|
||||
export type ConversationData = InfiniteData<ConversationListResponse>;
|
||||
export type ConversationUpdater = (
|
||||
data: ConversationData,
|
||||
conversation: TConversation,
|
||||
conversation: s.TConversation,
|
||||
) => ConversationData;
|
||||
|
||||
export type SharedMessagesResponse = Omit<TSharedLink, 'messages'> & {
|
||||
messages: TMessage[];
|
||||
export type SharedMessagesResponse = Omit<s.TSharedLink, 'messages'> & {
|
||||
messages: s.TMessage[];
|
||||
};
|
||||
export type SharedLinkListParams = Omit<ConversationListParams, 'isArchived' | 'conversationId'> & {
|
||||
isPublic?: boolean;
|
||||
};
|
||||
|
||||
export type SharedLinksResponse = Omit<ConversationListResponse, 'conversations' | 'messages'> & {
|
||||
sharedLinks: TSharedLink[];
|
||||
sharedLinks: s.TSharedLink[];
|
||||
};
|
||||
|
||||
// Type for the response from the conversation list API
|
||||
export type SharedLinkListResponse = {
|
||||
sharedLinks: TSharedLink[];
|
||||
sharedLinks: s.TSharedLink[];
|
||||
pageNumber: string;
|
||||
pageSize: string | number;
|
||||
pages: string | number;
|
||||
|
|
@ -71,4 +71,7 @@ export type AllPromptGroupsFilterRequest = {
|
|||
|
||||
export type AllPromptGroupsResponse = t.TPromptGroup[];
|
||||
|
||||
export type ConversationTagsResponse = TConversationTag[];
|
||||
export type ConversationTagsResponse = s.TConversationTag[];
|
||||
|
||||
export type VerifyToolAuthParams = { toolId: string };
|
||||
export type VerifyToolAuthResponse = { authenticated: boolean; message?: string | s.AuthType };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue