This commit is contained in:
akdeb 2026-04-17 12:15:34 +05:30
parent c8748c0535
commit cebf922608
3 changed files with 10 additions and 7 deletions

View file

@ -13,8 +13,8 @@
// For ELATO_MODE, you will need to register your DIY Hardware on the Elato website
// #define DEV_MODE
#define PROD_MODE
// #define ELATO_MODE
// #define PROD_MODE
#define ELATO_MODE
// ---------- CHOOSE YOUR VOICE SERVER ----------
// Keep this separate from DEV/PROD/ELATO so the deployment mode and the voice backend stay independent.

View file

@ -1,3 +1,4 @@
import { DurableObject } from "cloudflare:workers";
import type { Env } from "../src/types";
import { createOpusPacketizer } from "../src/opus";
import { getSystemPrompt } from "../src/prompt";
@ -93,15 +94,12 @@ async function synthesizeSpeech(env: Env, text: string): Promise<Response> {
) as Promise<Response>;
}
export class ElatoOpenAiVoiceAgent {
export class ElatoOpenAiVoiceAgent extends DurableObject<Env> {
private audioBuffer = new Uint8Array(0);
private isGenerating = false;
private readonly ctx: DurableObjectState;
private readonly env: Env;
constructor(ctx: DurableObjectState, env: Env) {
this.ctx = ctx;
this.env = env;
super(ctx, env);
}
private appendAudio(chunk: Uint8Array) {

View file

@ -13,3 +13,8 @@ class_name = "ElatoOpenAiVoiceAgent"
[[migrations]]
tag = "v1"
new_sqlite_classes = ["ElatoOpenAiVoiceAgent"]
[observability]
[observability.logs]
enabled = false
invocation_logs = true