Skip to content

Commit

Permalink
Add support for contextItems arg in widget
Browse files Browse the repository at this point in the history
  • Loading branch information
uglyrobot committed Feb 15, 2024
1 parent c586bcf commit 04dc26e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ <h1>Embeddable Widget Demo</h1>
</script>
<script>
DocsBotAI.init({
id: "ZrbLG98bbxZ9EFqiPvyl/UaRQtd7AOTaMXeRQGQRl",
id: "ZrbLG98bbxZ9EFqiPvyl/N2mWls8WYE6VxTmObjr3",
supportCallback: function (event, history) {
//event.preventDefault();
console.log(history, DocsBotAI);
Expand Down Expand Up @@ -78,7 +78,7 @@ <h1>Embeddable Widget Demo</h1>
const reinitBtn = document.getElementById("reinit-btn");
reinitBtn.addEventListener("click", () => {
DocsBotAI.mount({
id: "ZrbLG98bbxZ9EFqiPvyl/UaRQtd7AOTaMXeRQGQRl",
id: "ZrbLG98bbxZ9EFqiPvyl/N2mWls8WYE6VxTmObjr3",
supportCallback: function (event, history) {
event.preventDefault();
console.log(history, DocsBotAI);
Expand Down
3 changes: 2 additions & 1 deletion src/components/chatbot/Chatbot.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const Chatbot = ({ isOpen, setIsOpen, isEmbeddedBox }) => {
headerAlignment,
hideHeader,
inputLimit,
contextItems,
} = useConfig();
const ref = useRef();
const inputRef = useRef();
Expand Down Expand Up @@ -159,7 +160,7 @@ export const Chatbot = ({ isOpen, setIsOpen, isEmbeddedBox }) => {
let metadata = identify;
metadata.referrer = window.location.href;
const history = state.chatHistory || [];
const req = { question, markdown: true, history, metadata };
const req = { question, markdown: true, history, metadata, context_items: contextItems || 5 };
if (signature) {
req.auth = signature;
}
Expand Down

0 comments on commit 04dc26e

Please sign in to comment.