zxhlyh преди 1 година
родител
ревизия
61e816f24c
променени са 34 файла, в които са добавени 101 реда и са изтрити 160 реда
  1. 13 9
      web/app/components/app/chat/answer/index.tsx
  2. 4 4
      web/app/components/app/chat/index.tsx
  3. 18 0
      web/app/components/base/logo/logo-embeded-chat-avatar.tsx
  4. 18 0
      web/app/components/base/logo/logo-embeded-chat-header.tsx
  5. 18 0
      web/app/components/base/logo/logo-site.tsx
  6. 0 13
      web/app/components/header/account-about/index.module.css
  7. 3 7
      web/app/components/header/account-about/index.tsx
  8. 13 9
      web/app/components/header/account-dropdown/index.tsx
  9. 0 9
      web/app/components/header/account-setting/members-page/index.module.css
  10. 0 3
      web/app/components/header/account-setting/members-page/index.tsx
  11. BIN
      web/app/components/header/assets/logo-icon.png
  12. 0 6
      web/app/components/header/assets/logo-text.svg
  13. BIN
      web/app/components/header/assets/logo.png
  14. 0 7
      web/app/components/header/index.module.css
  15. 2 3
      web/app/components/header/index.tsx
  16. BIN
      web/app/components/share/chat/welcome/icons/logo.png
  17. 2 1
      web/app/components/share/chat/welcome/massive-component.tsx
  18. 0 7
      web/app/components/share/chat/welcome/style.module.css
  19. 0 22
      web/app/components/share/chatbot/icons/dify-header.svg
  20. 0 11
      web/app/components/share/chatbot/icons/dify.svg
  21. 4 2
      web/app/components/share/chatbot/index.tsx
  22. 0 11
      web/app/components/share/chatbot/style.module.css
  23. BIN
      web/app/components/share/chatbot/welcome/icons/logo.png
  24. 2 1
      web/app/components/share/chatbot/welcome/massive-component.tsx
  25. 0 7
      web/app/components/share/chatbot/welcome/style.module.css
  26. 1 0
      web/app/layout.tsx
  27. 2 2
      web/app/signin/_header.tsx
  28. 0 5
      web/app/signin/assets/logo-icon.svg
  29. 0 14
      web/app/signin/assets/logo-text.svg
  30. 0 7
      web/app/signin/page.module.css
  31. 1 0
      web/docker/entrypoint.sh
  32. BIN
      web/public/logo/logo-embeded-chat-avatar.png
  33. BIN
      web/public/logo/logo-embeded-chat-header.png
  34. BIN
      web/public/logo/logo-site.png

+ 13 - 9
web/app/components/app/chat/answer/index.tsx

@@ -1,5 +1,5 @@
 'use client'
-import type { FC } from 'react'
+import type { FC, ReactNode } from 'react'
 import React, { useState } from 'react'
 import { useTranslation } from 'react-i18next'
 import { useContext } from 'use-context-selector'
@@ -44,7 +44,7 @@ export type IAnswerProps = {
   onSubmitAnnotation?: SubmitAnnotationFunc
   displayScene: DisplayScene
   isResponsing?: boolean
-  answerIconClassName?: string
+  answerIcon?: ReactNode
   thoughts?: ThoughtItem[]
   citation?: CitationItem[]
   isThinking?: boolean
@@ -53,7 +53,7 @@ export type IAnswerProps = {
   isShowCitationHitInfo?: boolean
 }
 // The component needs to maintain its own state to control whether to display input component
-const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedbackEdit = false, onFeedback, onSubmitAnnotation, displayScene = 'web', isResponsing, answerIconClassName, thoughts, citation, isThinking, dataSets, isShowCitation, isShowCitationHitInfo = false }) => {
+const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedbackEdit = false, onFeedback, onSubmitAnnotation, displayScene = 'web', isResponsing, answerIcon, thoughts, citation, isThinking, dataSets, isShowCitation, isShowCitationHitInfo = false }) => {
   const { id, content, more, feedback, adminFeedback, annotation: initAnnotation } = item
   const [showEdit, setShowEdit] = useState(false)
   const [loading, setLoading] = useState(false)
@@ -168,13 +168,17 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
   return (
     <div key={id}>
       <div className='flex items-start'>
-        <div className={`${s.answerIcon} ${answerIconClassName} w-10 h-10 shrink-0`}>
-          {isResponsing
-            && <div className={s.typeingIcon}>
-              <LoadingAnim type='avatar' />
+        {
+          answerIcon || (
+            <div className={`${s.answerIcon} w-10 h-10 shrink-0`}>
+              {isResponsing
+                && <div className={s.typeingIcon}>
+                  <LoadingAnim type='avatar' />
+                </div>
+              }
             </div>
-          }
-        </div>
+          )
+        }
         <div className={cn(s.answerWrapWrap, 'chat-answer-container')}>
           <div className={`${s.answerWrap} ${showEdit ? 'w-full' : ''}`}>
             <div className={`${s.answer} relative text-sm text-gray-900`}>

+ 4 - 4
web/app/components/app/chat/index.tsx

@@ -1,5 +1,5 @@
 'use client'
-import type { FC } from 'react'
+import type { FC, ReactNode } from 'react'
 import React, { useEffect, useLayoutEffect, useRef, useState } from 'react'
 import { useContext } from 'use-context-selector'
 import cn from 'classnames'
@@ -49,7 +49,7 @@ export type IChatProps = {
   suggestionList?: string[]
   isShowSpeechToText?: boolean
   isShowCitation?: boolean
-  answerIconClassName?: string
+  answerIcon?: ReactNode
   isShowConfigElem?: boolean
   dataSets?: DataSet[]
   isShowCitationHitInfo?: boolean
@@ -78,7 +78,7 @@ const Chat: FC<IChatProps> = ({
   suggestionList,
   isShowSpeechToText,
   isShowCitation,
-  answerIconClassName,
+  answerIcon,
   isShowConfigElem,
   dataSets,
   isShowCitationHitInfo,
@@ -179,7 +179,7 @@ const Chat: FC<IChatProps> = ({
               onSubmitAnnotation={onSubmitAnnotation}
               displayScene={displayScene ?? 'web'}
               isResponsing={isResponsing && isLast}
-              answerIconClassName={answerIconClassName}
+              answerIcon={answerIcon}
               thoughts={thoughts}
               citation={citation}
               isThinking={isThinking}

+ 18 - 0
web/app/components/base/logo/logo-embeded-chat-avatar.tsx

@@ -0,0 +1,18 @@
+import type { FC } from 'react'
+
+type LogoEmbededChatAvatarProps = {
+  className?: string
+}
+const LogoEmbededChatAvatar: FC<LogoEmbededChatAvatarProps> = ({
+  className,
+}) => {
+  return (
+    <img
+      src='/logo/logo-embeded-chat-avatar.png'
+      className={`block w-10 h-10 ${className}`}
+      alt='logo'
+    />
+  )
+}
+
+export default LogoEmbededChatAvatar

+ 18 - 0
web/app/components/base/logo/logo-embeded-chat-header.tsx

@@ -0,0 +1,18 @@
+import type { FC } from 'react'
+
+type LogoEmbededChatHeaderProps = {
+  className?: string
+}
+const LogoEmbededChatHeader: FC<LogoEmbededChatHeaderProps> = ({
+  className,
+}) => {
+  return (
+    <img
+      src='/logo/logo-embeded-chat-header.png'
+      className={`block w-auto h-6 ${className}`}
+      alt='logo'
+    />
+  )
+}
+
+export default LogoEmbededChatHeader

+ 18 - 0
web/app/components/base/logo/logo-site.tsx

@@ -0,0 +1,18 @@
+import type { FC } from 'react'
+
+type LogoSiteProps = {
+  className?: string
+}
+const LogoSite: FC<LogoSiteProps> = ({
+  className,
+}) => {
+  return (
+    <img
+      src='/logo/logo-site.png'
+      className={`block w-auto h-10 ${className}`}
+      alt='logo'
+    />
+  )
+}
+
+export default LogoSite

+ 0 - 13
web/app/components/header/account-about/index.module.css

@@ -1,16 +1,3 @@
-.logo-icon {
-  background: url(../assets/logo-icon.png) center center no-repeat;
-  background-size: 32px;
-  box-shadow: 0px 2px 4px -2px rgba(0, 0, 0, 0.05), 0px 4px 6px -1px rgba(0, 0, 0, 0.05);
-}
-
-.logo-text {
-  width: 74.09px;
-  height: 15.32px;
-  background: url(../assets/logo-text.svg) center center no-repeat;
-  background-size: contain;
-}
-
 .modal {
   max-width: 480px !important;
   width: 480px !important;

+ 3 - 7
web/app/components/header/account-about/index.tsx

@@ -6,10 +6,10 @@ import { useContext } from 'use-context-selector'
 import s from './index.module.css'
 import Modal from '@/app/components/base/modal'
 import { XClose } from '@/app/components/base/icons/src/vender/line/general'
-import { Dify } from '@/app/components/base/icons/src/public/common'
 import type { LangGeniusVersionResponse } from '@/models/common'
 import { IS_CE_EDITION } from '@/config'
 import I18n from '@/context/i18n'
+import LogoSite from '@/app/components/base/logo/logo-site'
 
 type IAccountSettingProps = {
   langeniusVersionInfo: LangGeniusVersionResponse
@@ -33,16 +33,12 @@ export default function AccountAbout({
       onClose={() => { }}
       className={s.modal}
     >
-      <div className='relative'>
+      <div className='relative pt-4'>
         <div className='absolute -top-2 -right-4 flex justify-center items-center w-8 h-8 cursor-pointer' onClick={onCancel}>
           <XClose className='w-4 h-4 text-gray-500' />
         </div>
         <div>
-          <div className={classNames(
-            s['logo-icon'],
-            'mx-auto mb-3 w-12 h-12 bg-white rounded-xl border-[0.5px] border-gray-200',
-          )} />
-          <Dify className='mx-auto mb-2' />
+          <LogoSite className='mx-auto mb-2' />
           <div className='mb-3 text-center text-xs font-normal text-gray-500'>Version {langeniusVersionInfo?.current_version}</div>
           <div className='mb-4 text-center text-xs font-normal text-gray-700'>
             <div>© 2023 LangGenius, Inc., Contributors.</div>

+ 13 - 9
web/app/components/header/account-dropdown/index.tsx

@@ -104,15 +104,19 @@ export default function AppSelector() {
                         <ArrowUpRight className='hidden w-[14px] h-[14px] text-gray-500 group-hover:flex' />
                       </Link>
                     </Menu.Item>
-                    <Menu.Item>
-                      <div className={classNames(itemClassName, 'justify-between')} onClick={() => setAboutVisible(true)}>
-                        <div>{t('common.userProfile.about')}</div>
-                        <div className='flex items-center'>
-                          <div className='mr-2 text-xs font-normal text-gray-500'>{langeniusVersionInfo.current_version}</div>
-                          <Indicator color={langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version ? 'green' : 'orange'} />
-                        </div>
-                      </div>
-                    </Menu.Item>
+                    {
+                      document?.body?.getAttribute('data-public-site-about') !== 'hide' && (
+                        <Menu.Item>
+                          <div className={classNames(itemClassName, 'justify-between')} onClick={() => setAboutVisible(true)}>
+                            <div>{t('common.userProfile.about')}</div>
+                            <div className='flex items-center'>
+                              <div className='mr-2 text-xs font-normal text-gray-500'>{langeniusVersionInfo.current_version}</div>
+                              <Indicator color={langeniusVersionInfo.current_version === langeniusVersionInfo.latest_version ? 'green' : 'orange'} />
+                            </div>
+                          </div>
+                        </Menu.Item>
+                      )
+                    }
                   </div>
                   <Menu.Item>
                     <div className='p-1' onClick={() => handleLogout()}>

+ 0 - 9
web/app/components/header/account-setting/members-page/index.module.css

@@ -1,9 +0,0 @@
-.logo-icon {
-  width: 40px;
-  height: 40px;
-  background: #ffffff url(../../assets/logo-icon.png) center center no-repeat;
-  background-size: contain;
-  box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
-  border-radius: 8px;
-  border: 0.5px solid rgba(0, 0, 0, 0.05);
-}

+ 0 - 3
web/app/components/header/account-setting/members-page/index.tsx

@@ -1,6 +1,5 @@
 'use client'
 import { useState } from 'react'
-import cn from 'classnames'
 import useSWR from 'swr'
 import dayjs from 'dayjs'
 import 'dayjs/locale/zh-cn'
@@ -8,7 +7,6 @@ import relativeTime from 'dayjs/plugin/relativeTime'
 import { useContext } from 'use-context-selector'
 import { UserPlusIcon } from '@heroicons/react/24/outline'
 import { useTranslation } from 'react-i18next'
-import s from './index.module.css'
 import InviteModal from './invite-modal'
 import InvitedModal from './invited-modal'
 import Operation from './operation'
@@ -40,7 +38,6 @@ const MembersPage = () => {
     <>
       <div>
         <div className='flex items-center mb-4 p-3 bg-gray-50 rounded-2xl'>
-          <div className={cn(s['logo-icon'], 'shrink-0')}></div>
           <div className='grow mx-2'>
             <div className='text-sm font-medium text-gray-900'>{currentWorkspace?.name}</div>
             <div className='text-xs text-gray-500'>{t('common.userProfile.workspace')}</div>

BIN
web/app/components/header/assets/logo-icon.png


Файловите разлики са ограничени, защото са твърде много
+ 0 - 6
web/app/components/header/assets/logo-text.svg


BIN
web/app/components/header/assets/logo.png


+ 0 - 7
web/app/components/header/index.module.css

@@ -8,13 +8,6 @@
   border-top: 4px solid #06AED4;
 }
 
-.logo {
-  width: 96px;
-  height: 40px;
-  background: url(~@/app/components/share/chat/welcome/icons/logo.png) center center no-repeat;
-  background-size: contain;
-}
-
 .alpha {
   width: 12px;
   height: 12px;

+ 2 - 3
web/app/components/header/index.tsx

@@ -8,9 +8,9 @@ import EnvNav from './env-nav'
 import ExploreNav from './explore-nav'
 import GithubStar from './github-star'
 import PluginNav from './plugin-nav'
-import s from './index.module.css'
 import { WorkspaceProvider } from '@/context/workspace-context'
 import { useAppContext } from '@/context/app-context'
+import LogoSite from '@/app/components/base/logo/logo-site'
 
 const navClassName = `
   flex items-center relative mr-3 px-3 h-8 rounded-xl
@@ -24,9 +24,8 @@ const Header = () => {
     <>
       <div className='flex items-center'>
         <Link href="/apps" className='flex items-center mr-4'>
-          <div className={s.logo} />
+          <LogoSite />
         </Link>
-        {/* @ts-expect-error Async Server Component */}
         <GithubStar />
       </div>
       <div className='flex items-center'>

BIN
web/app/components/share/chat/welcome/icons/logo.png


+ 2 - 1
web/app/components/share/chat/welcome/massive-component.tsx

@@ -9,6 +9,7 @@ import {
 import s from './style.module.css'
 import type { SiteInfo } from '@/models/share'
 import Button from '@/app/components/base/button'
+import LogoSite from '@/app/components/base/logo/logo-site'
 
 export const AppInfo: FC<{ siteInfo: SiteInfo }> = ({ siteInfo }) => {
   return (
@@ -69,5 +70,5 @@ export const EditBtn = ({ className, onClick }: { className?: string; onClick: (
 }
 
 export const FootLogo = () => (
-  <div className={s.logo} />
+  <LogoSite className='!h-5' />
 )

+ 0 - 7
web/app/components/share/chat/welcome/style.module.css

@@ -19,11 +19,4 @@
 
 .customBtn {
   width: 136px;
-}
-
-.logo {
-  width: 48px;
-  height: 20px;
-  background: url(./icons/logo.png) center center no-repeat;
-  background-size: contain;
 }

Файловите разлики са ограничени, защото са твърде много
+ 0 - 22
web/app/components/share/chatbot/icons/dify-header.svg


Файловите разлики са ограничени, защото са твърде много
+ 0 - 11
web/app/components/share/chatbot/icons/dify.svg


+ 4 - 2
web/app/components/share/chatbot/index.tsx

@@ -26,6 +26,8 @@ import { replaceStringWithValues } from '@/app/components/app/configuration/prom
 import { userInputsFormToPromptVariables } from '@/utils/model-config'
 import type { InstalledApp } from '@/models/explore'
 import { AlertTriangle } from '@/app/components/base/icons/src/vender/solid/alertsAndFeedback'
+import LogoHeader from '@/app/components/base/logo/logo-embeded-chat-header'
+import LogoAvatar from '@/app/components/base/logo/logo-embeded-chat-avatar'
 
 export type IMainProps = {
   isInstalledApp?: boolean
@@ -488,7 +490,7 @@ const Main: FC<IMainProps> = ({
   }
 
   const difyIcon = (
-    <div className={s.difyHeader}></div>
+    <LogoHeader />
   )
 
   if (appUnavailable)
@@ -567,7 +569,7 @@ const Main: FC<IMainProps> = ({
                     suggestionList={suggestQuestions}
                     displayScene='web'
                     isShowSpeechToText={speechToTextConfig?.enabled}
-                    answerIconClassName={s.difyIcon}
+                    answerIcon={<LogoAvatar className='relative shrink-0' />}
                   />
                 </div>
               </div>)

+ 0 - 11
web/app/components/share/chatbot/style.module.css

@@ -1,14 +1,3 @@
 .installedApp {
   height: calc(100vh - 74px);
-}
-
-.difyIcon {
-  background-image: url(./icons/dify.svg);
-}
-
-.difyHeader {
-  width: 24px;
-  height: 24px;
-  background: url(./icons/dify-header.svg) center center no-repeat;
-  background-size: contain;
 }

BIN
web/app/components/share/chatbot/welcome/icons/logo.png


+ 2 - 1
web/app/components/share/chatbot/welcome/massive-component.tsx

@@ -9,6 +9,7 @@ import {
 import s from './style.module.css'
 import type { SiteInfo } from '@/models/share'
 import Button from '@/app/components/base/button'
+import LogoSite from '@/app/components/base/logo/logo-site'
 
 export const AppInfo: FC<{ siteInfo: SiteInfo }> = ({ siteInfo }) => {
   const { t } = useTranslation()
@@ -70,5 +71,5 @@ export const EditBtn = ({ className, onClick }: { className?: string; onClick: (
 }
 
 export const FootLogo = () => (
-  <div className={s.logo} />
+  <LogoSite className='!h-5' />
 )

+ 0 - 7
web/app/components/share/chatbot/welcome/style.module.css

@@ -19,11 +19,4 @@
 
 .customBtn {
   width: 136px;
-}
-
-.logo {
-  width: 48px;
-  height: 20px;
-  background: url(./icons/logo.png) center center no-repeat;
-  background-size: contain;
 }

+ 1 - 0
web/app/layout.tsx

@@ -26,6 +26,7 @@ const LocaleLayout = ({
         data-public-edition={process.env.NEXT_PUBLIC_EDITION}
         data-public-sentry-dsn={process.env.NEXT_PUBLIC_SENTRY_DSN}
         data-public-maintenance-notice={process.env.NEXT_PUBLIC_MAINTENANCE_NOTICE}
+        data-public-site-about={process.env.NEXT_PUBLIC_SITE_ABOUT}
       >
         <BrowerInitor>
           <SentryInitor>

+ 2 - 2
web/app/signin/_header.tsx

@@ -1,10 +1,10 @@
 'use client'
 import React from 'react'
 import { useContext } from 'use-context-selector'
-import style from './page.module.css'
 import Select, { LOCALES } from '@/app/components/base/select/locale'
 import { type Locale } from '@/i18n'
 import I18n from '@/context/i18n'
+import LogoSite from '@/app/components/base/logo/logo-site'
 
 const Header = () => {
   const { locale, setLocaleOnClient } = useContext(I18n)
@@ -13,7 +13,7 @@ const Header = () => {
     localStorage.removeItem('console_token')
 
   return <div className='flex items-center justify-between p-6 w-full'>
-    <div className={style.logo}></div>
+    <LogoSite />
     <Select
       value={locale}
       items={LOCALES}

Файловите разлики са ограничени, защото са твърде много
+ 0 - 5
web/app/signin/assets/logo-icon.svg


Файловите разлики са ограничени, защото са твърде много
+ 0 - 14
web/app/signin/assets/logo-text.svg


+ 0 - 7
web/app/signin/page.module.css

@@ -6,13 +6,6 @@
   background: center/contain url('./assets/google.svg');
 }
 
-.logo {
-  width: 96px;
-  height: 40px;
-  background: url(~@/app/components/share/chat/welcome/icons/logo.png) center center no-repeat;
-  background-size: contain;
-}
-
 .background {
   background-image: url('./assets/background.png');
   background-size: cover;

+ 1 - 0
web/docker/entrypoint.sh

@@ -18,5 +18,6 @@ else
 fi
 
 export NEXT_PUBLIC_SENTRY_DSN=${SENTRY_DSN}
+export NEXT_PUBLIC_SITE_ABOUT=${SITE_ABOUT}
 
 node ./server.js

BIN
web/public/logo/logo-embeded-chat-avatar.png


BIN
web/public/logo/logo-embeded-chat-header.png


BIN
web/public/logo/logo-site.png