patch chat
This commit is contained in:
		
							parent
							
								
									54e4d3542e
								
							
						
					
					
						commit
						6f8bc0e762
					
				
							
								
								
									
										17
									
								
								app/core/http_client.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								app/core/http_client.py
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					import ssl
 | 
				
			||||||
 | 
					import httpx
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ssl_transport = httpx.AsyncHTTPTransport(http2=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Ограничения пула соединений
 | 
				
			||||||
 | 
					limits = httpx.Limits(max_connections=200, max_keepalive_connections=50)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Таймауты
 | 
				
			||||||
 | 
					timeout = httpx.Timeout(connect=5.0, read=10.0, write=5.0, pool=5.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Глобальный клиент
 | 
				
			||||||
 | 
					client = httpx.AsyncClient(
 | 
				
			||||||
 | 
					    transport=ssl_transport,
 | 
				
			||||||
 | 
					    limits=limits,
 | 
				
			||||||
 | 
					    timeout=timeout,
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
@ -32,7 +32,8 @@ async def get_private_chats(token: str, offset: int = 0, limit: int = 20):
 | 
				
			|||||||
                if data.get("status") == "fine":
 | 
					                if data.get("status") == "fine":
 | 
				
			||||||
                    # Используем Pydantic модель для парсинга ответа
 | 
					                    # Используем Pydantic модель для парсинга ответа
 | 
				
			||||||
                    response_model = PrivateChatListResponse(**data)
 | 
					                    response_model = PrivateChatListResponse(**data)
 | 
				
			||||||
                    print("response_model.data", response_model.data)
 | 
					                    # print("response_model.data", response_model.data)
 | 
				
			||||||
 | 
					                    print("data", data)
 | 
				
			||||||
                    return True, response_model.data
 | 
					                    return True, response_model.data
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    return False, data.get("detail", localizer.translate("Неизвестная ошибка ответа"))
 | 
					                    return False, data.get("detail", localizer.translate("Неизвестная ошибка ответа"))
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								main.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								main.py
									
									
									
									
									
								
							@ -13,7 +13,7 @@ class MainWindow(QMainWindow):
 | 
				
			|||||||
        super().__init__()
 | 
					        super().__init__()
 | 
				
			||||||
        self.setWindowTitle(config.APP_HEADER)
 | 
					        self.setWindowTitle(config.APP_HEADER)
 | 
				
			||||||
        self.setMinimumSize(400, 650)
 | 
					        self.setMinimumSize(400, 650)
 | 
				
			||||||
        
 | 
					
 | 
				
			||||||
        self.controller = MainController()
 | 
					        self.controller = MainController()
 | 
				
			||||||
        self.setCentralWidget(self.controller)
 | 
					        self.setCentralWidget(self.controller)
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user