diff --git a/src/app/agent/agent.component.ts b/src/app/agent/agent.component.ts index 5faac7e..05036c4 100644 --- a/src/app/agent/agent.component.ts +++ b/src/app/agent/agent.component.ts @@ -158,7 +158,7 @@ export class AgentComponent { public async connect() { this.logs.push("Connecting..."); - this.socket.connect(this.config?.apiKey ?? ""); + this.socket.connect(this.config?.apiKey ?? "", this.config?.sourceLanguage ?? "en"); while (!this.socket.isConnected()) { this.logs.push("Waiting for connection..."); await new Promise((resolve) => setTimeout(resolve, 1000)); diff --git a/src/app/socket.service.ts b/src/app/socket.service.ts index 1014c98..3277961 100644 --- a/src/app/socket.service.ts +++ b/src/app/socket.service.ts @@ -44,14 +44,14 @@ export class SocketService { /** * @param key */ - public connect(key: string): void { + public connect(key: string, lang: string): void { if (this.isConnected()) { throw new Error("Socket is already connected"); } if (!key) { throw new Error("API key is required"); } - this.socket = new WebSocket("wss://api.deepgram.com/v1/listen?model=nova-3-general&encoding=linear16&sample_rate=48000&channels=1&endpointing=500&punctuate=true", [ "token", key ]); + this.socket = new WebSocket(`wss://api.deepgram.com/v1/listen?model=nova-3-general&encoding=linear16&sample_rate=48000&channels=1&endpointing=500&punctuate=true&language=${lang}`, [ "token", key ]); this.socket.onopen = () => { console.log("open"); if (this.listeners.open) {