Merge pull request 'Change attribute and stream names.' (#4) from redis-streams-naming into main
Reviewed-on: Spilum.Net/Many-Tailed-Fox#4
This commit is contained in:
commit
dcdbbb0f2a
@ -15,8 +15,9 @@ const handleIntent = async (streamKey, intent) => {
|
|||||||
streamKey,
|
streamKey,
|
||||||
'*',
|
'*',
|
||||||
{
|
{
|
||||||
intent_id: intent.id,
|
transcript_id: intent.id,
|
||||||
command: "INTENT_RECEIVED"
|
command: "[TEST] INTENT_RECEIVED",
|
||||||
|
device_id: intent.message.device_id
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
console.log("TODO: Handle Intents", intent);
|
console.log("TODO: Handle Intents", intent);
|
||||||
@ -39,7 +40,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("speech:commands", msg);
|
await handleIntent("commands", msg);
|
||||||
|
|
||||||
await redis.client.xAck(streamKey, group, msg.id);
|
await redis.client.xAck(streamKey, group, msg.id);
|
||||||
}
|
}
|
||||||
@ -56,9 +57,10 @@ const main = async () => {
|
|||||||
await sequelize.sync({force: doForce});
|
await sequelize.sync({force: doForce});
|
||||||
if (doForce) console.info("Database dropped and resynced (force=true).");
|
if (doForce) console.info("Database dropped and resynced (force=true).");
|
||||||
|
|
||||||
await redis.ensureGroup("speech:events", `${config.DEVICE_ID}-cg`);
|
await redis.ensureGroup("transcripts", 'nlp');
|
||||||
|
await redis.ensureGroup("commands", 'nlp');
|
||||||
|
|
||||||
processor(`${config.DEVICE_ID}-cg`, `${config.DEVICE_ID}-consumer`, "speech:events");
|
processor('nlp', `${config.DEVICE_ID}`, "transcripts");
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch(console.error);
|
main().catch(console.error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user