agrasya-voice-sdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -34,6 +34,8 @@ __export(index_exports, {
34
34
  });
35
35
  module.exports = __toCommonJS(index_exports);
36
36
  var import_socket = __toESM(require("socket.io-client"));
37
+ var import_dotenv = __toESM(require("dotenv"));
38
+ import_dotenv.default.config();
37
39
  var AgrasyaVoiceSDK = class {
38
40
  config;
39
41
  events;
@@ -47,7 +49,7 @@ var AgrasyaVoiceSDK = class {
47
49
  durationInterval = null;
48
50
  constructor(config, events = {}) {
49
51
  this.config = {
50
- baseUrl: "http://localhost:4001",
52
+ baseUrl: process.env.API_BASE_URL,
51
53
  language: "",
52
54
  debug: false,
53
55
  ...config
@@ -125,8 +127,8 @@ var AgrasyaVoiceSDK = class {
125
127
  }
126
128
  const offer = await this.peerConnection.createOffer();
127
129
  await this.peerConnection.setLocalDescription(offer);
128
- const baseUrl = "https://api.openai.com/v1/realtime/calls";
129
- const model = "gpt-realtime";
130
+ const baseUrl = process.env.API_URL;
131
+ const model = process.env.MODEL_NAME;
130
132
  const sdpResponse = await fetch(`${baseUrl}?model=${model}`, {
131
133
  method: "POST",
132
134
  body: offer.sdp,
package/dist/index.mjs CHANGED
@@ -1,5 +1,7 @@
1
1
  // src/index.ts
2
2
  import io from "socket.io-client";
3
+ import dotenv from "dotenv";
4
+ dotenv.config();
3
5
  var AgrasyaVoiceSDK = class {
4
6
  config;
5
7
  events;
@@ -13,7 +15,7 @@ var AgrasyaVoiceSDK = class {
13
15
  durationInterval = null;
14
16
  constructor(config, events = {}) {
15
17
  this.config = {
16
- baseUrl: "http://localhost:4001",
18
+ baseUrl: process.env.API_BASE_URL,
17
19
  language: "",
18
20
  debug: false,
19
21
  ...config
@@ -91,8 +93,8 @@ var AgrasyaVoiceSDK = class {
91
93
  }
92
94
  const offer = await this.peerConnection.createOffer();
93
95
  await this.peerConnection.setLocalDescription(offer);
94
- const baseUrl = "https://api.openai.com/v1/realtime/calls";
95
- const model = "gpt-realtime";
96
+ const baseUrl = process.env.API_URL;
97
+ const model = process.env.MODEL_NAME;
96
98
  const sdpResponse = await fetch(`${baseUrl}?model=${model}`, {
97
99
  method: "POST",
98
100
  body: offer.sdp,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrasya-voice-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -26,6 +26,7 @@
26
26
  "typescript": "^5.0.0"
27
27
  },
28
28
  "dependencies": {
29
+ "dotenv": "^17.3.1",
29
30
  "react-native-webrtc": "^124.0.7",
30
31
  "socket.io-client": "^4.8.3"
31
32
  }