patch: decisionCard and popupCard of bing client (#505)

This commit is contained in:
josc146
2023-09-23 16:52:00 +08:00
parent 18c9c4f5d2
commit 711e0d3493
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ function ConversationCard(props) {
useEffect(async () => {
// when the page is responsive, session may accumulate redundant data and needs to be cleared after remounting and before making a new request
if (props.question) {
const newSession = initSession({ question: props.question })
const newSession = initSession({ ...session, question: props.question })
setSession(newSession)
await postMessage({ session: newSession })
}
+4 -4
View File
@@ -73,7 +73,7 @@ async function mountComponent(siteConfig, userConfig) {
container.id = 'chatgptbox-container'
render(
<DecisionCard
session={initSession()}
session={initSession({ modelName: (await getUserConfig()).modelName })}
question={question}
siteConfig={siteConfig}
container={container}
@@ -113,11 +113,11 @@ const deleteToolbar = () => {
toolbarContainer.remove()
}
const createSelectionTools = (toolbarContainer, selection) => {
const createSelectionTools = async (toolbarContainer, selection) => {
toolbarContainer.className = 'chatgptbox-toolbar-container'
render(
<FloatingToolbar
session={initSession()}
session={initSession({ modelName: (await getUserConfig()).modelName })}
selection={selection}
container={toolbarContainer}
dockable={true}
@@ -159,7 +159,7 @@ async function prepareForSelectionTools() {
}
}
toolbarContainer = createElementAtPosition(position.x, position.y)
createSelectionTools(toolbarContainer, selection)
await createSelectionTools(toolbarContainer, selection)
}
})
})