Added semantic episode searching

This commit is contained in:
Storme-bit
2026-04-05 21:49:31 -07:00
parent 8765dc3c2d
commit b71005d2b1
4 changed files with 100 additions and 14 deletions

View File

@@ -0,0 +1,18 @@
const {getEnv, SERVICES } = require('@nexusai/shared')
const BASE_URL = getEnv('EMBEDDING_SERVICE_URL', SERVICES.EMBEDDING_URL);
async function embed(text) {
const res = await fetch(`${BASE_URL}/embed`, {
method: 'POST',
headers: { 'Content-Type': 'application/json'},
body: JSON.stringify({text}),
})
if (!res.ok) throw new Error(`Embedding service error: ${res.status}`);
const data = await res.json();
return data.embedding;
}
module.exports = { embed };