| 
					
				 | 
			
			
				@@ -48,15 +48,16 @@ export class ChatPage implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       this.username = '未登录'; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log("tab-ai:"+this.username); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log("tab-ai:" + this.username); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   async loadChatHistory(chatId: number | null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (!chatId) return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    if (!chatId || this.username === '未登录') return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const Chat = Parse.Object.extend('ai_chat'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const query = new Parse.Query(Chat); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     query.equalTo('chatId', chatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    query.equalTo('username', this.username); // 添加用户名条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     query.ascending('userChatOrder'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     try { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -123,6 +124,7 @@ export class ChatPage implements OnInit { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const Chat = Parse.Object.extend('ai_chat'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     const query = new Parse.Query(Chat); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     query.equalTo('chatId', chatId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    query.equalTo('username', this.username); // 添加用户名条件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     query.descending('userChatOrder'); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     query.limit(1); // 限制为1条结果以获取最后一条消息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |