feat: docker docs, semantic search alpha
This commit is contained in:
		
							parent
							
								
									c12af32a5a
								
							
						
					
					
						commit
						e9aa6ae9e7
					
				
					 11 changed files with 71 additions and 70 deletions
				
			
		| 
						 | 
				
			
			@ -1,18 +1,26 @@
 | 
			
		|||
const apiKey = "{{$.Site.Data.config.operandApiKey}}"
 | 
			
		||||
import {
 | 
			
		||||
  operandClient,
 | 
			
		||||
  indexIDHeaderKey,
 | 
			
		||||
} from "https://unpkg.com/@operandinc/sdk@4.1.3/dist/esm/index.js"
 | 
			
		||||
 | 
			
		||||
const apiKey = "{{$.Site.Data.config.search.operandApiKey}}"
 | 
			
		||||
const indexId = "{{$.Site.Data.config.search.operandIndexId}}"
 | 
			
		||||
const operand = operandClient(
 | 
			
		||||
  ObjectService,
 | 
			
		||||
  apiKey,
 | 
			
		||||
  "https://api.operand.ai",
 | 
			
		||||
  {
 | 
			
		||||
    [indexIDHeaderKey]: indexId,
 | 
			
		||||
  }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
async function searchContents(query) {
 | 
			
		||||
  const response = await fetch('https://prod.operand.ai/v3/search/objects', {
 | 
			
		||||
    method: 'POST',
 | 
			
		||||
    headers: {
 | 
			
		||||
      'Content-Type': 'application/json',
 | 
			
		||||
      Authorization: apiKey,
 | 
			
		||||
    },
 | 
			
		||||
    body: JSON.stringify({
 | 
			
		||||
      query,
 | 
			
		||||
      max: 10
 | 
			
		||||
    }),
 | 
			
		||||
  });
 | 
			
		||||
  return (await response.json());
 | 
			
		||||
  const results = await operand.searchWithin({
 | 
			
		||||
    query,
 | 
			
		||||
    limit: 10,
 | 
			
		||||
  })
 | 
			
		||||
  console.log(results.matches)
 | 
			
		||||
  return results.matches.flat()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function debounce(func, timeout = 200) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -299,13 +299,11 @@ footer {
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
hr {
 | 
			
		||||
  width: 25%;
 | 
			
		||||
  margin: 4em auto;
 | 
			
		||||
  height: 2px;
 | 
			
		||||
  border-radius: 1px;
 | 
			
		||||
  border-width: 0;
 | 
			
		||||
  color: var(--dark);
 | 
			
		||||
  background-color: var(--dark);
 | 
			
		||||
  width: 100%;
 | 
			
		||||
  margin: 2em auto;
 | 
			
		||||
  height: 1px;
 | 
			
		||||
  border: none;
 | 
			
		||||
  background-color: var(--outlinegray);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.page-end {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue