ai-tube / src /app /api /parsers /parseLatentSearchMode.ts
jbilcke-hf's picture
jbilcke-hf HF staff
upgraded to @aitube/client 0.0.12
f24ad59
raw
history blame
414 Bytes
import { LatentSearchMode } from "../v1/search/route"
export function parseLatentSearchMode(input?: any, defaultMode: LatentSearchMode = "basic"): LatentSearchMode {
let mode = defaultMode
try {
let maybeMode = decodeURIComponent(`${input || ""}` || defaultMode).trim()
mode = ["basic", "extended"].includes(maybeMode) ? (maybeMode as LatentSearchMode) : defaultMode
} catch (err) {}
return mode
}