mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-23 02:36:12 +01:00
* refactor: change references from direct upload to direct attach to better reflect functionality since we are just using base64 encoding strategy now rather than Files/File API for sending our attachments directly to the provider, the upload nomenclature no longer makes sense. direct_attach better describes the different methods of sending attachments to providers anyways even if we later introduce direct upload support * feat: add upload to provider option for openai (and agent) ui * chore: move anthropic pdf validator over to packages/api * feat: simple pdf validation according to openai docs * feat: add provider agnostic validatePdf logic to start handling multiple endpoints * feat: add handling for openai specific documentPart formatting * refactor: move require statement to proper place at top of file * chore: add in openAI endpoint for the rest of the document handling logic * feat: add direct attach support for azureOpenAI endpoint and agents * feat: add pdf validation for azureOpenAI endpoint * refactor: unify all the endpoint checks with isDocumentSupportedEndpoint * refactor: consolidate Upload to Provider vs Upload image logic for clarity * refactor: remove anthropic from anthropic_multimodal fileType since we support multiple providers now
68 lines
1.7 KiB
TypeScript
68 lines
1.7 KiB
TypeScript
import { useMemo } from 'react';
|
|
import { AgentCapabilities } from 'librechat-data-provider';
|
|
|
|
interface AgentCapabilitiesResult {
|
|
toolsEnabled: boolean;
|
|
actionsEnabled: boolean;
|
|
artifactsEnabled: boolean;
|
|
ocrEnabled: boolean;
|
|
fileSearchEnabled: boolean;
|
|
webSearchEnabled: boolean;
|
|
codeEnabled: boolean;
|
|
directAttachEnabled: boolean;
|
|
}
|
|
|
|
export default function useAgentCapabilities(
|
|
capabilities: AgentCapabilities[] | undefined,
|
|
): AgentCapabilitiesResult {
|
|
const toolsEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.tools) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const actionsEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.actions) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const artifactsEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.artifacts) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const ocrEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.ocr) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const fileSearchEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.file_search) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const webSearchEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.web_search) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const codeEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.execute_code) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
const directAttachEnabled = useMemo(
|
|
() => capabilities?.includes(AgentCapabilities.direct_attach) ?? false,
|
|
[capabilities],
|
|
);
|
|
|
|
return {
|
|
ocrEnabled,
|
|
codeEnabled,
|
|
toolsEnabled,
|
|
actionsEnabled,
|
|
artifactsEnabled,
|
|
webSearchEnabled,
|
|
fileSearchEnabled,
|
|
directAttachEnabled,
|
|
};
|
|
}
|