Update voice demo ui language
This commit is contained in:
@@ -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");
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
@@ -79,7 +79,7 @@
|
||||
<p class="camera-drawer__eyebrow">拍照</p>
|
||||
<h2>拍照步骤</h2>
|
||||
</div>
|
||||
<span id="camera-state" class="camera-drawer__state">State -</span>
|
||||
<span id="camera-state" class="camera-drawer__state">状态 -</span>
|
||||
</div>
|
||||
|
||||
<div id="camera-preview" class="camera-drawer__preview">
|
||||
@@ -93,7 +93,7 @@
|
||||
<img
|
||||
id="camera-photo"
|
||||
class="camera-drawer__photo"
|
||||
alt="Selected image preview"
|
||||
alt="已选择图片预览"
|
||||
/>
|
||||
<span class="camera-drawer__corner camera-drawer__corner--tl"></span>
|
||||
<span class="camera-drawer__corner camera-drawer__corner--tr"></span>
|
||||
@@ -166,10 +166,10 @@
|
||||
<section class="chat" aria-label="对话记录">
|
||||
<div id="chat-log" class="chat__log" role="log" aria-live="polite">
|
||||
<div class="chat__empty">
|
||||
<p>Connect to the engine, enable your mic, and start talking.</p>
|
||||
<p>连接服务、开启麦克风后即可开始对话。</p>
|
||||
<p class="chat__hint">
|
||||
Audio is streamed as PCM16 mono @ 16 kHz over
|
||||
<code>/ws-product</code>.
|
||||
音频通过 <code>/ws-product</code> 以 PCM16 单声道 16 kHz
|
||||
传输。
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user