Fetch intents from db when transcription needs classification

This commit is contained in:
Apher 2026-07-08 01:28:17 +00:00
parent 9fc4d3cb94
commit f5c2394bc8

View File

@ -85,6 +85,8 @@ async function embed(text) {
async function classifyIntent(text) {
const inputEmbedding = await embed(text);
const INTENTS = getIntents();
let best = {
name: "unknown",
confidence: 0,
@ -126,7 +128,7 @@ async function handleIntent(streamKey, msg) {
text,
});
console.log("TODO: Handle Intents", intent);
console.log("Handling intent", intent);
}
async function processor(group, consumer, streamKey) {
@ -166,14 +168,12 @@ const main = async () => {
if (doForce) console.info("Database dropped and resynced (force=true).");
const INTENTS = getIntents();
await initModel();
await redis.ensureGroup("transcripts", 'nlp');
await redis.ensureGroup("commands", 'nlp');
processor('nlp', `${config.DEVICE_ID}`, "transcripts").catch(console.error);
processor('nlp', `${config.DEVICE_ID}`, "transcripts", INTENTS).catch(console.error);
}
main().catch(console.error);