|
|
|
|
|
|
|
|
useState, |
|
|
useState, |
|
|
} from 'react' |
|
|
} from 'react' |
|
|
import { useAsyncEffect } from 'ahooks' |
|
|
import { useAsyncEffect } from 'ahooks' |
|
|
|
|
|
import { useThemeContext } from '../embedded-chatbot/theme/theme-context' |
|
|
import { |
|
|
import { |
|
|
ChatWithHistoryContext, |
|
|
ChatWithHistoryContext, |
|
|
useChatWithHistoryContext, |
|
|
useChatWithHistoryContext, |
|
|
|
|
|
|
|
|
appChatListDataLoading, |
|
|
appChatListDataLoading, |
|
|
chatShouldReloadKey, |
|
|
chatShouldReloadKey, |
|
|
isMobile, |
|
|
isMobile, |
|
|
|
|
|
themeBuilder, |
|
|
} = useChatWithHistoryContext() |
|
|
} = useChatWithHistoryContext() |
|
|
|
|
|
|
|
|
const chatReady = (!showConfigPanelBeforeChat || !!appPrevChatList.length) |
|
|
const chatReady = (!showConfigPanelBeforeChat || !!appPrevChatList.length) |
|
|
|
|
|
|
|
|
const site = appData?.site |
|
|
const site = appData?.site |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
|
|
|
themeBuilder?.buildTheme(site?.chat_color_theme, site?.chat_color_theme_inverted) |
|
|
if (site) { |
|
|
if (site) { |
|
|
if (customConfig) |
|
|
if (customConfig) |
|
|
document.title = `${site.title}` |
|
|
document.title = `${site.title}` |
|
|
else |
|
|
else |
|
|
document.title = `${site.title} - Powered by Dify` |
|
|
document.title = `${site.title} - Powered by Dify` |
|
|
} |
|
|
} |
|
|
}, [site, customConfig]) |
|
|
|
|
|
|
|
|
}, [site, customConfig, themeBuilder]) |
|
|
|
|
|
|
|
|
if (appInfoLoading) { |
|
|
if (appInfoLoading) { |
|
|
return ( |
|
|
return ( |
|
|
|
|
|
|
|
|
}) => { |
|
|
}) => { |
|
|
const media = useBreakpoints() |
|
|
const media = useBreakpoints() |
|
|
const isMobile = media === MediaType.mobile |
|
|
const isMobile = media === MediaType.mobile |
|
|
|
|
|
const themeBuilder = useThemeContext() |
|
|
|
|
|
|
|
|
const { |
|
|
const { |
|
|
appInfoError, |
|
|
appInfoError, |
|
|
|
|
|
|
|
|
appId, |
|
|
appId, |
|
|
handleFeedback, |
|
|
handleFeedback, |
|
|
currentChatInstanceRef, |
|
|
currentChatInstanceRef, |
|
|
|
|
|
themeBuilder, |
|
|
}}> |
|
|
}}> |
|
|
<ChatWithHistory className={className} /> |
|
|
<ChatWithHistory className={className} /> |
|
|
</ChatWithHistoryContext.Provider> |
|
|
</ChatWithHistoryContext.Provider> |