diff --git a/web/app/components/workflow/block-selector/tabs.tsx b/web/app/components/workflow/block-selector/tabs.tsx index 7f14305178..c3342a03fc 100644 --- a/web/app/components/workflow/block-selector/tabs.tsx +++ b/web/app/components/workflow/block-selector/tabs.tsx @@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next' import { groupBy } from 'lodash-es' import BlockIcon from '../block-icon' import { BlockEnum } from '../types' +import { useIsChatMode } from '../hooks' import { BLOCK_CLASSIFICATIONS } from './constants' import { useBlocks, @@ -15,7 +16,6 @@ import { import type { ToolDefaultValue } from './types' import { TabsEnum } from './types' import Tools from './tools' -import { useStore as useAppStore } from '@/app/components/app/store' export type TabsProps = { onSelect: (type: BlockEnum, tool?: ToolDefaultValue) => void @@ -24,7 +24,7 @@ const Tabs: FC = ({ onSelect, }) => { const { t } = useTranslation() - const appDetail = useAppStore(state => state.appDetail) + const isChatMode = useIsChatMode() const blocks = useBlocks() const tabs = useTabs() const [activeTab, setActiveTab] = useState(tabs[0].key) @@ -65,7 +65,7 @@ const Tabs: FC = ({ } { groupBy(blocks, 'classification')[classification].filter((block) => { - if (block.type === BlockEnum.DirectAnswer && appDetail?.mode === 'workflow') + if (block.type === BlockEnum.DirectAnswer && !isChatMode) return false return true diff --git a/web/app/components/workflow/header/index.tsx b/web/app/components/workflow/header/index.tsx index 301b526aed..5e8bf8dc8a 100644 --- a/web/app/components/workflow/header/index.tsx +++ b/web/app/components/workflow/header/index.tsx @@ -5,6 +5,7 @@ import { } from 'react' import { useTranslation } from 'react-i18next' import { useStore } from '../store' +import { useIsChatMode } from '../hooks' import RunAndHistory from './run-and-history' import EditingTitle from './editing-title' import RunningTitle from './running-title' @@ -18,6 +19,7 @@ import { Mode } from '@/app/components/workflow/types' const Header: FC = () => { const { t } = useTranslation() const appDetail = useAppStore(state => state.appDetail) + const isChatMode = useIsChatMode() const mode = useStore(state => state.mode) const runTaskId = useStore(state => state.runTaskId) @@ -59,7 +61,7 @@ const Header: FC = () => {
{ - appDetail?.mode === 'advanced-chat' && ( + isChatMode && (