diff --git a/apps/chat/src/components/Chat/TalkTo/TalkToCard.tsx b/apps/chat/src/components/Chat/TalkTo/TalkToCard.tsx
index 7d6004337..360405d99 100644
--- a/apps/chat/src/components/Chat/TalkTo/TalkToCard.tsx
+++ b/apps/chat/src/components/Chat/TalkTo/TalkToCard.tsx
@@ -22,7 +22,6 @@ import {
isExecutableApp,
} from '@/src/utils/app/application';
import { getRootId } from '@/src/utils/app/id';
-import { isEntityIdPublic } from '@/src/utils/app/publications';
import { PseudoModel, isPseudoModel } from '@/src/utils/server/api';
import {
@@ -53,8 +52,7 @@ import { ApplicationTopic } from '@/src/components/Marketplace/ApplicationTopic'
import { FunctionStatusIndicator } from '@/src/components/Marketplace/FunctionStatusIndicator';
import LoaderIcon from '@/public/images/icons/loader.svg';
-import UnpublishIcon from '@/public/images/icons/unpublish.svg';
-import { Feature, PublishActions } from '@epam/ai-dial-shared';
+import { Feature } from '@epam/ai-dial-shared';
const DESKTOP_ICON_SIZE = 80;
const TABLET_ICON_SIZE = 48;
@@ -82,7 +80,7 @@ interface ApplicationCardProps {
disabled: boolean;
isUnavailableModel: boolean;
onClick: (entity: DialAIEntityModel) => void;
- onPublish: (entity: DialAIEntityModel, action: PublishActions) => void;
+ onPublish: (entity: DialAIEntityModel) => void;
onDelete: (entity: DialAIEntityModel) => void;
onEdit: (entity: DialAIEntityModel) => void;
onSelectVersion: (entity: DialAIEntityModel) => void;
@@ -159,7 +157,7 @@ export const TalkToCard = ({
const handleSelectVersion = useCallback(
(model: DialAIEntityModel) => {
- onSelectVersion?.(model);
+ onSelectVersion(model);
},
[onSelectVersion],
);
@@ -215,17 +213,7 @@ export const TalkToCard = ({
Icon: IconWorldShare,
onClick: (e: React.MouseEvent) => {
e.stopPropagation();
- onPublish?.(entity, PublishActions.ADD);
- },
- },
- {
- name: t('Unpublish'),
- dataQa: 'unpublish',
- display: isEntityIdPublic(entity) && !!onPublish,
- Icon: UnpublishIcon,
- onClick: (e: React.MouseEvent) => {
- e.stopPropagation();
- onPublish?.(entity, PublishActions.DELETE);
+ onPublish(entity);
},
},
{
@@ -326,7 +314,7 @@ export const TalkToCard = ({
{t('Version')}:
diff --git a/apps/chat/src/components/Chat/TalkTo/TalkToModal.tsx b/apps/chat/src/components/Chat/TalkTo/TalkToModal.tsx index d9434e8b7..c84951111 100644 --- a/apps/chat/src/components/Chat/TalkTo/TalkToModal.tsx +++ b/apps/chat/src/components/Chat/TalkTo/TalkToModal.tsx @@ -1,9 +1,5 @@ -import { - IconCaretLeftFilled, - IconCaretRightFilled, - IconSearch, -} from '@tabler/icons-react'; -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { IconSearch } from '@tabler/icons-react'; +import { useCallback, useMemo, useState } from 'react'; import { useDispatch } from 'react-redux'; import { useTranslation } from 'next-i18next'; @@ -11,9 +7,6 @@ import Link from 'next/link'; import classNames from 'classnames'; -import { useScreenState } from '@/src/hooks/useScreenState'; -import { useSwipe } from '@/src/hooks/useSwipe'; - import { getApplicationType } from '@/src/utils/app/application'; import { getConversationModelParams, @@ -21,10 +14,10 @@ import { } from '@/src/utils/app/conversation'; import { getFolderIdFromEntityId } from '@/src/utils/app/folders'; import { doesEntityContainSearchTerm } from '@/src/utils/app/search'; -import { ApiUtils, PseudoModel, isPseudoModel } from '@/src/utils/server/api'; +import { ApiUtils, PseudoModel } from '@/src/utils/server/api'; import { Conversation } from '@/src/types/chat'; -import { EntityType, ScreenState } from '@/src/types/common'; +import { EntityType } from '@/src/types/common'; import { ModalState } from '@/src/types/modal'; import { DialAIEntityModel } from '@/src/types/models'; import { SharingType } from '@/src/types/share'; @@ -44,121 +37,12 @@ import { PublishModal } from '@/src/components/Chat/Publish/PublishWizard'; import { ApplicationWizard } from '@/src/components/Common/ApplicationWizard/ApplicationWizard'; import { ConfirmDialog } from '@/src/components/Common/ConfirmDialog'; import Modal from '@/src/components/Common/Modal'; -import { NoResultsFound } from '@/src/components/Common/NoResultsFound'; import { ApplicationLogs } from '../../Marketplace/ApplicationLogs'; -import { TalkToCard } from './TalkToCard'; +import { TalkToSlider } from './TalkToSlider'; import { Feature, PublishActions, ShareEntity } from '@epam/ai-dial-shared'; -import chunk from 'lodash-es/chunk'; import orderBy from 'lodash-es/orderBy'; -import range from 'lodash-es/range'; - -const COMMON_GRID_TILES_GAP = 16; -const MOBILE_GRID_TILES_GAP = 12; -const getMaxChunksCountConfig = () => { - return { - [ScreenState.DESKTOP]: { - cardHeight: 166, - maxRows: 3, - cols: 3, - }, - [ScreenState.TABLET]: { - cardHeight: 160, - maxRows: 4, - cols: 2, - }, - [ScreenState.MOBILE]: { - cardHeight: 98, - maxRows: 5, - cols: 1, - }, - }; -}; -interface SliderModelsGroupProps { - modelsGroup: DialAIEntityModel[]; - conversation: Conversation; - screenState: ScreenState; - rowsCount: number; - onEditApplication: (entity: DialAIEntityModel) => void; - onDeleteApplication: (entity: DialAIEntityModel) => void; - onSetPublishEntity: ( - entity: DialAIEntityModel, - action: PublishActions, - ) => void; - onSelectModel: (entity: DialAIEntityModel) => void; - onOpenLogs: (entity: DialAIEntityModel) => void; -} -const SliderModelsGroup = ({ - modelsGroup, - conversation, - screenState, - rowsCount, - onEditApplication, - onDeleteApplication, - onSetPublishEntity, - onSelectModel, - onOpenLogs, -}: SliderModelsGroupProps) => { - const config = getMaxChunksCountConfig(); - - const modelsMap = useAppSelector(ModelsSelectors.selectModelsMap); - - return ( -