feat: Add model generation check before narrow mode toggle

This commit is contained in:
ousugo 2025-02-19 17:42:15 +08:00 committed by 亢奋猫
parent 5f4142f0c4
commit e541c7b429

View File

@ -5,6 +5,7 @@ import MinAppsPopover from '@renderer/components/Popups/MinAppsPopover'
import SearchPopup from '@renderer/components/Popups/SearchPopup'
import { isMac, isWindows } from '@renderer/config/constant'
import { useAssistant } from '@renderer/hooks/useAssistant'
import { modelGenerating } from '@renderer/hooks/useRuntime'
import { useSettings } from '@renderer/hooks/useSettings'
import { useShortcut } from '@renderer/hooks/useShortcuts'
import { useShowAssistants, useShowTopics } from '@renderer/hooks/useStore'
@ -47,6 +48,11 @@ const HeaderNavbar: FC<Props> = ({ activeAssistant }) => {
SearchPopup.show()
})
const handleNarrowModeToggle = async () => {
await modelGenerating()
dispatch(setNarrowMode(!narrowMode))
}
return (
<Navbar className="home-navbar">
{showAssistants && (
@ -80,7 +86,7 @@ const HeaderNavbar: FC<Props> = ({ activeAssistant }) => {
<NarrowIcon onClick={() => SearchPopup.show()}>
<SearchOutlined />
</NarrowIcon>
<NarrowIcon onClick={() => dispatch(setNarrowMode(!narrowMode))}>
<NarrowIcon onClick={handleNarrowModeToggle}>
<i className="iconfont icon-icon-adaptive-width"></i>
</NarrowIcon>
{sidebarIcons.visible.includes('minapp') && (