mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-12 12:34:24 +01:00
🧹 chore: pre-release cleanup 2 (#3600)
* refactor: scrollToEnd * fix(validateConvoAccess): search conversation by ID for proper validation * feat: Add unique index for conversationId and user in convoSchema * refactor: Update font sizes 1 rem -> font-size-base in style.css * fix: Assistants map type issues * refactor: Remove obsolete scripts * fix: Update DropdownNoState component to handle both string and OptionType values * refactor: Remove config/loader.js file * fix: remove crypto.randomBytes(); refactor: Create reusable function for generating token and hash
This commit is contained in:
parent
6fead1005b
commit
1ff4841603
20 changed files with 172 additions and 637 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useRef, useCallback } from 'react';
|
||||
import { useEffect, useRef, useCallback, useMemo } from 'react';
|
||||
import { Constants, isAssistantsEndpoint } from 'librechat-data-provider';
|
||||
import type { TMessageProps } from '~/common';
|
||||
import { useChatContext, useAssistantsMapContext } from '~/Providers';
|
||||
|
|
@ -24,7 +24,7 @@ export default function useMessageHelpers(props: TMessageProps) {
|
|||
|
||||
const { text, content, children, messageId = null, isCreatedByUser } = message ?? {};
|
||||
const edit = messageId === currentEditId;
|
||||
const isLast = !children?.length;
|
||||
const isLast = children?.length === 0 || children?.length === undefined;
|
||||
|
||||
useEffect(() => {
|
||||
const convoId = conversation?.conversationId;
|
||||
|
|
@ -44,7 +44,7 @@ export default function useMessageHelpers(props: TMessageProps) {
|
|||
const logInfo = {
|
||||
textKey,
|
||||
'latestText.current': latestText.current,
|
||||
messageId: message?.messageId,
|
||||
messageId: message.messageId,
|
||||
convoId,
|
||||
};
|
||||
if (
|
||||
|
|
@ -60,7 +60,7 @@ export default function useMessageHelpers(props: TMessageProps) {
|
|||
}, [isLast, message, setLatestMessage, conversation?.conversationId]);
|
||||
|
||||
const enterEdit = useCallback(
|
||||
(cancel?: boolean) => setCurrentEditId && setCurrentEditId(cancel ? -1 : messageId),
|
||||
(cancel?: boolean) => setCurrentEditId && setCurrentEditId(cancel === true ? -1 : messageId),
|
||||
[messageId, setCurrentEditId],
|
||||
);
|
||||
|
||||
|
|
@ -72,12 +72,19 @@ export default function useMessageHelpers(props: TMessageProps) {
|
|||
}
|
||||
}, [isSubmitting, setAbortScroll]);
|
||||
|
||||
const assistant =
|
||||
isAssistantsEndpoint(conversation?.endpoint) &&
|
||||
assistantMap?.[conversation?.endpoint ?? '']?.[message?.model ?? ''];
|
||||
const assistant = useMemo(() => {
|
||||
if (!isAssistantsEndpoint(conversation?.endpoint)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const endpointKey = conversation?.endpoint ?? '';
|
||||
const modelKey = message?.model ?? '';
|
||||
|
||||
return assistantMap?.[endpointKey] ? assistantMap[endpointKey][modelKey] : undefined;
|
||||
}, [conversation?.endpoint, message?.model, assistantMap]);
|
||||
|
||||
const regenerateMessage = () => {
|
||||
if ((isSubmitting && isCreatedByUser) || !message) {
|
||||
if ((isSubmitting && isCreatedByUser === true) || !message) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue