From e21cdff88c39e5b46f6e5e88cea60012ce46c489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E4=BC=9F=E5=BC=BA?= Date: Mon, 22 May 2023 15:10:00 +0800 Subject: [PATCH] chore: handle app title installed --- web/app/components/header/index.tsx | 2 +- web/app/components/share/chat/index.tsx | 20 ++++++++------ .../share/chat/sidebar/app-info/index.tsx | 27 +++++++++++++++++++ .../components/share/chat/sidebar/index.tsx | 17 +++++++++--- .../components/share/chat/style.module.css | 2 +- web/config/index.ts | 2 ++ 6 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 web/app/components/share/chat/sidebar/app-info/index.tsx diff --git a/web/app/components/header/index.tsx b/web/app/components/header/index.tsx index 11b5859923..9149d5f69e 100644 --- a/web/app/components/header/index.tsx +++ b/web/app/components/header/index.tsx @@ -17,7 +17,7 @@ import { useDatasetsContext } from '@/context/datasets-context' const BuildAppsIcon = ({isSelected}: {isSelected: boolean}) => ( - + ) diff --git a/web/app/components/share/chat/index.tsx b/web/app/components/share/chat/index.tsx index 2fcba277a3..6d174fea20 100644 --- a/web/app/components/share/chat/index.tsx +++ b/web/app/components/share/chat/index.tsx @@ -444,6 +444,7 @@ const Main: FC = ({ currentId={currConversationId} copyRight={siteInfo.copyright || siteInfo.title} isInstalledApp={isInstalledApp} + siteInfo={siteInfo} /> ) } @@ -456,14 +457,17 @@ const Main: FC = ({ return (
-
handleConversationIdChange('-1')} - /> + {!isInstalledApp && ( +
handleConversationIdChange('-1')} + /> + )} + {/* {isNewConversation ? 'new' : 'exist'} {JSON.stringify(newConversationInputs ? newConversationInputs : {})} {JSON.stringify(existConversationInputs ? existConversationInputs : {})} */} diff --git a/web/app/components/share/chat/sidebar/app-info/index.tsx b/web/app/components/share/chat/sidebar/app-info/index.tsx new file mode 100644 index 0000000000..d3987faa90 --- /dev/null +++ b/web/app/components/share/chat/sidebar/app-info/index.tsx @@ -0,0 +1,27 @@ +'use client' +import React, { FC } from 'react' +import cn from 'classnames' +import { appDefaultIconBackground } from '@/config/index' +import AppIcon from '@/app/components/base/app-icon' + +export interface IAppInfoProps { + className?: string + icon: string + icon_background?: string + name: string +} + +const AppInfo: FC = ({ + className, + icon, + icon_background, + name +}) => { + return ( +
+ +
{name}
+
+ ) +} +export default React.memo(AppInfo) diff --git a/web/app/components/share/chat/sidebar/index.tsx b/web/app/components/share/chat/sidebar/index.tsx index 0333db8d41..e0bdc2befa 100644 --- a/web/app/components/share/chat/sidebar/index.tsx +++ b/web/app/components/share/chat/sidebar/index.tsx @@ -7,8 +7,9 @@ import { } from '@heroicons/react/24/outline' import { ChatBubbleOvalLeftEllipsisIcon as ChatBubbleOvalLeftEllipsisSolidIcon, } from '@heroicons/react/24/solid' import Button from '../../../base/button' +import AppInfo from '@/app/components/share/chat/sidebar/app-info' // import Card from './card' -import type { ConversationItem } from '@/models/share' +import type { ConversationItem, SiteInfo } from '@/models/share' function classNames(...classes: any[]) { return classes.filter(Boolean).join(' ') @@ -22,6 +23,7 @@ export type ISidebarProps = { onCurrentIdChange: (id: string) => void list: ConversationItem[] isInstalledApp: boolean + siteInfo: SiteInfo } const Sidebar: FC = ({ @@ -29,18 +31,27 @@ const Sidebar: FC = ({ currentId, onCurrentIdChange, list, - isInstalledApp + isInstalledApp, + siteInfo, }) => { const { t } = useTranslation() return (
+ {isInstalledApp && ( + + )} {list.length < MAX_CONVERSATION_LENTH && (