update: 新增聊天输入框

This commit is contained in:
lww155
2026-01-20 09:16:45 +08:00
parent 778c4560fd
commit 83304c9ff4
9 changed files with 105 additions and 88 deletions
@@ -307,14 +307,7 @@ export class AudioRecorder {
// 发送监听开始消息
if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
const listenMessage = {
type: 'listen',
mode: 'manual',
state: 'start'
};
log(`发送录音开始消息: ${JSON.stringify(listenMessage)}`, 'info');
this.websocket.send(JSON.stringify(listenMessage));
log(`发送录音开始消息`, 'info');
} else {
log('WebSocket未连接,无法发送开始消息', 'error');
return false;
@@ -403,14 +396,6 @@ export class AudioRecorder {
if (this.websocket && this.websocket.readyState === WebSocket.OPEN) {
const emptyOpusFrame = new Uint8Array(0);
this.websocket.send(emptyOpusFrame);
const stopMessage = {
type: 'listen',
mode: 'manual',
state: 'stop'
};
this.websocket.send(JSON.stringify(stopMessage));
log('已发送录音停止信号', 'info');
}
@@ -62,18 +62,6 @@ function validateConfig(config) {
return true;
}
// 判断wsUrl路径是否存在错误
function validateWsUrl(wsUrl) {
if (wsUrl === '') return false;
// 检查URL格式
if (!wsUrl.startsWith('ws://') && !wsUrl.startsWith('wss://')) {
log('URL格式错误,必须以ws://或wss://开头', 'error');
return false;
}
return true
}
// OTA发送请求,验证状态,并返回响应数据
async function sendOTA(otaUrl, config) {
try {
@@ -421,7 +421,6 @@ export class WebSocketHandler {
const listenMessage = {
type: 'listen',
mode: 'manual',
state: 'detect',
text: text
};