mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-18 09:20:15 +01:00
⬆️ feat: Cancel chat file uploads; fix: Assistant uploads (#4433)
* refactor: move file mutations to dedicated file, improve typing * refactor(ChatForm): utilize FileFormWrapper to consolidate file upload logic/rendering to single parent * refactor: better TSX heirarchies between AttachFile and FileFormWrapper * refactor: `abortUpload` WIP * fix: file debugging and file upload issues * refactor: reject promise outright if axios intercepted error does not include response property * chore: bump data-provider version to 0.7.428 * refactor: Add return type to localize function in Translation.ts * refactor: allow message file attachment upload request cancellations, and add localizations for file upload errors * refactor: include Azure OpenAI in paramEndpoints set * fix: assistant form uploads and better typing * refactor: consolidate logic
This commit is contained in:
parent
0870acd086
commit
65888c274a
20 changed files with 419 additions and 311 deletions
|
|
@ -44,8 +44,8 @@ export function getSharedMessages(shareId: string): Promise<t.TSharedMessagesRes
|
|||
export const listSharedLinks = (
|
||||
params?: q.SharedLinkListParams,
|
||||
): Promise<q.SharedLinksResponse> => {
|
||||
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
||||
const isPublic = params?.isPublic || true; // Default to true if not provided
|
||||
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
||||
const isPublic = params?.isPublic ?? true; // Default to true if not provided
|
||||
return request.get(endpoints.getSharedLinks(pageNumber, isPublic));
|
||||
};
|
||||
|
||||
|
|
@ -314,12 +314,14 @@ export const getFileConfig = (): Promise<f.FileConfig> => {
|
|||
return request.get(`${endpoints.files()}/config`);
|
||||
};
|
||||
|
||||
export const uploadImage = (data: FormData): Promise<f.TFileUpload> => {
|
||||
return request.postMultiPart(endpoints.images(), data);
|
||||
export const uploadImage = (data: FormData, signal?: AbortSignal | null): Promise<f.TFileUpload> => {
|
||||
const requestConfig = signal ? { signal } : undefined;
|
||||
return request.postMultiPart(endpoints.images(), data, requestConfig);
|
||||
};
|
||||
|
||||
export const uploadFile = (data: FormData): Promise<f.TFileUpload> => {
|
||||
return request.postMultiPart(endpoints.files(), data);
|
||||
export const uploadFile = (data: FormData, signal?: AbortSignal | null): Promise<f.TFileUpload> => {
|
||||
const requestConfig = signal ? { signal } : undefined;
|
||||
return request.postMultiPart(endpoints.files(), data, requestConfig);
|
||||
};
|
||||
|
||||
/* actions */
|
||||
|
|
@ -538,8 +540,8 @@ export const listConversations = (
|
|||
params?: q.ConversationListParams,
|
||||
): Promise<q.ConversationListResponse> => {
|
||||
// Assuming params has a pageNumber property
|
||||
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
||||
const isArchived = params?.isArchived || false; // Default to false if not provided
|
||||
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
||||
const isArchived = params?.isArchived ?? false; // Default to false if not provided
|
||||
const tags = params?.tags || []; // Default to an empty array if not provided
|
||||
return request.get(endpoints.conversations(pageNumber, isArchived, tags));
|
||||
};
|
||||
|
|
@ -547,8 +549,8 @@ export const listConversations = (
|
|||
export const listConversationsByQuery = (
|
||||
params?: q.ConversationListParams & { searchQuery?: string },
|
||||
): Promise<q.ConversationListResponse> => {
|
||||
const pageNumber = params?.pageNumber || '1'; // Default to page 1 if not provided
|
||||
const searchQuery = params?.searchQuery || ''; // If no search query is provided, default to an empty string
|
||||
const pageNumber = (params?.pageNumber ?? '1') || '1'; // Default to page 1 if not provided
|
||||
const searchQuery = params?.searchQuery ?? ''; // If no search query is provided, default to an empty string
|
||||
// Update the endpoint to handle a search query
|
||||
if (searchQuery !== '') {
|
||||
return request.get(endpoints.search(searchQuery, pageNumber));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue