diff --git a/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx b/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx
index 9e737d7a9d..827888d922 100644
--- a/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx
+++ b/src/renderer/src/pages/home/MainSidebar/MainSidebar.tsx
@@ -11,10 +11,9 @@ import { useShowAssistants } from '@renderer/hooks/useStore'
import i18n from '@renderer/i18n'
import { getAssistantById } from '@renderer/services/AssistantService'
import { EVENT_NAMES, EventEmitter } from '@renderer/services/EventService'
-import { ThemeMode } from '@renderer/types'
+import { Assistant, ThemeMode } from '@renderer/types'
import { isEmoji } from '@renderer/utils'
import { Avatar, Dropdown } from 'antd'
-import { AnimatePresence } from 'framer-motion'
import {
Blocks,
ChevronDown,
@@ -71,7 +70,7 @@ const MainSidebar: FC = () => {
const { pathname } = location
const { activeAssistant, activeTopic, setActiveAssistant } = useChat()
- const { showTopics } = useSettings()
+ const { showTopics, clickAssistantToShowTopic } = useSettings()
const { openMinapp } = useMinappPopup()
@@ -80,14 +79,30 @@ const MainSidebar: FC = () => {
useEffect(() => {
const unsubscribe = [
- EventEmitter.on(EVENT_NAMES.SHOW_TOPIC_SIDEBAR, () => setTab('topic')),
+ EventEmitter.on(EVENT_NAMES.SHOW_TOPIC_SIDEBAR, (assistant: Assistant) => {
+ if (clickAssistantToShowTopic) {
+ setTab('topic')
+ } else {
+ if (activeAssistant.id === assistant.id) {
+ setTab('topic')
+ }
+ }
+ }),
EventEmitter.on(EVENT_NAMES.SWITCH_TOPIC_SIDEBAR, () => {
setTab(tab === 'topic' ? 'assistants' : 'topic')
!showAssistants && toggleShowAssistants()
})
]
return () => unsubscribe.forEach((unsubscribe) => unsubscribe())
- }, [isAppMenuExpanded, showAssistants, tab, toggleShowAssistants])
+ }, [
+ activeAssistant.id,
+ activeTopic.assistantId,
+ clickAssistantToShowTopic,
+ isAppMenuExpanded,
+ showAssistants,
+ tab,
+ toggleShowAssistants
+ ])
useEffect(() => {
const unsubscribes = [
@@ -175,24 +190,21 @@ const MainSidebar: FC = () => {
)}
-
- {isAppMenuExpanded && (
-
- {appMenuItems.map((item) => (
- navigate(item.path)}>
-
- {item.icon}
- {item.text}
-
-
- ))}
-
-
- )}
-
+ {isAppMenuExpanded && (
+
+ {appMenuItems.map((item) => (
+ navigate(item.path)}>
+
+ {item.icon}
+ {item.text}
+
+
+ ))}
+
+
+ )}
-
{tab === 'topic' && (
setIsAppMenuExpanded(false)}>
{
/>
)}
-
- {/*
- setTab('assistants')}>
- {t('assistants.title')}
-
- setTab('topic')}>
- {t('common.topics')}
-
- */}
{tab === 'assistants' && }
{tab === 'topic' && }
-
UserPopup.show()}>
{isEmoji(avatar) ? (
@@ -237,7 +236,6 @@ const MainSidebar: FC = () => {
)}
{userName && {userName}}
-
`
-// display: flex;
-// flex: 1;
-// flex-direction: column;
-// justify-content: center;
-// align-items: center;
-// cursor: pointer;
-// background-color: ${({ active }) => (active ? 'var(--color-list-item)' : 'transparent')};
-// &:hover {
-// background-color: var(--color-list-item);
-// }
-// `
-
-// const TabItemText = styled.div`
-// font-size: 14px;
-// font-weight: 500;
-// `
-
const UserMenu = styled.div`
display: flex;
flex-direction: row;
diff --git a/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx b/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx
index 0d22443f10..f7a965a3d5 100644
--- a/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx
+++ b/src/renderer/src/pages/home/Tabs/components/AssistantItem.tsx
@@ -60,7 +60,7 @@ const AssistantItem: FC = ({
const { t } = useTranslation()
const { allTags } = useTags()
const { removeAllTopics } = useAssistant(assistant.id)
- const { assistantIconType, setAssistantIconType, topicPosition } = useSettings()
+ const { assistantIconType, setAssistantIconType, clickAssistantToShowTopic } = useSettings()
const defaultModel = getDefaultModel()
const { assistants, updateAssistants } = useAssistants()
@@ -128,16 +128,14 @@ const AssistantItem: FC = ({
return
}
- if (topicPosition === 'left') {
- EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR)
- }
+ EventEmitter.emit(EVENT_NAMES.SHOW_TOPIC_SIDEBAR, assistant)
if (singleLine) {
EventEmitter.emit(EVENT_NAMES.SWITCH_TOPIC_SIDEBAR)
}
onSwitch(assistant)
- }, [isMenuOpen, topicPosition, singleLine, onSwitch, assistant])
+ }, [isMenuOpen, assistant, singleLine, onSwitch])
const assistantName = useMemo(() => assistant.name || t('chat.default.name'), [assistant.name, t])
const fullAssistantName = useMemo(