@@ -31,9 +31,10 @@ import NotificationForChatGPTWeb from '../components/NotificationForChatGPTWeb'
31
31
32
32
/**
33
33
* @param {SiteConfig } siteConfig
34
- * @param {UserConfig } userConfig
35
34
*/
36
- async function mountComponent ( siteConfig , userConfig ) {
35
+ async function mountComponent ( siteConfig ) {
36
+ const userConfig = await getUserConfig ( )
37
+
37
38
if ( ! userConfig . alwaysFloatingSidebar ) {
38
39
const retry = 10
39
40
let oldUrl = location . href
@@ -74,17 +75,19 @@ async function mountComponent(siteConfig, userConfig) {
74
75
e . remove ( )
75
76
} )
76
77
77
- const position = {
78
- x : window . innerWidth - 300 - Math . floor ( ( 20 / 100 ) * window . innerWidth ) ,
79
- y : window . innerHeight / 2 - 200 ,
80
- }
81
- const toolbarContainer = createElementAtPosition ( position . x , position . y )
82
- toolbarContainer . className = 'chatgptbox-toolbar-container-not-queryable'
83
78
if ( userConfig . alwaysFloatingSidebar && question ) {
79
+ const position = {
80
+ x : window . innerWidth - 300 - Math . floor ( ( 20 / 100 ) * window . innerWidth ) ,
81
+ y : window . innerHeight / 2 - 200 ,
82
+ }
83
+ const toolbarContainer = createElementAtPosition ( position . x , position . y )
84
+ toolbarContainer . className = 'chatgptbox-toolbar-container-not-queryable'
85
+
84
86
let triggered = false
85
87
if ( userConfig . triggerMode === 'always' ) triggered = true
86
88
else if ( userConfig . triggerMode === 'questionMark' && endsWithQuestionMark ( question . trim ( ) ) )
87
89
triggered = true
90
+
88
91
render (
89
92
< FloatingToolbar
90
93
session = { initSession ( { modelName : userConfig . modelName } ) }
@@ -98,6 +101,7 @@ async function mountComponent(siteConfig, userConfig) {
98
101
)
99
102
return
100
103
}
104
+
101
105
const container = document . createElement ( 'div' )
102
106
container . id = 'chatgptbox-container'
103
107
render (
@@ -313,7 +317,7 @@ async function prepareForStaticCard() {
313
317
}
314
318
}
315
319
316
- if ( initSuccess ) mountComponent ( siteConfig [ siteName ] , userConfig )
320
+ if ( initSuccess ) mountComponent ( siteConfig [ siteName ] )
317
321
}
318
322
}
319
323
0 commit comments