mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 20:00:15 +01:00
🔃 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:
parent
20f353630e
commit
4b85fe9206
11 changed files with 634 additions and 590 deletions
|
|
@ -4,9 +4,11 @@ import { SSE } from 'sse.js';
|
|||
import { useSetRecoilState } from 'recoil';
|
||||
import {
|
||||
request,
|
||||
Constants,
|
||||
/* @ts-ignore */
|
||||
createPayload,
|
||||
isAgentsEndpoint,
|
||||
LocalStorageKeys,
|
||||
removeNullishValues,
|
||||
isAssistantsEndpoint,
|
||||
} from 'librechat-data-provider';
|
||||
|
|
@ -18,6 +20,16 @@ import { useAuthContext } from '~/hooks/AuthContext';
|
|||
import useEventHandlers from './useEventHandlers';
|
||||
import store from '~/store';
|
||||
|
||||
const clearDraft = (conversationId?: string | null) => {
|
||||
if (conversationId) {
|
||||
localStorage.removeItem(`${LocalStorageKeys.TEXT_DRAFT}${conversationId}`);
|
||||
localStorage.removeItem(`${LocalStorageKeys.FILES_DRAFT}${conversationId}`);
|
||||
} else {
|
||||
localStorage.removeItem(`${LocalStorageKeys.TEXT_DRAFT}${Constants.NEW_CONVO}`);
|
||||
localStorage.removeItem(`${LocalStorageKeys.FILES_DRAFT}${Constants.NEW_CONVO}`);
|
||||
}
|
||||
};
|
||||
|
||||
type ChatHelpers = Pick<
|
||||
EventHandlerParams,
|
||||
| 'setMessages'
|
||||
|
|
@ -112,6 +124,7 @@ export default function useSSE(
|
|||
const data = JSON.parse(e.data);
|
||||
|
||||
if (data.final != null) {
|
||||
clearDraft(submission.conversationId);
|
||||
const { plugins } = data;
|
||||
finalHandler(data, { ...submission, plugins } as EventSubmission);
|
||||
(startupConfig?.balance?.enabled ?? false) && balanceQuery.refetch();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue