Change attribute and stream names.

This commit is contained in:
Apher 2026-07-05 06:01:14 +00:00
parent 44e34c0c36
commit 604e029390

View File

@ -9,13 +9,13 @@ const redis = models.redis;
const config = require("./config"); const config = require("./config");
// Send Speech to Text to Redis Stream // Send Speech to Text to Redis Stream
const sendTranscriptEvent = async (streamKey, type, text) => { const sendTranscriptEvent = async (streamKey, device_id, text) => {
await redis.client.xAdd( await redis.client.xAdd(
streamKey, streamKey,
'*', '*',
{ {
text: text, text: text,
type: type device_id: device_id
} }
) )
@ -26,7 +26,7 @@ const sendTranscriptEvent = async (streamKey, type, text) => {
const processor = async (group, consumer, streamKey) => { const processor = async (group, consumer, streamKey) => {
await redis.client.connect().catch(console.error); await redis.client.connect().catch(console.error);
sendTranscriptEvent("speech:events", "TEST", "TEST"); sendTranscriptEvent("transcripts", config.DEVICE_ID, "TEST");
while (true) { while (true) {
const res = await redis.client.xReadGroup( const res = await redis.client.xReadGroup(
@ -51,9 +51,9 @@ const processor = async (group, consumer, streamKey) => {
} }
const main = async () => { const main = async () => {
await redis.ensureGroup("speech:commands", `${config.DEVICE_ID}-cg`); await redis.ensureGroup("commands", 'assistant');
processor(`${config.DEVICE_ID}-cg`, `${config.DEVICE_ID}-consumer`, "speech:commands"); processor('assistant', `${config.DEVICE_ID}`, "commands");
} }
main().catch(console.error); main().catch(console.error);