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() {
|
async function main() {
|
||||||
await redis.connect();
|
// Attach python listeners FIRST to avoid missing logs
|
||||||
await redis.ensureGroup("commands", "assistant");
|
|
||||||
|
|
||||||
await playAudio("Assistant, online.");
|
|
||||||
|
|
||||||
py.stdout.on("data", (data) => {
|
py.stdout.on("data", (data) => {
|
||||||
handlePythonOutput(data.toString(), async (msg) => {
|
handlePythonOutput(data.toString(), async (msg) => {
|
||||||
if (msg.event === "text" || msg.event === "final") {
|
if (msg.event === "text" || msg.event === "final") {
|
||||||
@ -168,7 +164,18 @@ async function main() {
|
|||||||
console.log("Python exited with code", code);
|
console.log("Python exited with code", code);
|
||||||
});
|
});
|
||||||
|
|
||||||
processor("assistant", `${config.DEVICE_ID}`, "commands").catch(console.error);
|
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);
|
main().catch(console.error);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user