Spaces:
Paused
Paused
File size: 984 Bytes
54f0f2c 4caa52c 54f0f2c 4caa52c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import json
import os
from datetime import datetime
from pathlib import Path
import uuid
from typing import Literal, Dict
import logging
from .provider_urls import get_provider_endpoint
def log_request_to_console(url: str, headers: dict, client_info: tuple, request_data: dict):
"""
Logs a concise, single-line summary of an incoming request to the console.
"""
time_str = datetime.now().strftime("%H:%M")
model_full = request_data.get("model", "N/A")
provider = "N/A"
model_name = model_full
endpoint_url = "N/A"
if '/' in model_full:
parts = model_full.split('/', 1)
provider = parts[0]
model_name = parts[1]
# Use the helper function to get the full endpoint URL
endpoint_url = get_provider_endpoint(provider, model_name, url) or "N/A"
log_message = f"{time_str} - {client_info[0]}:{client_info[1]} - provider: {provider}, model: {model_name} - {endpoint_url}"
logging.info(log_message)
|