Update api/utils.py
Browse files17 unmodified lines181920212223242583 unmodified lines10911011111211311411511611766 unmodified lines18418518618718818919017 unmodified linesBASE_URL,AGENT_MODE,TRENDING_AGENT_MODE,MODEL_PREFIXES,MODEL_REFERERS)from api.models import ChatRequestfrom api.logger import setup_logger83 unmodified linesreturn content[len(model_prefix):].strip()return content# Process streaming response with headers from config.pyasync def process_streaming_response(request: ChatRequest, request_obj: Request):referer_url = get_referer_url(request.model)logger.info(f"Processing streaming response - Model: {request.model} - URL: {referer_url}")# Get the IP address and check rate limit66 unmodified lines# Process non-streaming response with headers from config.pyasync def process_non_streaming_response(request: ChatRequest, request_obj: Request):referer_url = get_referer_url(request.model)logger.info(f"Processing non-streaming response - Model: {request.model} - URL: {referer_url}")# Get the IP address and check rate limit17 unmodified lines1819202122232483 unmodified lines10810911011111211311411511611711811912012166 unmodified lines18818919019119219319417 unmodified linesBASE_URL,AGENT_MODE,TRENDING_AGENT_MODE,MODEL_PREFIXES)from api.models import ChatRequestfrom api.logger import setup_logger83 unmodified linesreturn content[len(model_prefix):].strip()return content# Simplified function to get the base referer URLdef get_referer_url() -> str:"""Return the base URL for the referer without model-specific logic."""return BASE_URL# Process streaming response with headers from config.pyasync def process_streaming_response(request: ChatRequest, request_obj: Request):referer_url = get_referer_url() # Get the base URL without model-specific logiclogger.info(f"Processing streaming response - Model: {request.model} - URL: {referer_url}")# Get the IP address and check rate limit66 unmodified lines# Process non-streaming response with headers from config.pyasync def process_non_streaming_response(request: ChatRequest, request_obj: Request):referer_url = get_referer_url() # Get the base URL without model-specific logiclogger.info(f"Processing non-streaming response - Model: {request.model} - URL: {referer_url}")# Get the IP address and check rate limit
api/utils.py+8-4