Fetch intents from db when transcription needs classification
This commit is contained in:
parent
9fc4d3cb94
commit
f5c2394bc8
@ -85,6 +85,8 @@ async function embed(text) {
|
|||||||
async function classifyIntent(text) {
|
async function classifyIntent(text) {
|
||||||
const inputEmbedding = await embed(text);
|
const inputEmbedding = await embed(text);
|
||||||
|
|
||||||
|
const INTENTS = getIntents();
|
||||||
|
|
||||||
let best = {
|
let best = {
|
||||||
name: "unknown",
|
name: "unknown",
|
||||||
confidence: 0,
|
confidence: 0,
|
||||||
@ -126,7 +128,7 @@ async function handleIntent(streamKey, msg) {
|
|||||||
text,
|
text,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("TODO: Handle Intents", intent);
|
console.log("Handling intent", intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processor(group, consumer, streamKey) {
|
async function processor(group, consumer, streamKey) {
|
||||||
@ -166,14 +168,12 @@ const main = async () => {
|
|||||||
|
|
||||||
if (doForce) console.info("Database dropped and resynced (force=true).");
|
if (doForce) console.info("Database dropped and resynced (force=true).");
|
||||||
|
|
||||||
const INTENTS = getIntents();
|
|
||||||
|
|
||||||
await initModel();
|
await initModel();
|
||||||
|
|
||||||
await redis.ensureGroup("transcripts", 'nlp');
|
await redis.ensureGroup("transcripts", 'nlp');
|
||||||
await redis.ensureGroup("commands", '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);
|
main().catch(console.error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user