1
0
mirror of https://github.com/osmarks/meme-search-engine.git synced 2025-04-29 14:03:10 +00:00

fix embedding-from-URL feature

This commit is contained in:
osmarks 2025-01-31 14:10:15 +00:00
parent e57931d47f
commit 899fbb7092

View File

@ -300,6 +300,20 @@
}
}
const decodeFloat16 = uint16 => {
const sign = (uint16 & 0x8000) ? -1 : 1
const exponent = (uint16 & 0x7C00) >> 10
const fraction = uint16 & 0x03FF
if (exponent === 0) {
return sign * Math.pow(2, -14) * (fraction / Math.pow(2, 10))
} else if (exponent === 0x1F) {
return fraction ? NaN : sign * Infinity
} else {
return sign * Math.pow(2, exponent - 15) * (1 + fraction / Math.pow(2, 10))
}
}
const parseQueryString = queryStringParams => {
if (queryStringParams.get("q") && queryTerms.length === 0) {
newTextQuery(queryStringParams.get("q"))
@ -346,20 +360,6 @@
return `${snd}/${fst}`
}
const decodeFloat16 = uint16 => {
const sign = (uint16 & 0x8000) ? -1 : 1
const exponent = (uint16 & 0x7C00) >> 10
const fraction = uint16 & 0x03FF
if (exponent === 0) {
return sign * Math.pow(2, -14) * (fraction / Math.pow(2, 10))
} else if (exponent === 0x1F) {
return fraction ? NaN : sign * Infinity
} else {
return sign * Math.pow(2, exponent - 15) * (1 + fraction / Math.pow(2, 10))
}
}
const focusEl = el => el.focus()
const removeTerm = term => {
queryTerms = queryTerms.filter(x => x !== term)