mirror of https://github.com/logos-co/roadmap.git
1 line
612 B
JavaScript
1 line
612 B
JavaScript
const apiKey="e1ec9cdc-56d2-420e-a5bd-c6019af4be58";async function searchContents(e){const t=await fetch("https://prod.operand.ai/v3/search/objects",{method:"POST",headers:{"Content-Type":"application/json",Authorization:apiKey},body:JSON.stringify({query:e,max:10})});return await t.json()}function debounce(e,t=200){let n;return(...s)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(this,s)},t)}}registerHandlers(debounce(e=>{term=e.target.value,term!==""&&searchContents(term).then(e=>e.results.map(e=>({url:e.object.properties.url,content:e.snippet,title:e.object.metadata.title}))).then(e=>displayResults(e))})) |