🔃 fix: Draft Clearing, Claude Titles, Remove Default Vision Max Tokens (#6501)

* refactor: remove legacy max_tokens setting for vision models in OpenAIClient (intended for gpt-4-preview)

* refactor: streamline capability checks in loadAgentTools function, still allow actions if tools are disabled

* fix: enhance error handling for token limits in AnthropicClient and update error message in translations

* feat: append timestamp to cloned agent names for better identification

* chore: update @librechat/agents dependency to version 2.3.94

* refactor: remove clearDraft helper from useSubmitMessage and centralize draft clearing logic to SSE handling, helps prevent user message loss if logout occurs

* refactor: increase debounce time for clearDraft function to improve auto-save performance
This commit is contained in:
Danny Avila 2025-03-23 18:47:40 -04:00 committed by GitHub
parent 20f353630e
commit 4b85fe9206
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 634 additions and 590 deletions

View file

@ -7,6 +7,10 @@ import { useChatFormContext } from '~/Providers';
import { useGetFiles } from '~/data-provider';
import store from '~/store';
const clearDraft = debounce((id?: string | null) => {
localStorage.removeItem(`${LocalStorageKeys.TEXT_DRAFT}${id ?? ''}`);
}, 2500);
export const useAutoSave = ({
conversationId,
textAreaRef,
@ -103,7 +107,7 @@ export const useAutoSave = ({
}
// Save the draft of the current conversation before switching
if (textAreaRef.current.value === '') {
localStorage.removeItem(`${LocalStorageKeys.TEXT_DRAFT}${id}`);
clearDraft(id);
} else {
localStorage.setItem(
`${LocalStorageKeys.TEXT_DRAFT}${id}`,
@ -208,13 +212,4 @@ export const useAutoSave = ({
);
}
}, [files, conversationId, saveDrafts, currentConversationId, fileIds]);
const clearDraft = useCallback(() => {
if (conversationId != null && conversationId) {
localStorage.removeItem(`${LocalStorageKeys.TEXT_DRAFT}${conversationId}`);
localStorage.removeItem(`${LocalStorageKeys.FILES_DRAFT}${conversationId}`);
}
}, [conversationId]);
return { clearDraft };
};