不对口型,添加调试人设对话
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m34s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m34s
				
			This commit is contained in:
		
							parent
							
								
									424b9f3c12
								
							
						
					
					
						commit
						9926ee0e68
					
				| @ -3,7 +3,7 @@ run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 | |||||||
| on: | on: | ||||||
|   push: |   push: | ||||||
|     branches: |     branches: | ||||||
|       - 'dev' |       - 'demo-t*' | ||||||
| 
 | 
 | ||||||
| env: | env: | ||||||
|   BUILD: staging |   BUILD: staging | ||||||
|  | |||||||
| @ -88,7 +88,7 @@ const connectedClients = new Map(); | |||||||
| // 视频映射配置
 | // 视频映射配置
 | ||||||
| const videoMapping = { | const videoMapping = { | ||||||
|   // 'say-6s-m-e': '1-m.mp4',
 |   // 'say-6s-m-e': '1-m.mp4',
 | ||||||
|   'default': 'chane.mp4', |   'default': 'chang.mp4', | ||||||
|   // 'say-5s-amplitude': '2.mp4',
 |   // 'say-5s-amplitude': '2.mp4',
 | ||||||
|   // 'say-5s-m-e': '4.mp4',
 |   // 'say-5s-m-e': '4.mp4',
 | ||||||
|   // 'say-5s-m-sw': 'd-0.mp4',
 |   // 'say-5s-m-sw': 'd-0.mp4',
 | ||||||
|  | |||||||
| @ -362,8 +362,23 @@ class AudioProcessor { | |||||||
|      |      | ||||||
|     // 停止录音
 |     // 停止录音
 | ||||||
|     stopRecording() { |     stopRecording() { | ||||||
|  |         console.log('开始停止录音...'); | ||||||
|  |          | ||||||
|  |         // 停止所有音频轨道
 | ||||||
|  |         if (this.stream) { | ||||||
|  |             this.stream.getTracks().forEach(track => { | ||||||
|  |                 track.stop(); | ||||||
|  |                 console.log(`停止音频轨道: ${track.label}`); | ||||||
|  |             }); | ||||||
|  |             this.stream = null; | ||||||
|  |         } | ||||||
|  |          | ||||||
|         if (this.audioContext) { |         if (this.audioContext) { | ||||||
|             this.audioContext.close(); |             this.audioContext.close().then(() => { | ||||||
|  |                 console.log('AudioContext已关闭'); | ||||||
|  |             }).catch(err => { | ||||||
|  |                 console.error('关闭AudioContext时出错:', err); | ||||||
|  |             }); | ||||||
|             this.audioContext = null; |             this.audioContext = null; | ||||||
|         } |         } | ||||||
|          |          | ||||||
| @ -377,12 +392,16 @@ class AudioProcessor { | |||||||
|             this.handleSpeechEnd(); |             this.handleSpeechEnd(); | ||||||
|         } |         } | ||||||
|          |          | ||||||
|  |         // 重置所有状态
 | ||||||
|         this.isRecording = false; |         this.isRecording = false; | ||||||
|         this.isSpeaking = false; |         this.isSpeaking = false; | ||||||
|         this.audioBuffer = []; |         this.audioBuffer = []; | ||||||
|  |         this.audioChunks = []; | ||||||
|  |         this.consecutiveFramesCount = 0; | ||||||
|  |         this.frameBuffer = []; | ||||||
|          |          | ||||||
|         this.onStatusUpdate('录音已停止', 'stopped'); |         this.onStatusUpdate('录音已完全停止', 'stopped'); | ||||||
|         console.log('录音已停止'); |         console.log('录音已完全停止,所有资源已释放'); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     // 获取录音状态
 |     // 获取录音状态
 | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ export const config = { | |||||||
|   // LLM API配置
 |   // LLM API配置
 | ||||||
|   llm: { |   llm: { | ||||||
|     apiKey: 'd012651b-a65b-4b13-8ff3-cc4ff3a29783', // 请替换为实际的API密钥
 |     apiKey: 'd012651b-a65b-4b13-8ff3-cc4ff3a29783', // 请替换为实际的API密钥
 | ||||||
|     model: 'bot-20250720193048-84fkp', |     model: 'bot-20250724150616-xqpz8', | ||||||
|   }, |   }, | ||||||
|    |    | ||||||
|   // Minimaxi API配置
 |   // Minimaxi API配置
 | ||||||
|  | |||||||
| @ -194,37 +194,40 @@ | |||||||
|         } |         } | ||||||
|          |          | ||||||
|         #startButton { |         #startButton { | ||||||
|  |             width: 60px; | ||||||
|  |             height: 60px; | ||||||
|  |             border-radius: 50%; | ||||||
|  |             background: rgba(34, 197, 94, 0.9); | ||||||
|  |             backdrop-filter: blur(10px); | ||||||
|  |             border: none; | ||||||
|  |             cursor: pointer; | ||||||
|  |             display: flex; | ||||||
|  |             align-items: center; | ||||||
|  |             justify-content: center; | ||||||
|  |             transition: all 0.3s ease; | ||||||
|  |             box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3); | ||||||
|  |             min-width: auto; | ||||||
|             padding: 15px 30px; |             padding: 15px 30px; | ||||||
|             font-size: 1.1rem; |             font-size: 1.1rem; | ||||||
|             border-radius: 25px; |             border-radius: 25px; | ||||||
|             min-width: 200px; |             min-width: 200px; | ||||||
|             background: rgba(0, 123, 255, 0.9); |  | ||||||
|             backdrop-filter: blur(10px); |  | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         #stopButton { |         #startButton:hover:not(:disabled) { | ||||||
|             width: 60px; |             background: rgba(22, 163, 74, 0.95); | ||||||
|             height: 60px; |  | ||||||
|             border-radius: 50%; |  | ||||||
|             background: rgba(220, 53, 69, 0.9); |  | ||||||
|             backdrop-filter: blur(10px); |  | ||||||
|             border: none; |  | ||||||
|             cursor: pointer; |  | ||||||
|             display: none; |  | ||||||
|             align-items: center; |  | ||||||
|             justify-content: center; |  | ||||||
|             transition: all 0.3s ease; |  | ||||||
|             box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3); |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         #stopButton.show { |  | ||||||
|             display: flex; |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         #stopButton:hover:not(:disabled) { |  | ||||||
|             background: rgba(200, 35, 51, 0.95); |  | ||||||
|             transform: scale(1.1); |             transform: scale(1.1); | ||||||
|             box-shadow: 0 6px 20px rgba(220, 53, 69, 0.5); |             box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5); | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         #startButton svg { | ||||||
|  |             width: 24px; | ||||||
|  |             height: 24px; | ||||||
|  |             fill: white; | ||||||
|  |         } | ||||||
|  |          | ||||||
|  |         #startButton:disabled { | ||||||
|  |             opacity: 0.5; | ||||||
|  |             cursor: not-allowed; | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         #stopButton svg { |         #stopButton svg { | ||||||
| @ -284,12 +287,14 @@ | |||||||
| 
 | 
 | ||||||
|             <!-- 控制按钮 - 悬浮在视频上方 --> |             <!-- 控制按钮 - 悬浮在视频上方 --> | ||||||
|             <div class="controls"> |             <div class="controls"> | ||||||
|                 <button id="startButton" class="btn btn-primary">开始音频通话</button> |                 <button id="startButton" class="btn btn-primary" title="开始通话"> | ||||||
|  |                     <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||||
|  |                         <path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z" fill="white"/> | ||||||
|  |                     </svg> | ||||||
|  |                 </button> | ||||||
|                 <button id="stopButton" class="btn btn-danger" disabled title="结束通话"> |                 <button id="stopButton" class="btn btn-danger" disabled title="结束通话"> | ||||||
|                     <svg viewBox="0 0 24 24"> |                     <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||||
|                         <path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"/> |                         <path d="M19.23 15.26l-2.54-.29c-.61-.07-1.21.14-1.64.57l-1.84 1.84c-2.83-1.44-5.15-3.75-6.59-6.59l1.85-1.85c.43-.43.64-1.03.57-1.64l-.29-2.52c-.12-1.01-.97-1.77-1.99-1.77H5.03c-1.13 0-2.07.94-2 2.07.53 8.54 7.36 15.36 15.89 15.89 1.13.07 2.07-.87 2.07-2v-1.73c.01-1.01-.75-1.86-1.76-1.98z" fill="white"/> | ||||||
|                         <path d="M19 12h2c0-4.97-4.03-9-9-9v2c3.87 0 7 3.13 7 7z"/> |  | ||||||
|                         <path d="M15 12h2c0-2.76-2.24-5-5-5v2c1.66 0 3 1.34 3 3z"/> |  | ||||||
|                         <line x1="18" y1="6" x2="6" y2="18" stroke="white" stroke-width="2"/> |                         <line x1="18" y1="6" x2="6" y2="18" stroke="white" stroke-width="2"/> | ||||||
|                     </svg> |                     </svg> | ||||||
|                 </button> |                 </button> | ||||||
|  | |||||||
							
								
								
									
										16
									
								
								src/index.js
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								src/index.js
									
									
									
									
									
								
							| @ -837,8 +837,16 @@ class WebRTCChat { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     stopCall() { |     stopCall() { | ||||||
|  |         // 停止音频处理器
 | ||||||
|  |         if (this.audioProcessor) { | ||||||
|  |             this.audioProcessor.stopRecording(); | ||||||
|  |         } | ||||||
|  |          | ||||||
|         if (this.localStream) { |         if (this.localStream) { | ||||||
|             this.localStream.getTracks().forEach(track => track.stop()); |             this.localStream.getTracks().forEach(track => { | ||||||
|  |                 track.stop(); | ||||||
|  |                 console.log(`停止轨道: ${track.kind}`); | ||||||
|  |             }); | ||||||
|             this.localStream = null; |             this.localStream = null; | ||||||
|         } |         } | ||||||
|          |          | ||||||
| @ -855,7 +863,6 @@ class WebRTCChat { | |||||||
|          |          | ||||||
|         this.recordedVideo.srcObject = null; |         this.recordedVideo.srcObject = null; | ||||||
|         this.currentVideo = null; |         this.currentVideo = null; | ||||||
|         this.currentVideoName.textContent = '未选择视频'; |  | ||||||
|          |          | ||||||
|         this.startButton.disabled = false; |         this.startButton.disabled = false; | ||||||
|         this.stopButton.disabled = true; |         this.stopButton.disabled = true; | ||||||
| @ -863,11 +870,8 @@ class WebRTCChat { | |||||||
|         // 隐藏结束通话按钮
 |         // 隐藏结束通话按钮
 | ||||||
|         this.stopButton.classList.remove('show'); |         this.stopButton.classList.remove('show'); | ||||||
|          |          | ||||||
|         this.stopVoiceRecording() |  | ||||||
|         this.updateAudioStatus('未连接', 'disconnected'); |         this.updateAudioStatus('未连接', 'disconnected'); | ||||||
|         this.logMessage('音频通话已结束', 'info'); |         this.logMessage('音频通话已结束,所有资源已释放', 'info'); | ||||||
| 
 |  | ||||||
|          |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     async createPeerConnection() { |     async createPeerConnection() { | ||||||
|  | |||||||
| @ -29,7 +29,7 @@ async function requestLLMStream({ apiKey, model, messages, onSegment }) { | |||||||
|   let pendingText = ''; // 待处理的文本片段
 |   let pendingText = ''; // 待处理的文本片段
 | ||||||
| 
 | 
 | ||||||
|   // 分段分隔符
 |   // 分段分隔符
 | ||||||
|   const segmentDelimiters = /[,。:;!?,.:;!?]/; |   const segmentDelimiters = /[,。:;!?,.:;!?]|\.{3,}/; | ||||||
| 
 | 
 | ||||||
|   while (!done) { |   while (!done) { | ||||||
|     const { value, done: doneReading } = await reader.read(); |     const { value, done: doneReading } = await reader.read(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Song367
						Song367