⬇️ 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:
Danny Avila 2024-04-09 14:26:46 -04:00 committed by GitHub
parent cc71125fa1
commit cb64b84846
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 92 additions and 20 deletions

View file

@ -202,10 +202,12 @@ export const uploadAssistantAvatar = (data: m.AssistantAvatarVariables): Promise
);
};
export const getFileDownload = async (userId: string, filepath: string): Promise<AxiosResponse> => {
const encodedFilePath = encodeURIComponent(filepath);
return request.getResponse(`${endpoints.files()}/download/${userId}/${encodedFilePath}`, {
export const getFileDownload = async (userId: string, file_id: string): Promise<AxiosResponse> => {
return request.getResponse(`${endpoints.files()}/download/${userId}/${file_id}`, {
responseType: 'blob',
headers: {
Accept: 'application/octet-stream',
},
});
};