headless vector search
1.0.0
為任何文檔網站提供矢量/相似性搜索。它是無頭的,因此您可以將其集成到現有網站中。
docs架構初始化。首先創建一個新的supabase項目:database.new。
supabase link --project-ref XXXsupabase db pushsupabase secrets set OPENAI_API_KEY=sk-xxxsupabase functions deploy --no-verify-jwtAPI Settings >裸露docs Exposed schemassupabase-vector-embeddings github在您的知識庫存儲庫中的作用。在GitHub操作運行後,您將看到數據庫中填充的嵌入。 vector-search邊緣函數的URL。 curl -i --location --request GET ' https://your-project-ref.functions.supabase.co/vector-search?query=What%27s+Supabase%3F ' const onSubmit = ( e : Event ) => {
e . preventDefault ( )
answer . value = ""
isLoading . value = true
const query = new URLSearchParams ( { query : inputRef . current ! . value } )
const projectUrl = `https://your-project-ref.functions.supabase.co`
const queryURL = ` ${ projectURL } / ${ query } `
const eventSource = new EventSource ( queryURL )
eventSource . addEventListener ( "error" , ( err ) => {
isLoading . value = false
console . error ( err )
} )
eventSource . addEventListener ( "message" , ( e : MessageEvent ) => {
isLoading . value = false
if ( e . data === "[DONE]" ) {
eventSource . close ( )
return
}
const completionResponse : CreateCompletionResponse = JSON . parse ( e . data )
const text = completionResponse . choices [ 0 ] . text
answer . value += text
} ) ;
isLoading . value = true
} 麻省理工學院