Attach python listeners before await functions
This commit is contained in:
parent
6e8c689639
commit
882bc00916
@ -147,11 +147,7 @@ async function processor(group, consumer, streamKey) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await redis.connect();
|
||||
await redis.ensureGroup("commands", "assistant");
|
||||
|
||||
await playAudio("Assistant, online.");
|
||||
|
||||
// Attach python listeners FIRST to avoid missing logs
|
||||
py.stdout.on("data", (data) => {
|
||||
handlePythonOutput(data.toString(), async (msg) => {
|
||||
if (msg.event === "text" || msg.event === "final") {
|
||||
@ -168,7 +164,18 @@ async function main() {
|
||||
console.log("Python exited with code", code);
|
||||
});
|
||||
|
||||
try {
|
||||
await redis.connect();
|
||||
await redis.ensureGroup("commands", "assistant");
|
||||
await playAudio("Assistant, online.");
|
||||
|
||||
// Start the command processor
|
||||
processor("assistant", `${config.DEVICE_ID}`, "commands").catch(console.error);
|
||||
|
||||
console.log("System fully initialized.");
|
||||
} catch (err) {
|
||||
console.error("Initialization failed:", err);
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user