mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-18 00:15:30 +01:00
⬇️ refactor: Assistant File Downloads (#2364)
* refactor(getFiledownload): explicit accept of `application/octet-stream` * chore: test compose file * chore: test compose file fix * chore(files/download): add more logs * Fix proxy_pass URLs in nginx.conf * fix: proxy_pass URLs in nginx.conf to fix file downloads from URL * chore: move test compose file to utils dir * refactor(useFileDownload): simplify API request by passing `file_id` instead of `filepath`
This commit is contained in:
parent
cc71125fa1
commit
cb64b84846
6 changed files with 92 additions and 20 deletions
|
|
@ -325,15 +325,16 @@ export const useGetAssistantDocsQuery = (
|
|||
);
|
||||
};
|
||||
|
||||
export const useFileDownload = (userId: string, filepath: string): QueryObserverResult<string> => {
|
||||
export const useFileDownload = (userId?: string, file_id?: string): QueryObserverResult<string> => {
|
||||
const queryClient = useQueryClient();
|
||||
return useQuery(
|
||||
[QueryKeys.fileDownload, filepath],
|
||||
[QueryKeys.fileDownload, file_id],
|
||||
async () => {
|
||||
if (!userId) {
|
||||
if (!userId || !file_id) {
|
||||
console.warn('No user ID provided for file download');
|
||||
return;
|
||||
}
|
||||
const response = await dataService.getFileDownload(userId, filepath);
|
||||
const response = await dataService.getFileDownload(userId, file_id);
|
||||
const blob = response.data;
|
||||
const downloadURL = window.URL.createObjectURL(blob);
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue