update api code dialog for embed chat

This commit is contained in:
Henry 2023-06-05 12:47:55 +01:00
parent 25387aa2fd
commit ab00214ec2
1 changed files with 34 additions and 23 deletions

View File

@ -121,7 +121,7 @@ const getConfigExamplesForCurl = (configData, bodyType) => {
const embedCode = (chatflowid) => {
return `<script type="module">
import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed@latest/dist/web.js"
import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"
Chatbot.init({
chatflowid: "${chatflowid}",
apiHost: "${baseURL}",
@ -131,7 +131,7 @@ const embedCode = (chatflowid) => {
const embedCodeCustomization = (chatflowid) => {
return `<script type="module">
import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed@latest/dist/web.js"
import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"
Chatbot.init({
chatflowid: "${chatflowid}",
apiHost: "${baseURL}",
@ -160,16 +160,16 @@ const embedCodeCustomization = (chatflowid) => {
backgroundColor: "#3B81F6",
textColor: "#ffffff",
showAvatar: true,
avatarSrc:
"https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png",
avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png",
},
textInput: {
placeholder: "Type your question",
backgroundColor: "#ffffff",
textColor: "#303235",
sendButtonColor: "#3B81F6",
},
},
}
}
}
})
</script>`
}
@ -605,7 +605,18 @@ query({
{value === 0 && (
<>
<span>
Paste this anywhere in the <code>{`<body>`}</code> tag of your html file
Paste this anywhere in the <code>{`<body>`}</code> tag of your html file.
<p>
You can also specify a&nbsp;
<a
rel='noreferrer'
target='_blank'
href='https://www.npmjs.com/package/flowise-embed?activeTab=versions'
>
version
</a>
:&nbsp;<code>{`https://cdn.jsdelivr.net/npm/flowise-embed@<version>/dist/web.js`}</code>
</p>
</span>
<div style={{ height: 10 }}></div>
</>
@ -648,7 +659,7 @@ query({
{value === 0 && embedChatCheckboxVal && (
<CopyBlock
theme={atomOneDark}
text={embedCodeCustomization(chatflowApiKeyId)}
text={embedCodeCustomization(dialogProps.chatflowid)}
language={getLang('Embed')}
showLineNumbers={false}
wrapLines