-
Notifications
You must be signed in to change notification settings - Fork 0
/
get-example-embedding.js
41 lines (32 loc) · 980 Bytes
/
get-example-embedding.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { getEmbedding } from "./embed-into-supabase.js"
import { createClient } from '@supabase/supabase-js'
import dotenv from 'dotenv'
import clipboard from 'clipboardy';
dotenv.config()
const supabaseUrl = process.env.SUPABASE_URL
const supabaseKey = process.env.SUPABASE_KEY
const supabase = createClient(supabaseUrl, supabaseKey, {
auth: {
persistSession: false
}
})
// get a single highlight
export const getHighlight = async (id) => {
const { data: highlights, error } = await supabase.from('highlights').select('*').eq('id', id)
if (error) {
console.log(error)
return
}
return highlights[0]
}
// copy a highlight.embedding to clipboard
export const copyHighlightEmbedding = async (id) => {
const highlight = await getHighlight(id)
const embedding = highlight.embedding
clipboard.writeSync(embedding)
}
async function main() {
const id = process.argv[2]
await copyHighlightEmbedding(id)
}
main()