Test handling intent through Redis Streams
This commit is contained in:
parent
ed41efcd47
commit
efd8439817
@ -10,7 +10,15 @@ const {sequelize, Sequelize} = db;
|
|||||||
|
|
||||||
const config = require("./config");
|
const config = require("./config");
|
||||||
|
|
||||||
const handleIntent = async (intent) => {
|
const handleIntent = async (streamKey, intent) => {
|
||||||
|
await redis.client.xAdd(
|
||||||
|
streamKey,
|
||||||
|
'*',
|
||||||
|
{
|
||||||
|
intent_id: intent.id,
|
||||||
|
command: "INTENT_RECEIVED"
|
||||||
|
}
|
||||||
|
)
|
||||||
console.log("TODO: Handle Intents", intent);
|
console.log("TODO: Handle Intents", intent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +39,7 @@ const processor = async (group, consumer, streamKey) => {
|
|||||||
for (const msg of stream.messages) {
|
for (const msg of stream.messages) {
|
||||||
console.log(`[${consumer}] Processing:`, msg);
|
console.log(`[${consumer}] Processing:`, msg);
|
||||||
|
|
||||||
await handleIntent(msg);
|
await handleIntent("speech:commands", msg);
|
||||||
|
|
||||||
await redis.client.xAck(streamKey, group, msg.id);
|
await redis.client.xAck(streamKey, group, msg.id);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user