Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/update-trieve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Update Trieve

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

on:
push:
branches:
- main

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Trieve Fern Adapter
run: npm install -g trieve-fern-adapter

- name: Update Trieve Chunks
env:
TRIEVE_API_HOST: ${{ secrets.TRIEVE_API_HOST }}
TRIEVE_API_KEY: ${{ secrets.TRIEVE_API_KEY }}
TRIEVE_ORGANIZATION_ID: ${{ secrets.TRIEVE_ORGANIZATION_ID }}
TRIEVE_DATASET_TRACKING_ID: ${{ secrets.TRIEVE_DATASET_TRACKING_ID }}
run: trieve-fern-adapter --file fern/docs.yml -s https://api.vapi.ai/api-json -r https://docs.vapi.ai -a api-reference
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
**/.definition
**/.preview/**
.env
94 changes: 94 additions & 0 deletions fern/assets/trieve-user-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
// ==UserScript==
// @name Vapi
// @namespace http://tampermonkey.net/
// @version 2025-01-16
// @description try to take over the world!
// @author You
// @match https://docs.vapi.ai/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=vapi.ai
// @grant none
// ==/UserScript==

const removeAllClickListeners = (element) => {
const newElement = element.cloneNode(true);
element.parentNode.replaceChild(newElement, element);
return newElement;
};

const makeDefaultSearchTrieve = async () => {
let defaultSearchBar = null;
let retries = 0;
while (!defaultSearchBar && retries < 10) {
for (const el of document.querySelectorAll("*")) {
if (el.querySelector('[aria-label="Search"]')) {
defaultSearchBar = el.querySelector('[aria-label="Search"]');
break;
}
}
retries++;
await new Promise((resolve) => setTimeout(resolve, 10));
}
defaultSearchBar = removeAllClickListeners(defaultSearchBar);

defaultSearchBar.onclick = () => {
const event = new CustomEvent("trieve-open-with-text", {
detail: { text: "" },
});
window.dispatchEvent(event);
};
};
await makeDefaultSearchTrieve();
setTimeout(makeDefaultSearchTrieve, 50);
setTimeout(makeDefaultSearchTrieve, 100);
setTimeout(makeDefaultSearchTrieve, 250);
setTimeout(makeDefaultSearchTrieve, 500);
setTimeout(makeDefaultSearchTrieve, 1000);
setTimeout(makeDefaultSearchTrieve, 2000);
setTimeout(makeDefaultSearchTrieve, 3000);

(async function () {
"use strict";
const link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://cdn.trieve.ai/beta/search-component/index.css";
document.head.appendChild(link);

import("https://cdn.trieve.ai/beta/search-component/vanilla/index.js").then(
async (module) => {
const { renderToDiv } = module;
const root = document.createElement("div");
root.classList.add("trigger");
document.body.appendChild(root);
const colorScheme = document.documentElement?.style?.colorScheme;
const brandColor = colorScheme === "dark" ? "#47ffb6d5" : "#00551dcd";

renderToDiv(root, {
apiKey: "tr-hZMKSsTf3ML9hJbAAqPO8K91p9IVe9Oc",
datasetId: "d3493dc0-2b5c-4c6e-a8ee-b18feeed5b06",
baseUrl: "https://api.trieve.ai",
type: "docs",
analytics: true,
theme: colorScheme === "dark" ? "dark" : null,
brandLogoImgSrcUrl:
"https://storage.googleapis.com/organization-image-assets/vapi-botAvatarDarkSrcUrl-1709929110474.png",
brandName: "Vapi",
brandColor: brandColor,
placeholder: "How can I help?",
defaultSearchQueries: ["quickstart", "assistant", "tools"],
defaultAiQuestions: [
"What voices are supported?",
"What languages are supported?",
"How do I connect a custom LLM?",
"How do I fetch the prompt dynamically?",
],
defaultSearchMode: "search",
showFloatingButton: "true",
cssRelease: "none",
hideOpenButton: true,
});
},
(error) => {
console.error("Failed to load module:", error);
}
);
})();
1 change: 1 addition & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ landing-page:
css: assets/styles.css
js:
- path: ./assets/close-playground.js
- path: ./assets/trieve-user-script.js
strategy: lazyOnload
navbar-links:
- type: minimal
Expand Down
Loading