@breeze.blue/sdk 0.5.0 → 0.5.1
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/CHANGELOG.md +13 -0
- package/README.md +19 -13
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
- Added official voice publishing metadata to `voices.savePreview(...)` and
|
|
6
|
+
`voices.edit(...)`, including `primaryCategoryCode`, `visibility`, and the
|
|
7
|
+
typed `SavedVoice` response.
|
|
8
|
+
- Aligned voice, history, and generation metadata with the public API by using
|
|
9
|
+
`origin` instead of the legacy category fields; voice search now accepts an
|
|
10
|
+
`origin` filter.
|
|
11
|
+
- Made `voices.edit(...)` support metadata-only updates without requiring a
|
|
12
|
+
voice name.
|
|
13
|
+
- Improved the realtime TTS example to start consuming before sending text and
|
|
14
|
+
continue until `turn.done`, so early audio is not missed.
|
|
15
|
+
|
|
3
16
|
## 0.5.0
|
|
4
17
|
|
|
5
18
|
- Fixed `textToSpeech.realtime.connect(...)` so a failed WebSocket handshake
|
package/README.md
CHANGED
|
@@ -112,29 +112,35 @@ Realtime needs a `WebSocket` implementation. Browsers, edge runtimes, and
|
|
|
112
112
|
Node 22+ provide a global one; on Node 20, pass a constructor (for example the
|
|
113
113
|
`ws` package's `WebSocket`) via `new BreezeBlueClient({ webSocket })`.
|
|
114
114
|
|
|
115
|
+
Start consuming before appending text. Audio can arrive after `flush()` and may
|
|
116
|
+
continue after `endTurn()`; keep the single consumer running until `turn.done`.
|
|
117
|
+
|
|
115
118
|
```ts
|
|
116
119
|
const connection = await client.textToSpeech.realtime.connect("voc_...", {
|
|
117
120
|
modelId: "bluebell-v1",
|
|
118
121
|
});
|
|
119
122
|
|
|
123
|
+
const pcmChunks: Uint8Array[] = [];
|
|
124
|
+
const consumer = (async () => {
|
|
125
|
+
for await (const message of connection) {
|
|
126
|
+
if (message.type === "audio") {
|
|
127
|
+
// Forward this chunk to your playback or transport layer immediately.
|
|
128
|
+
pcmChunks.push(message.audio);
|
|
129
|
+
} else if (message.type === "error") {
|
|
130
|
+
throw new Error(`Realtime TTS failed: ${message.code}: ${message.message}`);
|
|
131
|
+
} else if (message.type === "turn.done") {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
throw new Error("Realtime session closed before turn.done");
|
|
136
|
+
})();
|
|
137
|
+
|
|
120
138
|
connection.startTurn("turn_1");
|
|
121
139
|
connection.appendText("Hello from Breeze.");
|
|
122
140
|
connection.flush();
|
|
123
141
|
connection.endTurn();
|
|
124
142
|
|
|
125
|
-
|
|
126
|
-
for await (const message of connection) {
|
|
127
|
-
if (message.type === "audio") {
|
|
128
|
-
pcmChunks.push(message.audio);
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (message.type === "error") {
|
|
132
|
-
throw new Error(`Realtime TTS failed: ${message.code}: ${message.message}`);
|
|
133
|
-
}
|
|
134
|
-
if (message.type === "turn.done") {
|
|
135
|
-
break; // all audio for this turn has been delivered
|
|
136
|
-
}
|
|
137
|
-
}
|
|
143
|
+
await consumer;
|
|
138
144
|
connection.close();
|
|
139
145
|
```
|
|
140
146
|
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.5.
|
|
1
|
+
export declare const SDK_VERSION = "0.5.1";
|
|
2
2
|
export declare const SDK_NAME = "@breeze.blue/sdk";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.5.
|
|
1
|
+
export const SDK_VERSION = "0.5.1";
|
|
2
2
|
export const SDK_NAME = "@breeze.blue/sdk";
|