Skip to content

Commit ca5f9e9

Browse files
yz778mrdjohnson
authored andcommitted
feat: when sidebar hidden, show model and persona under chat
1 parent f819417 commit ca5f9e9

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { useNavigate } from 'react-router'
2+
import { connectionStore } from '~/core/connection/ConnectionStore'
3+
import { personaStore } from '~/core/persona/PersonaStore'
4+
5+
const ModelAndPersonaDisplay = () => {
6+
const navigate = useNavigate()
7+
const { selectedModelLabel, selectedConnection, isAnyServerConnected } = connectionStore
8+
const persona = personaStore.selectedPersona?.name
9+
10+
const handleModelClick = () => {
11+
if (!selectedConnection) {
12+
navigate('/models')
13+
} else {
14+
navigate('/models/' + selectedConnection.id)
15+
}
16+
}
17+
18+
const handlePersonaClick = () => {
19+
navigate('/personas')
20+
}
21+
22+
return (
23+
<div className="flex space-x-2">
24+
{isAnyServerConnected && (
25+
<div className="badge cursor-pointer gap-2 bg-base-300" onClick={handleModelClick}>
26+
Model: {selectedModelLabel}
27+
</div>
28+
)}
29+
{persona && (
30+
<div className="badge cursor-pointer gap-2 bg-base-300" onClick={handlePersonaClick}>
31+
Persona: {persona}
32+
</div>
33+
)}
34+
</div>
35+
)
36+
}
37+
38+
export default ModelAndPersonaDisplay

src/containers/ChatBox.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import _ from 'lodash'
44
import { chatStore } from '~/core/chat/ChatStore'
55
import { incomingMessageStore } from '~/core/IncomingMessageStore'
66
import { actorStore } from '~/core/actor/ActorStore'
7+
import { settingStore } from '~/core/setting/SettingStore'
78

89
import ChatBoxInputRow from '~/components/ChatBoxInputRow'
910
import ChatBoxPrompt from '~/components/ChatBoxPrompt'
@@ -14,6 +15,7 @@ import Stop from '~/icons/Stop'
1415
import { lightboxStore } from '~/features/lightbox/LightboxStore'
1516
import { ChatBoxMessage } from '~/components/message/ChatBoxMessage'
1617
import ScrollableChatFeed from '~/containers/ScrollableChatFeed'
18+
import ModelAndPersonaDisplay from '~/components/ModelAndPersonaDisplay'
1719

1820
const ChatBox = () => {
1921
const chat = chatStore.selectedChat
@@ -71,6 +73,7 @@ const ChatBox = () => {
7173
const isEditingMessage = !!chat.messageToEdit
7274
const variationIdToEdit = chat.variationToEdit?.id
7375
const lightboxMessageId = lightboxStore.lightboxMessage?.id
76+
const isSidebarOpen = settingStore.setting.isSidebarOpen
7477

7578
return (
7679
<div className="flex max-h-full min-h-full w-full min-w-full max-w-full flex-col overflow-x-auto overflow-y-hidden rounded-md">
@@ -105,6 +108,8 @@ const ChatBox = () => {
105108
</button>
106109
)}
107110
</ChatBoxInputRow>
111+
112+
{!isSidebarOpen && <ModelAndPersonaDisplay />}
108113
</div>
109114
)
110115
}

0 commit comments

Comments
 (0)