1
- import { Match , Switch } from 'solid-js'
1
+ import { Match , Switch , createEffect } from 'solid-js'
2
2
import { useStore } from '@nanostores/solid'
3
3
import { conversationMap , currentConversationId } from '@/stores/conversation'
4
4
import { conversationMessagesMap } from '@/stores/messages'
5
5
import { loadingStateMap , streamsMap } from '@/stores/streams'
6
6
import { getBotMetaById } from '@/stores/provider'
7
+ import { useI18n } from '@/hooks'
7
8
import ConversationEmpty from './ConversationEmpty'
8
9
import Welcome from './Welcome'
9
10
import Continuous from './Continuous'
10
11
import Single from './Single'
11
12
import Image from './Image'
12
13
13
14
export default ( ) => {
15
+ const { t } = useI18n ( )
14
16
const $conversationMap = useStore ( conversationMap )
15
17
const $conversationMessagesMap = useStore ( conversationMessagesMap )
16
18
const $currentConversationId = useStore ( currentConversationId )
@@ -26,8 +28,18 @@ export default () => {
26
28
const currentConversationMessages = ( ) => {
27
29
return $conversationMessagesMap ( ) [ $currentConversationId ( ) ] || [ ]
28
30
}
29
- const isStreaming = ( ) => ! ! $streamsMap ( ) [ $currentConversationId ( ) ]
30
- const isLoading = ( ) => ! ! $loadingStateMap ( ) [ $currentConversationId ( ) ]
31
+ // const isStreaming = () => !!$streamsMap()[$currentConversationId()]
32
+ // const isLoading = () => !!$loadingStateMap()[$currentConversationId()]
33
+
34
+ createEffect ( ( ) => {
35
+ const conversation = currentConversation ( )
36
+ document . title = conversation ? `${ ( conversation . name || t ( 'conversations.untitled' ) ) } • Anse` : 'Anse'
37
+ const link = document . querySelector ( "link[rel~='icon']" ) as HTMLLinkElement
38
+ if ( link ) {
39
+ const conversationIcon = conversation ?. icon ? `data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>${ conversation . icon } </text></svg>` : null
40
+ link . setAttribute ( 'href' , conversationIcon || '/logo.svg' )
41
+ }
42
+ } )
31
43
32
44
return (
33
45
< Switch
0 commit comments