@coze/realtime-api 1.0.2 → 1.0.3-beta.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/README.md +7 -2
- package/dist/cjs/{index.cjs → index.js} +1518 -1354
- package/dist/esm/{index.js → index.mjs} +1518 -1354
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/utils.d.ts +7 -0
- package/dist/umd/index.js +1517 -1353
- package/package.json +27 -19
- package/assets/api-overview.png +0 -0
- /package/dist/{esm → cjs}/index.js.LICENSE.txt +0 -0
- /package/dist/{cjs/index.cjs.LICENSE.txt → esm/index.mjs.LICENSE.txt} +0 -0
package/README.md
CHANGED
@@ -45,6 +45,11 @@ import { RealtimeClient, EventNames, RealtimeUtils } from "@coze/realtime-api";
|
|
45
45
|
const client = new RealtimeClient({
|
46
46
|
baseURL: "https://api.coze.cn",
|
47
47
|
accessToken: "your_access_token",
|
48
|
+
// or
|
49
|
+
// accessToken: async () => {
|
50
|
+
// // refresh token if expired
|
51
|
+
// return 'your_oauth_token';
|
52
|
+
// },
|
48
53
|
botId: "your_bot_id",
|
49
54
|
voiceId: "your_voice_id", // Optional: Specify voice ID
|
50
55
|
conversationId: "conversation_id", // Optional: For conversation continuity
|
@@ -58,8 +63,8 @@ const client = new RealtimeClient({
|
|
58
63
|
// Essential Setup
|
59
64
|
async function initializeVoiceChat() {
|
60
65
|
// 1. Verify device permissions
|
61
|
-
const
|
62
|
-
if (!
|
66
|
+
const result = await RealtimeUtils.checkDevicePermission();
|
67
|
+
if (!result.audio) {
|
63
68
|
throw new Error("Microphone access required");
|
64
69
|
}
|
65
70
|
|