diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index 73c812cc4b..163920321c 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -7,6 +7,8 @@ import { AlignLeft01, AlignRight01, } from '@/app/components/base/icons/src/vender/line/layout' +import { useEventEmitterContextContext } from '@/context/event-emitter' +import { APP_SIDEBAR_SHOULD_COLLAPSE } from '@/app/components/app/configuration/debug/types' export type IAppDetailNavProps = { iconType?: 'app' | 'dataset' | 'notion' @@ -39,6 +41,14 @@ const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInf }) }, []) + const { eventEmitter } = useEventEmitterContextContext() + eventEmitter?.useSubscription((v: any) => { + if (v.type === APP_SIDEBAR_SHOULD_COLLAPSE) { + setModeState('collapse') + localStorage.setItem('app-detail-collapse-or-expand', 'collapse') + } + }) + return (
= ({ data, showHitInfo, + containerClassName = 'chat-answer-container', }) => { const { t } = useTranslation() const elesRef = useRef([]) @@ -46,7 +48,7 @@ const Citation: FC = ({ }, []), [data]) const handleAdjustResourcesLayout = () => { - const containerWidth = document.querySelector('.chat-answer-container')!.clientWidth - 40 + const containerWidth = document.querySelector(`.${containerClassName}`)!.clientWidth - 40 let totalWidth = 0 for (let i = 0; i < resources.length; i++) { totalWidth += elesRef.current[i].clientWidth diff --git a/web/app/components/app/chat/log/index.tsx b/web/app/components/app/chat/log/index.tsx index 23cc81da90..838eeaf35a 100644 --- a/web/app/components/app/chat/log/index.tsx +++ b/web/app/components/app/chat/log/index.tsx @@ -1,6 +1,7 @@ import type { Dispatch, FC, ReactNode, RefObject, SetStateAction } from 'react' import { useEffect, useState } from 'react' import { useTranslation } from 'react-i18next' +import { uniqueId } from 'lodash-es' import { File02 } from '@/app/components/base/icons/src/vender/line/files' import PromptLogModal from '@/app/components/base/prompt-log-modal' import Tooltip from '@/app/components/base/tooltip' @@ -39,7 +40,7 @@ const Log: FC = ({ children ? children(setShowModal) : ( - +