mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 00:40:14 +01:00
refactor: remove unused avatar upload mutation field and add informational toast for success
This commit is contained in:
parent
9f68b03e8c
commit
04af67951b
4 changed files with 6 additions and 10 deletions
|
|
@ -2,10 +2,9 @@ import * as Popover from '@radix-ui/react-popover';
|
|||
import { useState, useEffect, useRef } from 'react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import {
|
||||
fileConfig as defaultFileConfig,
|
||||
QueryKeys,
|
||||
defaultOrderQuery,
|
||||
mergeFileConfig,
|
||||
fileConfig as defaultFileConfig,
|
||||
} from 'librechat-data-provider';
|
||||
import type { UseMutationResult } from '@tanstack/react-query';
|
||||
import type {
|
||||
|
|
@ -51,12 +50,11 @@ function Avatar({
|
|||
onMutate: () => {
|
||||
setProgress(0.4);
|
||||
},
|
||||
onSuccess: (data, vars) => {
|
||||
if (vars.postCreation === false) {
|
||||
showToast({ message: localize('com_ui_upload_success') });
|
||||
} else if (lastSeenCreatedId.current !== createMutation.data?.id) {
|
||||
onSuccess: (data) => {
|
||||
if (lastSeenCreatedId.current !== createMutation.data?.id) {
|
||||
lastSeenCreatedId.current = createMutation.data?.id ?? '';
|
||||
}
|
||||
showToast({ message: localize('com_ui_upload_agent_avatar') });
|
||||
|
||||
setInput(null);
|
||||
const newUrl = data.avatar?.filepath ?? '';
|
||||
|
|
@ -143,7 +141,6 @@ function Avatar({
|
|||
|
||||
uploadAvatar({
|
||||
agent_id: createMutation.data.id,
|
||||
postCreation: true,
|
||||
formData,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,8 +194,7 @@ export const useUploadAgentAvatarMutation = (
|
|||
unknown // context
|
||||
> => {
|
||||
return useMutation([MutationKeys.agentAvatarUpload], {
|
||||
mutationFn: ({ postCreation, ...variables }: t.AgentAvatarVariables) =>
|
||||
dataService.uploadAgentAvatar(variables),
|
||||
mutationFn: (variables: t.AgentAvatarVariables) => dataService.uploadAgentAvatar(variables),
|
||||
...(options || {}),
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1059,6 +1059,7 @@
|
|||
"com_ui_update_mcp_error": "There was an error creating or updating the MCP.",
|
||||
"com_ui_update_mcp_success": "Successfully created or updated MCP",
|
||||
"com_ui_upload": "Upload",
|
||||
"com_ui_upload_agent_avatar": "Successfully updated agent avatar",
|
||||
"com_ui_upload_code_files": "Upload for Code Interpreter",
|
||||
"com_ui_upload_delay": "Uploading \"{{0}}\" is taking more time than anticipated. Please wait while the file finishes indexing for retrieval.",
|
||||
"com_ui_upload_error": "There was an error uploading your file",
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ export type DeleteActionOptions = MutationOptions<void, DeleteActionVariables>;
|
|||
export type AgentAvatarVariables = {
|
||||
agent_id: string;
|
||||
formData: FormData;
|
||||
postCreation?: boolean;
|
||||
};
|
||||
|
||||
export type UpdateAgentActionVariables = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue