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