refactor: remove unused avatar upload mutation field and add informational toast for success

This commit is contained in:
Danny Avila 2025-07-15 21:50:07 -04:00
parent 9f68b03e8c
commit 04af67951b
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
4 changed files with 6 additions and 10 deletions

View file

@ -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,
});
}

View file

@ -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 || {}),
});
};

View file

@ -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",

View file

@ -109,7 +109,6 @@ export type DeleteActionOptions = MutationOptions<void, DeleteActionVariables>;
export type AgentAvatarVariables = {
agent_id: string;
formData: FormData;
postCreation?: boolean;
};
export type UpdateAgentActionVariables = {