diff --git a/chat_history.json b/chat_history.json index 0637a08..023ae74 100644 --- a/chat_history.json +++ b/chat_history.json @@ -1 +1,272 @@ -[] \ No newline at end of file +[ + { + "role": "user", + "content": "你好。", + "timestamp": "2025-07-27T14:31:39.908Z" + }, + { + "role": "assistant", + "content": "哟,还这么客气呢?周末打算干啥呀? ", + "timestamp": "2025-07-27T14:31:39.908Z" + }, + { + "role": "user", + "content": "不打算干啥。", + "timestamp": "2025-07-27T14:31:52.513Z" + }, + { + "role": "assistant", + "content": "得嘞,那咱宅家咋样,我发现个超搞笑综艺。 ", + "timestamp": "2025-07-27T14:31:52.513Z" + }, + { + "role": "user", + "content": "哎,我不知道。", + "timestamp": "2025-07-27T14:32:00.781Z" + }, + { + "role": "assistant", + "content": "不知道啥呀?综艺还是宅家咋安排?要不咱叫点烧烤边吃边看? ", + "timestamp": "2025-07-27T14:32:00.781Z" + }, + { + "role": "user", + "content": "到咯,佢到咯,我做饭啊。", + "timestamp": "2025-07-27T14:32:06.301Z" + }, + { + "role": "assistant", + "content": "哟,背着我悄悄准备做饭啦!做啥好吃的,有我份不? ", + "timestamp": "2025-07-27T14:32:06.301Z" + }, + { + "role": "user", + "content": "到咯,佢到咯,我做饭啊。要3秒,要开大。", + "timestamp": "2025-07-27T14:32:08.465Z" + }, + { + "role": "assistant", + "content": "啥跟啥啊?说的我一头雾水。你是准备做饭吗?需不需要我帮你弄点啥,冰箱里还有鸡蛋和青菜呢。 ", + "timestamp": "2025-07-27T14:32:08.465Z" + }, + { + "role": "user", + "content": "Hello, hello.", + "timestamp": "2025-07-27T14:39:43.062Z" + }, + { + "role": "assistant", + "content": "别搁那hello了,快跟我说说你做饭啥情况,要开啥大?是火开大点吗? ", + "timestamp": "2025-07-27T14:39:43.062Z" + }, + { + "role": "user", + "content": "你说话啊。", + "timestamp": "2025-07-27T14:40:45.074Z" + }, + { + "role": "assistant", + "content": "我一直说呢!你做饭开啥大快说清楚,别搁这“挤牙膏”啦! ", + "timestamp": "2025-07-27T14:40:45.074Z" + }, + { + "role": "user", + "content": "挤牙膏。", + "timestamp": "2025-07-27T14:40:56.087Z" + }, + { + "role": "assistant", + "content": "服了你这个老六,别老重复我话呀,好好跟我讲讲做饭到底咋回事。 ", + "timestamp": "2025-07-27T14:40:56.087Z" + }, + { + "role": "user", + "content": "你好啊!", + "timestamp": "2025-07-27T14:44:25.948Z" + }, + { + "role": "assistant", + "content": "别装礼貌啦,快接着说做饭那事儿,咋个“要3秒,要开大”法? ", + "timestamp": "2025-07-27T14:44:25.948Z" + }, + { + "role": "user", + "content": "开大招。", + "timestamp": "2025-07-27T14:46:10.186Z" + }, + { + "role": "assistant", + "content": "靠!还开大招,你做饭当打游戏呢?说清楚要干啥! ", + "timestamp": "2025-07-27T14:46:10.186Z" + }, + { + "role": "user", + "content": "在干嘛呢?", + "timestamp": "2025-07-27T14:47:35.754Z" + }, + { + "role": "assistant", + "content": "等你说清楚做饭的事儿呢!你到底要把啥开大,火还是调料量? ", + "timestamp": "2025-07-27T14:47:35.754Z" + }, + { + "role": "user", + "content": "火呀!", + "timestamp": "2025-07-27T14:47:47.933Z" + }, + { + "role": "assistant", + "content": "妥,炒菜火大才香。炒啥呢?", + "timestamp": "2025-07-27T14:47:47.933Z" + }, + { + "role": "user", + "content": "瞅你长得好看。", + "timestamp": "2025-07-27T14:48:00.643Z" + }, + { + "role": "assistant", + "content": "少来转移话题啊,先把你炒的菜说清楚,我好给你参谋参谋这火咋开。 ", + "timestamp": "2025-07-27T14:48:00.643Z" + }, + { + "role": "user", + "content": "我喜欢你。", + "timestamp": "2025-07-27T14:48:18.743Z" + }, + { + "role": "assistant", + "content": "哟,嘴甜起来了。不过先别搁这哄我,菜还等着呢,到底炒啥? ", + "timestamp": "2025-07-27T14:48:18.743Z" + }, + { + "role": "user", + "content": "现在的孩子,真的没得到头,全部拿福祝了。", + "timestamp": "2025-07-27T14:48:32.883Z" + }, + { + "role": "assistant", + "content": "啥意思啊?没太懂,先把你炒菜的事儿弄明白,这火还开着呢! ", + "timestamp": "2025-07-27T14:48:32.883Z" + }, + { + "role": "user", + "content": "那个", + "timestamp": "2025-07-27T14:48:45.683Z" + }, + { + "role": "assistant", + "content": "别“那个”了,急死我,菜名快说! ", + "timestamp": "2025-07-27T14:48:45.683Z" + }, + { + "role": "user", + "content": "say-3s-m-sw", + "timestamp": "2025-07-27T14:53:33.356Z" + }, + { + "role": "assistant", + "content": "这啥暗语啊?别整这些花里胡哨的,赶紧说炒啥菜,火大了糊锅啦! ", + "timestamp": "2025-07-27T14:53:33.356Z" + }, + { + "role": "user", + "content": "Hello.", + "timestamp": "2025-07-27T14:56:12.312Z" + }, + { + "role": "assistant", + "content": "别搁这整洋文了,快告诉我炒啥,再不说菜没法要了! ", + "timestamp": "2025-07-27T14:56:12.312Z" + }, + { + "role": "user", + "content": "我喜欢你。", + "timestamp": "2025-07-27T14:56:26.151Z" + }, + { + "role": "assistant", + "content": "知道啦知道啦,先解决炒菜这事儿,到底炒啥呀! ", + "timestamp": "2025-07-27T14:56:26.151Z" + }, + { + "role": "user", + "content": "也还行啊。", + "timestamp": "2025-07-27T14:56:38.392Z" + }, + { + "role": "assistant", + "content": "啥也还行?你就痛痛快快说炒啥菜,别在这打哑谜了! ", + "timestamp": "2025-07-27T14:56:38.392Z" + }, + { + "role": "user", + "content": "你好啊!", + "timestamp": "2025-07-27T15:56:10.807Z" + }, + { + "role": "assistant", + "content": "哟,整这么客气干啥,快把炒菜的事儿说明白。 ", + "timestamp": "2025-07-27T15:56:10.807Z" + }, + { + "role": "user", + "content": "哈哈。", + "timestamp": "2025-07-27T15:56:20.531Z" + }, + { + "role": "assistant", + "content": "别光笑啊,菜名呢?我都等半天了! ", + "timestamp": "2025-07-27T15:56:20.531Z" + }, + { + "role": "user", + "content": "是不会哦。", + "timestamp": "2025-07-27T15:56:22.209Z" + }, + { + "role": "assistant", + "content": "啥不会?炒菜步骤不会还是菜名没定啊?别磨叽! ", + "timestamp": "2025-07-27T15:56:22.210Z" + }, + { + "role": "user", + "content": "你好。", + "timestamp": "2025-07-27T15:57:59.101Z" + }, + { + "role": "assistant", + "content": "别老“你好”啦,咱快把炒菜这事儿搞定,你到底要炒啥! ", + "timestamp": "2025-07-27T15:57:59.101Z" + }, + { + "role": "user", + "content": "你好啊!", + "timestamp": "2025-07-27T16:07:56.242Z" + }, + { + "role": "assistant", + "content": "靠!别老说这俩字,赶紧跟我讲菜,不然我要发火啦! ", + "timestamp": "2025-07-27T16:07:56.242Z" + }, + { + "role": "user", + "content": "吃什么菜?", + "timestamp": "2025-07-27T16:08:10.403Z" + }, + { + "role": "assistant", + "content": "这就对了嘛!你可以试试炒个酸辣土豆丝,简单又好吃。你觉得咋样? ", + "timestamp": "2025-07-27T16:08:10.403Z" + }, + { + "role": "user", + "content": "我就是响应速度太长了。我没有问过他。我也不晓得。", + "timestamp": "2025-07-27T16:08:30.548Z" + }, + { + "role": "assistant", + "content": "啥响应速度?越说越迷糊。你就说对酸辣土豆丝感不感兴趣嘛! ", + "timestamp": "2025-07-27T16:08:30.548Z" + } +] \ No newline at end of file diff --git a/server.js b/server.js index e6f86d8..023e787 100644 --- a/server.js +++ b/server.js @@ -90,7 +90,9 @@ const videoMapping = { 'say-6s-m-e': '1-m.mp4', 'default': '0.mp4', 'say-5s-amplitude': '2.mp4', - 'say-5s-m-e': 'zxc.mp4' + 'say-5s-m-e': '4.mp4', + 'say-5s-m-sw': '5.mp4', + 'say-3s-m-sw': '6.mp4', }; // 默认视频流配置 @@ -213,7 +215,7 @@ io.on('connection', (socket) => { console.log('收到文本输入:', text, '来自用户:', socket.id); // 根据文本查找对应视频 - let videoFile = videoMapping['默认']; + let videoFile = videoMapping['default']; for (const [key, value] of Object.entries(videoMapping)) { if (text.toLowerCase().includes(key.toLowerCase())) { videoFile = value; @@ -237,7 +239,7 @@ io.on('connection', (socket) => { console.log('收到语音输入:', text, '来自用户:', socket.id); // 根据语音识别的文本查找对应视频 - let videoFile = videoMapping['默认']; + let videoFile = videoMapping['default']; for (const [key, value] of Object.entries(videoMapping)) { if (text.toLowerCase().includes(key.toLowerCase())) { videoFile = value; diff --git a/src/audio_processor.js b/src/audio_processor.js index 4734432..f27155c 100644 --- a/src/audio_processor.js +++ b/src/audio_processor.js @@ -93,7 +93,10 @@ class AudioProcessor { if (speechDuration >= this.minSpeechDuration) { console.log(`语音结束,时长: ${speechDuration}ms`); - await this.processAudioBuffer(); + console.log(window.webrtcApp.currentVideoTag) + if (window.webrtcApp.currentVideoTag==="default"){ + await this.processAudioBuffer(); + } this.onStatusUpdate('语音识别中...', 'processing'); } else { console.log('说话时长太短,忽略'); diff --git a/src/chat_with_audio.js b/src/chat_with_audio.js index 4e32fdf..4a63fc0 100644 --- a/src/chat_with_audio.js +++ b/src/chat_with_audio.js @@ -143,7 +143,7 @@ async function chatWithAudioStream(userInput) { audioHex: audioResult.data.audio }); console.log('音频已添加到队列,队列长度:', audioQueue.length); - + // this.socket.emit('audio-queue-updated', audioQueue.map(item => ({ text: item.text, hasAudio:!!item.audioHex }))); // 开始处理队列 processAudioQueue(); } diff --git a/src/index.html b/src/index.html index 86323ab..728e9ea 100644 --- a/src/index.html +++ b/src/index.html @@ -37,9 +37,9 @@