'commit'
This commit is contained in:
@@ -439,12 +439,17 @@ select {
|
||||
}
|
||||
|
||||
.result-text {
|
||||
color: #333;
|
||||
line-height: 1.5;
|
||||
max-height: 200px;
|
||||
overflow-y: auto;
|
||||
padding-right: 5px;
|
||||
word-break: break-all;
|
||||
/* 确保以下属性没有被设置为隐藏 */
|
||||
display: block !important; /* 添加此行强制显示 */
|
||||
visibility: visible !important;
|
||||
opacity: 1 !important;
|
||||
height: auto !important;
|
||||
overflow: visible !important;
|
||||
/* 其他样式保持不变 */
|
||||
margin: 10px 0;
|
||||
padding: 10px;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 音频播放器样式 */
|
||||
|
@@ -508,6 +508,8 @@ const AudioPlayer = {
|
||||
|
||||
// 隐藏播放界面 - 这是新增的代码
|
||||
UIController.toggleElement('audioPlayer', false);
|
||||
// 新增:音频播放结束,启用帮我讲题按钮
|
||||
UIController.setStartRecordButtonEnabled(true);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -524,6 +526,9 @@ const AudioPlayer = {
|
||||
AudioState.playback.currentChunkStartTime = Date.now();
|
||||
AudioState.playback.currentChunkDuration = audioBlob.size / 1024 / 16; // 估算时长
|
||||
|
||||
// 新增:音频开始播放前,禁用帮我讲题按钮
|
||||
UIController.setStartRecordButtonEnabled(false);
|
||||
|
||||
// 修改AudioPlayer.processAudioQueue方法中的播放部分
|
||||
AudioState.playback.streamAudioElement.play()
|
||||
.then(() => {
|
||||
@@ -657,6 +662,11 @@ const RecordingManager = {
|
||||
async startRecording() {
|
||||
console.log('开始录音');
|
||||
|
||||
// 新增:强制关闭并重置现有WebSocket连接
|
||||
if (AudioState.websocket.connection) {
|
||||
WebSocketManager.closeConnection();
|
||||
}
|
||||
|
||||
// 检查是否已经在录音
|
||||
if (AudioState.recording.isRecording) {
|
||||
console.warn('已经在录音中');
|
||||
@@ -667,6 +677,8 @@ const RecordingManager = {
|
||||
const initialized = await this.initRecording();
|
||||
if (!initialized) {
|
||||
console.error('录音初始化失败,无法开始录音');
|
||||
// 新增:初始化失败时重新启用按钮
|
||||
UIController.setStartRecordButtonEnabled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -748,11 +760,17 @@ const RecordingManager = {
|
||||
return false;
|
||||
}
|
||||
|
||||
console.log('音频数据参数:', {
|
||||
exists: !!audioBlob,
|
||||
size: audioBlob.size,
|
||||
type: audioBlob.type
|
||||
});
|
||||
// 新增:确保WebSocket连接已建立(最多等待1秒)
|
||||
let connectionAttempts = 0;
|
||||
const maxAttempts = 10;
|
||||
while (connectionAttempts < maxAttempts &&
|
||||
(!AudioState.websocket.isConnected ||
|
||||
!AudioState.websocket.connection ||
|
||||
AudioState.websocket.connection.readyState !== WebSocket.OPEN)) {
|
||||
console.log('等待WebSocket连接建立...', connectionAttempts);
|
||||
connectionAttempts++;
|
||||
await new Promise(resolve => setTimeout(resolve, 100));
|
||||
}
|
||||
|
||||
// 连接状态检查
|
||||
console.log('WebSocket连接状态:', {
|
||||
|
Reference in New Issue
Block a user