| 
					
				 | 
			
			
				@@ -7,6 +7,10 @@ import os 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import threading 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from typing import List, Dict, Optional 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from enum import Enum, auto 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import httpx 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import configs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from logging_service import logger 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import cozepy 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 from cozepy import Coze, TokenAuth, Message, ChatStatus, MessageType, JWTOAuthApp, JWTAuth 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -56,6 +60,13 @@ class OpenAICompatible: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         elif model_name in deepseek_models: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             llm_client = OpenAI(api_key=DEEPSEEK_API_TOKEN, base_url=DEEPSEEK_BASE_URL, **kwargs) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         elif model_name in openai_models: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            socks_conf = configs.get().get('system', {}).get('outside_proxy', {}).get('socks5', {}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if socks_conf: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                http_client = httpx.Client( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    timeout=httpx.Timeout(600, connect=5.0), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    proxy=f"socks5://{socks_conf['hostname']}:{socks_conf['port']}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                kwargs['http_client'] = http_client 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             llm_client = OpenAI(api_key=OPENAI_API_TOKEN, base_url=OPENAI_BASE_URL, **kwargs) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else: 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             raise Exception("Unsupported model: %s" % model_name) 
			 |