Skip to content

Commit

Permalink
Incorporate changes for chatbot
Browse files Browse the repository at this point in the history
* #175 from @mojavelinux
* #176 from @ericgimproving

I had to make the following changes:

* use the origin property instead of URL, to match referer
* comment out the send-intent line (no such element exists?)
* currently we're still using the bundled version: I couldn't get the `require` of the github installed package to work.
* (minor linting change for another sandbox experiment on docsearch... please ignore)
  • Loading branch information
osfameron committed Feb 23, 2024
1 parent b3cb1d3 commit a3ac0cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/js/12-chatbox.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
;(function () {
var iframeLoader = new window.ChatBotUiLoader.IframeLoader()

const origin = window.parent.origin
var chatbotUiconfig = {
ui: {
parentOrigin: 'https://preview.docs-test.couchbase.com',
parentOrigin: origin,
toolbarTitle: 'Couchbase',
toolbarLogo: 'https://www.couchbase.com/wp-content/uploads/sites/3/2023/10/SDKs_Ottoman.svg',
positiveFeedbackIntent: 'Thumbs up',
Expand All @@ -27,7 +28,7 @@
iframe: {
iframeOrigin: 'https://d2sozpdiqok6m4.cloudfront.net',
shouldLoadIframeMinimized: true,
iframeSrcPath: '/#/?lexWebUiEmbed=true',
iframeSrcPath: '/#/?lexWebUiEmbed=true&parentOrigin=' + origin,
},
}

Expand All @@ -37,7 +38,7 @@
.then(function () {
iframeLoader.api.ping()
// perform actions on the parent dependent on the chatbot loading.
document.getElementById('send-intent').setAttribute('disabled', false)
// document.getElementById('send-intent').setAttribute('disabled', false)
})
.catch(function (error) {
console.error('chatbot UI failed to load', error)
Expand Down
2 changes: 1 addition & 1 deletion src/js/vendor/docsearch.bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
return accum
}, {})
)
.filter(a => a[1].title)
.filter((a) => a[1].title)
.sort(function (a, b) {
return a[1].title.replace(/^\./, '').localeCompare(b[1].title.replace(/^\./, ''))
})
Expand Down

0 comments on commit a3ac0cd

Please sign in to comment.