From 821a453f44a9712a99744920bfd73efb723b3d29 Mon Sep 17 00:00:00 2001 From: Mikita Butsko Date: Wed, 26 Jun 2024 12:35:46 +0200 Subject: [PATCH] fix: fix model displaying in empty chat --- apps/chat/src/components/Chat/Chat.tsx | 1 + .../components/Chat/EmptyChatDescription.tsx | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/chat/src/components/Chat/Chat.tsx b/apps/chat/src/components/Chat/Chat.tsx index 29dfd299ea..b14c1b7ae6 100644 --- a/apps/chat/src/components/Chat/Chat.tsx +++ b/apps/chat/src/components/Chat/Chat.tsx @@ -615,6 +615,7 @@ export const ChatView = memo(() => { )} > diff --git a/apps/chat/src/components/Chat/EmptyChatDescription.tsx b/apps/chat/src/components/Chat/EmptyChatDescription.tsx index 7097126528..5f2a50a618 100644 --- a/apps/chat/src/components/Chat/EmptyChatDescription.tsx +++ b/apps/chat/src/components/Chat/EmptyChatDescription.tsx @@ -1,20 +1,27 @@ import classNames from 'classnames'; -import { ConversationsSelectors } from '@/src/store/conversations/conversations.reducers'; +import { Conversation } from '@/src/types/chat'; + import { useAppSelector } from '@/src/store/hooks'; +import { ModelsSelectors } from '@/src/store/models/models.reducers'; import { Spinner } from '../Common/Spinner'; import { ModelDescription } from './ModelDescription'; interface Props { + conv: Conversation; modelsLoaded: boolean; appName: string; } -export const EmptyChatDescription = ({ modelsLoaded, appName }: Props) => { - const model = useAppSelector( - ConversationsSelectors.selectSelectedConversationsModels, - )[0]; +export const EmptyChatDescription = ({ + conv, + modelsLoaded, + appName, +}: Props) => { + const model = useAppSelector((state) => + ModelsSelectors.selectModel(state, conv.model.id), + ); const Tag = model ? 'div' : 'h4'; const showAppName = !model;