mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-19 09:50:15 +01:00
⚡️ refactor: Optimize Rendering Performance for Icons, Conversations (#5234)
* refactor: HoverButtons and Fork components to use explicit props * refactor: improve typing for Fork Component * fix: memoize SpecIcon to avoid unnecessary re-renders * feat: introduce URLIcon component and update SpecIcon for improved icon handling * WIP: optimizing icons * refactor: simplify modelLabel assignment in Message components * refactor: memoize ConvoOptions component to optimize rendering performance
This commit is contained in:
parent
687ab32bd3
commit
0f95604a67
19 changed files with 206 additions and 171 deletions
|
|
@ -1,28 +1,28 @@
|
|||
import type { TMessage } from 'librechat-data-provider';
|
||||
import { EModelEndpoint, isAssistantsEndpoint } from 'librechat-data-provider';
|
||||
|
||||
type TUseGenerations = {
|
||||
error?: boolean;
|
||||
endpoint?: string;
|
||||
message?: TMessage;
|
||||
isSubmitting: boolean;
|
||||
messageId?: string;
|
||||
isEditing?: boolean;
|
||||
latestMessage: TMessage | null;
|
||||
isSubmitting: boolean;
|
||||
searchResult?: boolean;
|
||||
finish_reason?: string;
|
||||
latestMessageId?: string;
|
||||
isCreatedByUser?: boolean;
|
||||
};
|
||||
|
||||
export default function useGenerationsByLatest({
|
||||
error = false,
|
||||
endpoint,
|
||||
message,
|
||||
isSubmitting,
|
||||
messageId,
|
||||
isEditing = false,
|
||||
latestMessage,
|
||||
isSubmitting,
|
||||
searchResult = false,
|
||||
finish_reason = '',
|
||||
latestMessageId,
|
||||
isCreatedByUser = false,
|
||||
}: TUseGenerations) {
|
||||
const {
|
||||
messageId,
|
||||
searchResult = false,
|
||||
error = false,
|
||||
finish_reason = '',
|
||||
isCreatedByUser = false,
|
||||
} = message ?? {};
|
||||
const isEditableEndpoint = Boolean(
|
||||
[
|
||||
EModelEndpoint.openAI,
|
||||
|
|
@ -37,7 +37,7 @@ export default function useGenerationsByLatest({
|
|||
);
|
||||
|
||||
const continueSupported =
|
||||
latestMessage?.messageId === messageId &&
|
||||
latestMessageId === messageId &&
|
||||
finish_reason &&
|
||||
finish_reason !== 'stop' &&
|
||||
!isEditing &&
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue