mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-28 06:08:50 +01:00
🔒 feat: View/Delete Shared Agent Files (#8419)
* 🔧 fix: Add localized message for delete operation not allowed
* refactor: improve file deletion operations ux
* feat: agent-based file access control and enhance file retrieval logic
* feat: implement agent-specific file retrieval
* feat: enhance agent file retrieval logic for authors and shared access
* ci: include userId and agentId in mockGetFiles call for OCR file retrieval
This commit is contained in:
parent
6aa4bb5a4a
commit
f1b29ffb45
22 changed files with 1216 additions and 35 deletions
|
|
@ -188,6 +188,12 @@ export const agents = ({ path = '', options }: { path?: string; options?: object
|
|||
export const revertAgentVersion = (agent_id: string) => `${agents({ path: `${agent_id}/revert` })}`;
|
||||
|
||||
export const files = () => '/api/files';
|
||||
export const fileUpload = () => '/api/files';
|
||||
export const fileDelete = () => '/api/files';
|
||||
export const fileDownload = (userId: string, fileId: string) =>
|
||||
`/api/files/download/${userId}/${fileId}`;
|
||||
export const fileConfig = () => '/api/files/config';
|
||||
export const agentFiles = (agentId: string) => `/api/files/agent/${agentId}`;
|
||||
|
||||
export const images = () => `${files()}/images`;
|
||||
|
||||
|
|
|
|||
|
|
@ -318,6 +318,10 @@ export const getFiles = (): Promise<f.TFile[]> => {
|
|||
return request.get(endpoints.files());
|
||||
};
|
||||
|
||||
export const getAgentFiles = (agentId: string): Promise<f.TFile[]> => {
|
||||
return request.get(endpoints.agentFiles(agentId));
|
||||
};
|
||||
|
||||
export const getFileConfig = (): Promise<f.FileConfig> => {
|
||||
return request.get(`${endpoints.files()}/config`);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -50,6 +50,11 @@ export enum QueryKeys {
|
|||
memories = 'memories',
|
||||
}
|
||||
|
||||
// Dynamic query keys that require parameters
|
||||
export const DynamicQueryKeys = {
|
||||
agentFiles: (agentId: string) => ['agentFiles', agentId] as const,
|
||||
} as const;
|
||||
|
||||
export enum MutationKeys {
|
||||
fileUpload = 'fileUpload',
|
||||
fileDelete = 'fileDelete',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue