Skip to content

Commit

Permalink
docs: Mendable Search Integration (run-llama#1179)
Browse files Browse the repository at this point in the history
Nick: mendable integration
  • Loading branch information
nickscamara authored Apr 14, 2023
1 parent 96f0321 commit 49aff68
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#my-component-root *, #headlessui-portal-root * {
z-index: 1000000000000;
font-size: 100%;
}

textarea{
border: 0;
padding: 0;
}
63 changes: 63 additions & 0 deletions docs/_static/js/mendablesearch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
document.addEventListener("DOMContentLoaded", () => {
// Load the external dependencies
function loadScript(src, onLoadCallback) {
const script = document.createElement("script");
script.src = src;
script.onload = onLoadCallback;
document.head.appendChild(script);
}

function createRootElement() {
const rootElement = document.createElement("div");
rootElement.id = "my-component-root";
document.body.appendChild(rootElement);
return rootElement;
}

function initializeMendable() {
const rootElement = createRootElement();
const { MendableFloatingButton } = Mendable;

const icon = React.createElement(
"p",
{
style: {
color: "#ffffff",
fontSize: "40px",
width: "48px",
height: "48px",
margin: "0px",
padding: "0px",
display: "flex",
alignItems: "center",
justifyContent: "center",
},
},
"🦙"
);

const mendableFloatingButton = React.createElement(MendableFloatingButton, {
style: { darkMode: false, accentColor: "#010810" },
floatingButtonStyle: { color: "#ffffff", backgroundColor: "#010810" },
anon_key: "d0fb5ab6-ae6c-49dc-8d38-5115fe8e4755", // Public ANON key, ok to be public
messageSettings: {
openSourcesInNewTab: false,
},
icon: icon,
});

ReactDOM.render(mendableFloatingButton, rootElement);
}

loadScript("https://unpkg.com/react@17/umd/react.production.min.js", () => {
loadScript(
"https://unpkg.com/react-dom@17/umd/react-dom.production.min.js",
() => {
loadScript(
"https://unpkg.com/@mendable/search@0.0.83/dist/umd/mendable.min.js",
initializeMendable
);
}
);
});
});
7 changes: 7 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,10 @@
html_theme = "furo"
html_title = "LlamaIndex"
html_static_path = ["_static"]

html_css_files = [
"css/custom.css",
]
html_js_files = [
"js/mendablesearch.js",
]

0 comments on commit 49aff68

Please sign in to comment.