添加触发切换条件
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m57s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3m57s
				
			This commit is contained in:
		
							parent
							
								
									a43429789c
								
							
						
					
					
						commit
						ea3841a690
					
				| @ -60,13 +60,13 @@ function updateHistoryMessage(userInput, assistantResponse) { | ||||
|     ); | ||||
|      | ||||
|     // 可选:限制历史消息数量,保持最近的对话
 | ||||
|     const maxMessages = 20; // 保留最近10轮对话(20条消息)
 | ||||
|     if (historyMessage.length > maxMessages) { | ||||
|         // 保留系统消息和最近的对话
 | ||||
|         const systemMessages = historyMessage.filter(msg => msg.role === 'system'); | ||||
|         const recentMessages = historyMessage.slice(-maxMessages + systemMessages.length); | ||||
|         historyMessage = [...systemMessages, ...recentMessages.filter(msg => msg.role !== 'system')]; | ||||
|     } | ||||
|     // const maxMessages = 20; // 保留最近10轮对话(20条消息)
 | ||||
|     // if (historyMessage.length > maxMessages) {
 | ||||
|     //     // 保留系统消息和最近的对话
 | ||||
|     //     const systemMessages = historyMessage.filter(msg => msg.role === 'system');
 | ||||
|     //     const recentMessages = historyMessage.slice(-maxMessages + systemMessages.length);
 | ||||
|     //     historyMessage = [...systemMessages, ...recentMessages.filter(msg => msg.role !== 'system')];
 | ||||
|     // }
 | ||||
| } | ||||
| 
 | ||||
| // 保存消息到服务端
 | ||||
|  | ||||
| @ -88,13 +88,16 @@ async function processAudioQueue() { | ||||
|   isProcessingQueue = false; | ||||
|    | ||||
|   // 等待当前音频播放完成后再切换回默认视频
 | ||||
|   while (isPlaying) { | ||||
|     await new Promise(resolve => setTimeout(resolve, 100)); | ||||
|   } | ||||
|   // while (isPlaying) {
 | ||||
|   //   console.log("触发音频等待")
 | ||||
|   //   await new Promise(resolve => setTimeout(resolve, 1000));
 | ||||
|   // }
 | ||||
|   // console.log("触发音频等待")
 | ||||
|   // await new Promise(resolve => setTimeout(resolve, 300));
 | ||||
|    | ||||
|   const text = 'default' | ||||
|   console.log("音频结束------------------------:", window.webrtcApp.currentVideoTag, isPlaying) | ||||
|   if (window.webrtcApp.currentVideoTag != text) { | ||||
| 	  console.log("音频结束------------------------:", window.webrtcApp.currentVideoTag, isPlaying) | ||||
|   if (window.webrtcApp.currentVideoTag != text && !isPlaying) { | ||||
|     isFirstChunk = true | ||||
|     window.webrtcApp.currentVideoTag = text | ||||
|     window.webrtcApp.switchVideoStream(window.webrtcApp.defaultVideo, 'audio', text); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user