Skip to content

Commit

Permalink
fix(chat): fix error message on application delete (Issue #2021) (#2068)
Browse files Browse the repository at this point in the history
Co-authored-by: Magomed-Elbi Dzhukalaev <[email protected]>
Co-authored-by: Armen Derikyan <[email protected]>
  • Loading branch information
3 people authored Sep 10, 2024
1 parent 4fe0d94 commit d76ad4f
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions apps/chat/src/components/Chat/ModelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ import { SharingType } from '@/src/types/share';
import { Translation } from '@/src/types/translation';

import { ApplicationActions } from '@/src/store/application/application.reducers';
import {
ConversationsActions,
ConversationsSelectors,
} from '@/src/store/conversations/conversations.reducers';
import { useAppDispatch, useAppSelector } from '@/src/store/hooks';
import { ModelsSelectors } from '@/src/store/models/models.reducers';
import { SettingsSelectors } from '@/src/store/settings/settings.reducers';
Expand Down Expand Up @@ -319,9 +315,6 @@ export const ModelList = ({
const dispatch = useAppDispatch();

const modelsMap = useAppSelector(ModelsSelectors.selectModelsMap);
const selectedConversations = useAppSelector(
ConversationsSelectors.selectSelectedConversations,
);

const [modalIsOpen, setModalIsOpen] = useState(false);
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
Expand Down Expand Up @@ -369,32 +362,7 @@ export const ModelList = ({
const modelsMapKeys = Object.keys(modelsMap);

onSelect(recentModelsIds[1] ?? modelsMap[modelsMapKeys[0]]?.reference);
selectedConversations.forEach((conv) => {
if (
conv.model.id === currentEntity?.reference ||
conv.model.id === currentEntity?.id
) {
dispatch(
ConversationsActions.updateConversation({
id: conv.id,
values: {
model: {
id:
recentModelsIds[1] ?? modelsMap[modelsMapKeys[0]]?.reference,
},
},
}),
);
}
});
}, [
currentEntity,
modelsMap,
onSelect,
recentModelsIds,
selectedConversations,
dispatch,
]);
}, [currentEntity, modelsMap, onSelect, recentModelsIds, dispatch]);

const handleConfirmDialogClose = useCallback(
(result: boolean) => {
Expand Down

0 comments on commit d76ad4f

Please sign in to comment.