diff --git a/examples/webpage/app.js b/examples/webpage/app.js index 64e1499..693397d 100644 --- a/examples/webpage/app.js +++ b/examples/webpage/app.js @@ -175,11 +175,11 @@ function setConnectButton() { els.connectBtn.disabled = true; els.connectBtn.classList.remove("is-disconnect"); } else if (state.connected) { - els.connectBtn.textContent = "Disconnect"; + els.connectBtn.textContent = "断开连接"; els.connectBtn.disabled = false; els.connectBtn.classList.add("is-disconnect"); } else { - els.connectBtn.textContent = "Connect"; + els.connectBtn.textContent = "连接"; els.connectBtn.disabled = false; els.connectBtn.classList.remove("is-disconnect"); } @@ -683,7 +683,7 @@ function renderMicDevices() { state.micDevices.forEach((device, index) => { const option = document.createElement("option"); option.value = device.deviceId; - option.textContent = device.label || `Microphone ${index + 1}`; + option.textContent = device.label || `麦克风 ${index + 1}`; els.micSelect.appendChild(option); }); @@ -1254,7 +1254,7 @@ async function connect() { const chatId = inputChatId || generateChatId(); const url = wsUrlWithChatId(chatId); if (!url) { - setStatus("error", "Missing URL"); + setStatus("error", "缺少服务器地址"); return; } @@ -1273,9 +1273,9 @@ async function connect() { state.connecting = false; state.chatId = ""; if (!inputChatId) els.chatId.value = ""; - setStatus("error", "Audio init failed"); + setStatus("error", "音频初始化失败"); setConnectButton(); - addWsLog("error", `audio init failed: ${err.message || err}`, "error"); + addWsLog("error", `音频初始化失败:${err.message || err}`, "error"); return; } @@ -1287,9 +1287,9 @@ async function connect() { state.connecting = false; state.chatId = ""; if (!inputChatId) els.chatId.value = ""; - setStatus("error", "Bad URL"); + setStatus("error", "服务器地址无效"); setConnectButton(); - addWsLog("error", `bad websocket URL: ${err.message || err}`, "error"); + addWsLog("error", `WebSocket 地址无效:${err.message || err}`, "error"); return; } ws.binaryType = "arraybuffer"; @@ -1350,7 +1350,7 @@ async function connect() { ws.addEventListener("error", (err) => { console.error("WebSocket error", err); - setStatus("error", "Connection error"); + setStatus("error", "连接错误"); addWsLog("error", "websocket error", "error"); }); diff --git a/examples/webpage/index.html b/examples/webpage/index.html index 1bd37b7..4b4a621 100644 --- a/examples/webpage/index.html +++ b/examples/webpage/index.html @@ -1,5 +1,5 @@ - +
@@ -79,7 +79,7 @@拍照
Connect to the engine, enable your mic, and start talking.
+连接服务、开启麦克风后即可开始对话。
- Audio is streamed as PCM16 mono @ 16 kHz over
- /ws-product.
+ 音频通过 /ws-product 以 PCM16 单声道 16 kHz
+ 传输。