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(a){const b=await fetch('https://prod.operand.ai/v3/search/objects',{method:'POST',headers:{'Content-Type':'application/json',Authorization:apiKey},body:JSON.stringify({query:a,max:10})});return await b.json()}function debounce(b,c=200){let a;return(...d)=>{clearTimeout(a),a=setTimeout(()=>{b.apply(this,d)},c)}}registerHandlers(debounce(a=>{term=a.target.value,term!==""&&searchContents(term).then(a=>a.results.map(a=>({url:a.object.properties.url,content:a.snippet,title:a.object.metadata.title}))).then(a=>displayResults(a))}))
|