Update voice demo language problem

This commit is contained in:
Xin Wang
2026-06-02 12:31:34 +08:00
parent 82a0cec38e
commit aae751f3f3
3 changed files with 136 additions and 104 deletions

View File

@@ -16,7 +16,7 @@
<div class="connection">
<label class="connection__field">
<span>WebSocket URL</span>
<span>服务器地址</span>
<input
id="ws-url"
type="text"
@@ -26,12 +26,12 @@
/>
</label>
<label class="connection__field connection__field--chat">
<span>Chat ID</span>
<span>会话 ID</span>
<div class="chat-id-control">
<input
id="chat-id"
type="text"
placeholder="optional chatId"
placeholder="可选"
spellcheck="false"
autocomplete="off"
/>
@@ -40,8 +40,8 @@
class="chat-id-control__copy"
type="button"
disabled
title="Copy Chat ID"
aria-label="Copy Chat ID"
title="复制会话 ID"
aria-label="复制会话 ID"
>
<svg class="copy-icon copy-icon--default" viewBox="0 0 16 16" width="14" height="14" fill="none" aria-hidden="true">
<rect x="5" y="5" width="8" height="9" rx="1.5" stroke="currentColor" stroke-width="1.4"/>
@@ -54,13 +54,13 @@
</div>
</label>
<button id="connect-btn" class="btn btn--primary" type="button">
Connect
连接
</button>
</div>
<div class="status">
<span id="status-dot" class="status__dot status__dot--idle"></span>
<span id="status-text" class="status__text">Disconnected</span>
<span id="status-text" class="status__text">未连接</span>
</div>
</header>
@@ -70,13 +70,13 @@
<aside
id="camera-drawer"
class="camera-drawer"
aria-label="Camera capture step"
aria-label="拍照步骤"
aria-hidden="true"
>
<div class="camera-drawer__panel">
<div class="camera-drawer__header">
<div>
<p class="camera-drawer__eyebrow">Camera</p>
<p class="camera-drawer__eyebrow">拍照</p>
<h2>拍照步骤</h2>
</div>
<span id="camera-state" class="camera-drawer__state">State -</span>
@@ -109,21 +109,48 @@
<p id="camera-question" class="camera-drawer__question"></p>
<div class="camera-drawer__sources">
<button
id="camera-start-btn"
class="btn btn--ghost camera-drawer__source"
type="button"
>
使用摄像头
</button>
<select
id="camera-device-select"
class="camera-drawer__select"
aria-label="选择摄像头"
disabled
>
<option value="">默认摄像头</option>
</select>
<div class="camera-drawer__camera-row">
<label class="device-picker">
<span class="device-picker__label">摄像头</span>
<select
id="camera-device-select"
class="device-picker__select"
disabled
>
<option value="">默认摄像头</option>
</select>
</label>
<button
id="camera-start-btn"
class="mic-btn cam-btn"
type="button"
title="打开摄像头"
>
<svg
class="mic-btn__icon"
viewBox="0 0 24 24"
width="24"
height="24"
aria-hidden="true"
>
<path
d="M4 8h3l1.2-1.6A1 1 0 0 1 9 6h6a1 1 0 0 1 .8.4L17 8h3a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1Z"
fill="none"
stroke="currentColor"
stroke-width="1.6"
/>
<circle
cx="12"
cy="13"
r="3.2"
fill="none"
stroke="currentColor"
stroke-width="1.6"
/>
</svg>
<span class="mic-btn__label">使用摄像头</span>
</button>
</div>
<label
class="btn btn--ghost camera-drawer__source camera-drawer__source--upload"
>
@@ -155,7 +182,7 @@
</div>
</aside>
<section class="chat" aria-label="Conversation history">
<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>
@@ -168,7 +195,7 @@
</section>
</div>
<footer class="controls" aria-label="Chat controls">
<footer class="controls" aria-label="操作栏">
<div class="meter" aria-hidden="true">
<div id="meter-fill" class="meter__fill"></div>
</div>
@@ -178,7 +205,7 @@
id="text-input"
class="composer__input"
rows="1"
placeholder="Type a message, or use the mic…"
placeholder="输入消息,或使用麦克风…"
disabled
></textarea>
<button
@@ -186,17 +213,17 @@
class="btn btn--primary composer__send"
type="submit"
disabled
title="Send message (Enter)"
title="发送消息 (Enter)"
>
Send
发送
</button>
</form>
<div class="controls__row">
<label class="device-picker">
<span class="device-picker__label">Microphone</span>
<span class="device-picker__label">麦克风</span>
<select id="mic-select" class="device-picker__select" disabled>
<option value="">Default microphone</option>
<option value="">默认麦克风</option>
</select>
</label>
@@ -206,7 +233,7 @@
type="button"
disabled
aria-pressed="false"
title="Mic is off"
title="麦克风已关闭"
>
<svg
class="mic-btn__icon"
@@ -224,52 +251,52 @@
fill="currentColor"
/>
</svg>
<span class="mic-btn__label">Enable mic</span>
<span class="mic-btn__label">开启麦克风</span>
</button>
<div class="indicators">
<span id="mic-indicator" class="indicator">
<span class="indicator__dot indicator__dot--mic"></span>
<span class="indicator__label">Mic</span>
<span class="indicator__label">麦克风</span>
</span>
<span id="bot-indicator" class="indicator">
<span class="indicator__dot indicator__dot--bot"></span>
<span class="indicator__label">Bot</span>
<span class="indicator__label">助手</span>
</span>
<span id="state-indicator" class="indicator indicator--state">
<span class="indicator__dot indicator__dot--state"></span>
<span id="state-label" class="indicator__label">State -</span>
<span id="state-label" class="indicator__label">状态 -</span>
</span>
</div>
<button id="clear-btn" class="btn btn--ghost" type="button">
Clear
清空
</button>
</div>
<p class="hint">
Press <kbd>Enter</kbd> to send, <kbd>Shift</kbd>+<kbd>Enter</kbd>
for newline. Sending text will interrupt the bot if it's speaking.
Browser echo cancellation is on; use headphones if echo persists.
<kbd>Enter</kbd> 发送,<kbd>Shift</kbd>+<kbd>Enter</kbd>
换行。发送文字会打断正在说话的助手。
浏览器回声消除已开启,如有回音请使用耳机。
</p>
</footer>
</div>
<section class="ws-log" aria-label="WebSocket log">
<section class="ws-log" aria-label="WebSocket 日志">
<div class="ws-log__header">
<div class="ws-log__header-left">
<h2>WebSocket Log</h2>
<h2>WebSocket 日志</h2>
<div class="ws-log__legend" aria-hidden="true">
<span class="ws-log__legend-item ws-log__legend-item--send">Send</span>
<span class="ws-log__legend-item ws-log__legend-item--recv">Recv</span>
<span class="ws-log__legend-item ws-log__legend-item--send">发送</span>
<span class="ws-log__legend-item ws-log__legend-item--recv">接收</span>
</div>
</div>
<button id="clear-ws-log-btn" class="btn btn--ghost" type="button">
Clear log
清空日志
</button>
</div>
<div id="ws-log" class="ws-log__body" role="log" aria-live="polite">
<div class="ws-log__empty">No websocket events yet.</div>
<div class="ws-log__empty">暂无 WebSocket 事件。</div>
</div>
</section>
</div>