= () => {
const { currentChat } = useCurrentChat()
+ const { closeEvent, events } = useEventSource()
+
+ useEffect(() => {
+ console.log('events::', events)
+ }, [events])
+
useEffect(() => {
if (!currentChat || !loaded) return
+ console.log('change')
+ closeEvent('chat-bot')
makeEvent('chat-bot')
}, [currentChat, loaded])
@@ -0,0 +1,73 @@
+.model {
+ padding: 10px 12px;
+ border-radius: 15px;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+ background-color: var(--new-ui-main-color);
+ width: max-content;
+ position: absolute;
+ top: 0;
+ left: 50%;
+ transform: translateX(-50%);
+ z-index: 3;
+
+ @media screen and (max-width: 1200px) {
+ top: 30px;
+ }
+}
+
+.popup {
+ position: absolute;
+ top: 50%;
+ right: 20px;
+ transform: translateY(-50%);
+ z-index: 2;
+}
+
+.messages {
+ z-index: 2;
+ height: calc(100dvh - 20px - 20px - 40px - 25px);
+ overflow-y: scroll;
+}
+
+.input {
+ position: absolute;
+ bottom: 20px;
+ left: 50%;
+ transform: translateX(-50%);
+ z-index: 2;
+
+ @media screen and (max-width: 800px) {
+ bottom: -10px;
+ }
+}
+
+.shape {
+ height: 100px;
+ position: absolute;
+ filter: blur(10px);
+ width: 100%;
+ left: 0;
+ right: 0;
+ background: linear-gradient(
+ 180deg,
+ var(--new-ui-bg-app-color) 0%,
+ var(--new-ui-bg-app-color) 30%,
+ rgba(255, 255, 255, 0) 100%
+ );
+ z-index: 1;
+ &_top {
+ top: 0px;
+ }
+
+ &_bottom {
+ bottom: -20px;
+ transform: rotate(180deg);
+ }
+}
+
+.container {
+ padding-top: 20px;
+ position: relative;
+}
@@ -0,0 +1,78 @@
+import * as React from 'react'
+import { useRouter } from 'next/router'
+import { useSession } from 'next-auth/react'
+import { Error } from '#/shared'
+import { ImageMessagesList } from '#/widgets/messages/ui/image-messages-list'
+import { c, getDeviceType } from '#/shared/lib/helpers'
+import Head from 'next/head'
+
+import styles from './image-model.module.scss'
+import { NextPageWithLayout } from '#/pages/_app'
+import { useImageBot } from '#/entities/model-entity/model/use-image-bot'
+import { ImageModelsSelect } from '#/widgets/image-models-popup'
+
+import { ImageInput } from '#/features/image-models-input'
+import { useEffect, useRef } from 'react'
+import { useMessagesStore } from '#/widgets/messages'
+import { ImagesEmpty } from '#/widgets/image-messages'
+import { MessageFastChoiceMenu } from '#/features/message-fast-choice-menu'
+import { useShowDataStore } from '#/shared/lib/hooks'
+
+const ImageModelPage: NextPageWithLayout = () => {
+ const { query } = useRouter()
+
+ const { botParams, inference, fetchBotParams } = useImageBot()
+
+ const container = useRef
(null)
+
+ const deviceType = getDeviceType()
+
+ const { data: session } = useSession()
+
+ const { messages, loading } = useMessagesStore()
+
+ async function onFetch() {
+ await Promise.all([fetchBotParams()])
+ }
+
+ useEffect(() => {
+ onFetch()
+ }, [session, query])
+
+ return (
+
+
+
Модель {botParams ? botParams.title : 'Загрузка...'}
+
+
+
+
+
+ {!loading && messages.length === 0 ? (
+
+ ) : (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+export default ImageModelPage
@@ -0,0 +1 @@
+export { default as ImageModelPage } from './image-model'
@@ -0,0 +1 @@
+export * from './ui'
\ No newline at end of file
@@ -0,0 +1 @@
+export * from './use-image-bots'
\ No newline at end of file
@@ -0,0 +1,27 @@
+import { ShortModel, getImageBots } from '#/entities/model-entity'
+import { withPending } from '#/shared'
+import { makePrivateRequest } from '#/shared/api'
+import { useShowDataStore } from '#/shared/lib/hooks'
+import { useState } from 'react'
+
+export function useImageBots() {
+ const [bots, setBots] = useState([])
+
+ const { showMessage } = useShowDataStore()
+
+ const [fetchImageBots, pending] = withPending(
+ makePrivateRequest(async () => {
+ const { data, status } = await getImageBots()
+
+ if (status !== 200) return showMessage('Ошибка при получении чат ботов')
+
+ setBots(data)
+ })
+ )
+
+ return {
+ pending,
+ fetchImageBots,
+ bots,
+ }
+}
\ No newline at end of file
@@ -0,0 +1,151 @@
+.container {
+ width: 100%;
+ border-radius: 15px;
+ height: 100%;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ background-color: var(--new-ui-main-color);
+ opacity: 0;
+ z-index: -1;
+ transition: all 0.3s ease-in-out;
+
+ &_active {
+ opacity: 1;
+ z-index: 100;
+ }
+}
+
+.header {
+ width: 70%;
+ margin-bottom: 50px;
+
+ @media screen and (max-width: 768px) {
+ width: 100%;
+ margin-bottom: 0px;
+ }
+}
+
+@keyframes fadein {
+ 0% {
+ opacity: 0;
+ }
+ 50% {
+ opacity: 0;
+ }
+ 100% {
+ opacity: 1;
+ }
+}
+
+// .blocked {
+// display: flex;
+// align-items: center;
+// justify-content: center;
+// background-color: white;
+// border-radius: 100px;
+// padding-right: 20px;
+// padding: 8px 12px;
+// width: max-content;
+
+// span {
+// color: #ff2372;
+// font-weight: 500;
+// padding-left: 10px;
+// font-size: 14px;
+// width: max-content;
+// }
+// }
+
+.icon {
+}
+
+.tags {
+ min-width: 100%;
+ display: flex;
+ gap: 8px;
+ align-items: center;
+ justify-content: flex-end;
+
+ @media screen and (max-width: 768px) {
+ justify-content: flex-start;
+ }
+}
+
+.tag {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background-color: white;
+ border-radius: 100px;
+ width: 50px;
+ height: 50px;
+ box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.1);
+ transition: width 0.3s ease-in-out;
+
+ @media screen and (max-width: 768px) {
+ height: 40px;
+ width: 40px;
+ }
+
+ &__icon {
+ color: var(--air-color);
+ }
+
+ &:hover {
+ padding: 12px;
+ width: 200px;
+
+ .tag__icon {
+ animation: fadein 0.6s ease-in-out;
+ }
+
+ .tag__text {
+ opacity: 1;
+ position: static;
+ animation: fadein 0.6s ease-in-out;
+ display: block;
+ }
+ }
+
+ &__text {
+ position: absolute;
+ color: var(--air-color);
+ font-weight: 500;
+ padding-left: 10px;
+ font-size: 14px;
+ opacity: 0;
+ display: none;
+ min-width: max-content !important;
+ }
+}
+
+.blocked {
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ background-color: #c32528;
+ padding: 20px;
+ gap: 10px;
+ position: absolute;
+
+ left: 0;
+
+ width: 100%;
+ border-radius: 15px;
+ top: 0;
+
+ @media screen and (max-width: 768px) {
+ top: unset;
+ // bottom: -22px;
+ z-index: 1;
+ border-radius: 15px;
+ }
+
+ &__text {
+ color: white !important;
+ font-size: 16px;
+ font-weight: 600;
+ }
+}
@@ -0,0 +1,250 @@
+import { useEffect } from 'react'
+import { Box, Stack } from '@mui/material'
+import Head from 'next/head'
+import { useRouter } from 'next/router'
+
+import styles from './image-model.module.scss'
+
+import BlockedSvg from '#/assets/svg/blocked.svg?react'
+import { useImageBot } from '#/entities/model-entity/model/use-image-bot'
+import { useImageBotCreateImage } from '#/features/image-bot-create-image'
+import { useImagesBotFilters } from '#/features/image-bot-filters'
+import { useImageBotPagination, useImageBotPaginationOld } from '#/features/image-bot-pagination'
+import { NextPageWithLayout } from '#/pages/_app'
+import { Loader } from '#/shared'
+import { c, getDeviceType, getOs } from '#/shared/lib/helpers'
+import { useThemeAndDevice } from '#/shared/lib/hooks'
+import { SvgIcon } from '#/shared/ui/svg'
+import { ImageMessagesList, ImageMessagesListOld } from '#/widgets/messages'
+import { ModelInput } from '#/features/model-input'
+import { useShowDataStore } from '#/shared/lib/hooks/use-show-data'
+import { CommonTitle } from '#/shared/ui/title'
+import { ImageModelOptions } from '#/widgets/image-model-options'
+import { useImageBotInput } from '#/features/image-bot-input'
+import { POPUP_IMAGE_BOT_PARAMS, getPopupById } from '#/shared/ui/popup'
+
+const ImageModelPage: NextPageWithLayout = () => {
+ const { botParams, fetchBotParams } = useImageBot()
+
+ const deviceType = getDeviceType()
+
+ const deviceOs = getOs()
+
+ const { desktop } = useThemeAndDevice(deviceType, deviceOs)
+
+ const {
+ refScrollMobile,
+ refScrollDesktop,
+ mobileScrollContainer,
+ onObserverMounted,
+ fetchMessages,
+ loading,
+ offset,
+ messages,
+ } = useImageBotPaginationOld(deviceType)
+
+ const { createImage } = useImageBotCreateImage(deviceType, mobileScrollContainer, offset)
+
+ const { onSendMessage, file, setFile, valueInput, setValueInput, inputTypes, requiredTypes } =
+ useImageBotInput(createImage)
+
+ async function onFetch() {
+ await Promise.all([fetchBotParams()])
+ }
+
+ const popup = getPopupById(POPUP_IMAGE_BOT_PARAMS)
+
+ useEffect(() => {
+ onFetch()
+ onObserverMounted()
+ }, [])
+
+ return (
+ <>
+
+ {botParams ? botParams?.title : 'Загрузка...'}
+
+
+
+ {botParams &&
+ botParams.tags.map((tag, index) => (
+
+
+
+ {tag.title}
+
+ ))}
+
+ }
+ />
+
+