From bb8f961f7f6dc26c46bc8ee82ecfaeaabacbbe91 Mon Sep 17 00:00:00 2001
From: Sunil Pai <spai@cloudflare.com>
Date: Mon, 21 Oct 2024 19:29:49 +0100
Subject: [PATCH] fix: pass model on to .connect()

the `.connect()` method in `api.js` accepts a `{model: string}` param, but the client doesn't appear to pass it. This adds it on.
---
 lib/client.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/client.js b/lib/client.js
index be37288..a6353ba 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -387,13 +387,14 @@ export class RealtimeClient extends RealtimeEventHandler {
   /**
    * Connects to the Realtime WebSocket API
    * Updates session config and conversation config
+   * @param {{model?: string|undefined}} [settings]
    * @returns {Promise<true>}
    */
-  async connect() {
+  async connect({ model } = {}) {
     if (this.isConnected()) {
       throw new Error(`Already connected, use .disconnect() first`);
     }
-    await this.realtime.connect();
+    await this.realtime.connect({ model });
     this.updateSession();
     return true;
   }