更新test测试页面,使用ota返回的连接信息和认证信息

This commit is contained in:
Chingfeng Li
2025-10-17 17:51:56 +08:00
parent 13ce67e4c7
commit 49e1bbbf15
2 changed files with 41 additions and 28 deletions
+4 -9
View File
@@ -133,8 +133,8 @@
<div class="connection-controls">
<input type="text" id="otaUrl" value="http://127.0.0.1:8002/xiaozhi/ota/"
placeholder="OTA服务器地址,如:http://127.0.0.1:8002/xiaozhi/ota/" />
<input type="text" id="serverUrl" value="ws://127.0.0.1:8000/xiaozhi/v1/"
placeholder="WebSocket服务器地址,如:ws://127.0.0.1:8000/xiaozhi/v1/" />
<input type="text" id="serverUrl" value="" readonly disabled
placeholder="自动从OTA接口获取" />
<button id="connectButton">连接</button>
<button id="authTestButton">测试认证</button>
</div>
@@ -714,7 +714,7 @@
localStorage.setItem('wsUrl', url);
try {
const ws = await webSocketConnect(otaUrl, url, config)
const ws = await webSocketConnect(otaUrl, config)
if (ws === undefined) {
return
}
@@ -756,7 +756,7 @@
messageInput.disabled = true;
sendTextButton.disabled = true;
recordButton.disabled = true;
stopButton.disabled = true;
// stopButton.disabled = true;
};
websocket.onerror = (error) => {
@@ -1049,11 +1049,6 @@
document.getElementById('otaUrl').value = savedOtaUrl;
}
const savedWsUrl = localStorage.getItem('wsUrl');
if (savedWsUrl) {
document.getElementById('serverUrl').value = savedWsUrl;
}
// 切换面板显示
toggleButton.addEventListener('click', () => {
const isExpanded = configPanel.classList.contains('expanded');