Fix typo, wrong variable and remove redis connection control in method

This commit is contained in:
Apher 2026-07-03 06:00:47 +00:00
parent 6a8f91f10d
commit 6e6b961816

View File

@ -10,9 +10,7 @@ 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, type, text) => {
await redis.client.connect().catch(console.error); await redis.client.xAdd(
await redis.xAdd(
streamKey, streamKey,
'*', '*',
{ {
@ -21,8 +19,6 @@ const sendTranscriptEvent = async (streamKey, type, text) => {
} }
) )
await redis.client.quit();
console.log("Transcript added to stream"); console.log("Transcript added to stream");
} }
@ -30,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(streamKey, "TEST", "TEST"); sendTranscriptEvent("speech:events", "TEST", "TEST");
while (true) { while (true) {
const res = await redis.client.xReadGroup( const res = await redis.client.xReadGroup(