mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 08:09:04 +08:00
fix: change chatbot avart to dify icon (#571)
This commit is contained in:
parent
2c6e00174b
commit
510389909c
@ -65,6 +65,7 @@ export type IChatProps = {
|
|||||||
isShowSuggestion?: boolean
|
isShowSuggestion?: boolean
|
||||||
suggestionList?: string[]
|
suggestionList?: string[]
|
||||||
isShowSpeechToText?: boolean
|
isShowSpeechToText?: boolean
|
||||||
|
answerIconClassName?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MessageMore = {
|
export type MessageMore = {
|
||||||
@ -174,10 +175,11 @@ type IAnswerProps = {
|
|||||||
onSubmitAnnotation?: SubmitAnnotationFunc
|
onSubmitAnnotation?: SubmitAnnotationFunc
|
||||||
displayScene: DisplayScene
|
displayScene: DisplayScene
|
||||||
isResponsing?: boolean
|
isResponsing?: boolean
|
||||||
|
answerIconClassName?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
// The component needs to maintain its own state to control whether to display input component
|
// 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 }) => {
|
const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedbackEdit = false, onFeedback, onSubmitAnnotation, displayScene = 'web', isResponsing, answerIconClassName }) => {
|
||||||
const { id, content, more, feedback, adminFeedback, annotation: initAnnotation } = item
|
const { id, content, more, feedback, adminFeedback, annotation: initAnnotation } = item
|
||||||
const [showEdit, setShowEdit] = useState(false)
|
const [showEdit, setShowEdit] = useState(false)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
@ -292,7 +294,7 @@ const Answer: FC<IAnswerProps> = ({ item, feedbackDisabled = false, isHideFeedba
|
|||||||
return (
|
return (
|
||||||
<div key={id}>
|
<div key={id}>
|
||||||
<div className='flex items-start'>
|
<div className='flex items-start'>
|
||||||
<div className={`${s.answerIcon} w-10 h-10 shrink-0`}>
|
<div className={`${s.answerIcon} ${answerIconClassName} w-10 h-10 shrink-0`}>
|
||||||
{isResponsing
|
{isResponsing
|
||||||
&& <div className={s.typeingIcon}>
|
&& <div className={s.typeingIcon}>
|
||||||
<LoadingAnim type='avatar' />
|
<LoadingAnim type='avatar' />
|
||||||
@ -428,6 +430,7 @@ const Chat: FC<IChatProps> = ({
|
|||||||
isShowSuggestion,
|
isShowSuggestion,
|
||||||
suggestionList,
|
suggestionList,
|
||||||
isShowSpeechToText,
|
isShowSpeechToText,
|
||||||
|
answerIconClassName,
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { notify } = useContext(ToastContext)
|
const { notify } = useContext(ToastContext)
|
||||||
@ -520,6 +523,7 @@ const Chat: FC<IChatProps> = ({
|
|||||||
onSubmitAnnotation={onSubmitAnnotation}
|
onSubmitAnnotation={onSubmitAnnotation}
|
||||||
displayScene={displayScene ?? 'web'}
|
displayScene={displayScene ?? 'web'}
|
||||||
isResponsing={isResponsing && isLast}
|
isResponsing={isResponsing && isLast}
|
||||||
|
answerIconClassName={answerIconClassName}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
return <Question key={item.id} id={item.id} content={item.content} more={item.more} useCurrentUserAvatar={useCurrentUserAvatar} />
|
return <Question key={item.id} id={item.id} content={item.content} more={item.more} useCurrentUserAvatar={useCurrentUserAvatar} />
|
||||||
|
22
web/app/components/share/chatbot/icons/dify-header.svg
Normal file
22
web/app/components/share/chatbot/icons/dify-header.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 52 KiB |
11
web/app/components/share/chatbot/icons/dify.svg
Normal file
11
web/app/components/share/chatbot/icons/dify.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 52 KiB |
@ -552,6 +552,10 @@ const Main: FC<IMainProps> = ({
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const difyIcon = (
|
||||||
|
<div className={s.difyHeader}></div>
|
||||||
|
)
|
||||||
|
|
||||||
if (appUnavailable)
|
if (appUnavailable)
|
||||||
return <AppUnavailable isUnknwonReason={isUnknwonReason} />
|
return <AppUnavailable isUnknwonReason={isUnknwonReason} />
|
||||||
|
|
||||||
@ -562,7 +566,8 @@ const Main: FC<IMainProps> = ({
|
|||||||
<div>
|
<div>
|
||||||
<Header
|
<Header
|
||||||
title={siteInfo.title}
|
title={siteInfo.title}
|
||||||
icon={siteInfo.icon || ''}
|
icon=''
|
||||||
|
customerIcon={difyIcon}
|
||||||
icon_background={siteInfo.icon_background}
|
icon_background={siteInfo.icon_background}
|
||||||
isEmbedScene={true}
|
isEmbedScene={true}
|
||||||
isMobile={isMobile}
|
isMobile={isMobile}
|
||||||
@ -624,6 +629,7 @@ const Main: FC<IMainProps> = ({
|
|||||||
suggestionList={suggestQuestions}
|
suggestionList={suggestQuestions}
|
||||||
displayScene='web'
|
displayScene='web'
|
||||||
isShowSpeechToText={speechToTextConfig?.enabled}
|
isShowSpeechToText={speechToTextConfig?.enabled}
|
||||||
|
answerIconClassName={s.difyIcon}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>)
|
</div>)
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
.installedApp {
|
.installedApp {
|
||||||
height: calc(100vh - 74px);
|
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;
|
||||||
}
|
}
|
@ -307,7 +307,7 @@ const Welcome: FC<IWelcomeProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='relative mobile:min-h-[48px] tablet:min-h-[64px]'>
|
<div className='relative tablet:min-h-[64px]'>
|
||||||
{/* {hasSetInputs && renderHeader()} */}
|
{/* {hasSetInputs && renderHeader()} */}
|
||||||
<div className='mx-auto pc:w-[794px] max-w-full mobile:w-full px-3.5'>
|
<div className='mx-auto pc:w-[794px] max-w-full mobile:w-full px-3.5'>
|
||||||
{/* Has't set inputs */}
|
{/* Has't set inputs */}
|
||||||
|
@ -3,6 +3,7 @@ import React from 'react'
|
|||||||
import AppIcon from '@/app/components/base/app-icon'
|
import AppIcon from '@/app/components/base/app-icon'
|
||||||
export type IHeaderProps = {
|
export type IHeaderProps = {
|
||||||
title: string
|
title: string
|
||||||
|
customerIcon?: React.ReactNode
|
||||||
icon: string
|
icon: string
|
||||||
icon_background: string
|
icon_background: string
|
||||||
isMobile?: boolean
|
isMobile?: boolean
|
||||||
@ -11,6 +12,7 @@ export type IHeaderProps = {
|
|||||||
const Header: FC<IHeaderProps> = ({
|
const Header: FC<IHeaderProps> = ({
|
||||||
title,
|
title,
|
||||||
isMobile,
|
isMobile,
|
||||||
|
customerIcon,
|
||||||
icon,
|
icon,
|
||||||
icon_background,
|
icon_background,
|
||||||
isEmbedScene = false,
|
isEmbedScene = false,
|
||||||
@ -25,7 +27,7 @@ const Header: FC<IHeaderProps> = ({
|
|||||||
>
|
>
|
||||||
<div></div>
|
<div></div>
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<AppIcon size="small" icon={icon} background={icon_background} />
|
{customerIcon || <AppIcon size="small" icon={icon} background={icon_background} />}
|
||||||
<div
|
<div
|
||||||
className={`text-sm text-gray-800 font-bold ${
|
className={`text-sm text-gray-800 font-bold ${
|
||||||
isEmbedScene ? 'text-white' : ''
|
isEmbedScene ? 'text-white' : ''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user