优化日志

This commit is contained in:
h88782481 2026-03-14 10:35:32 +08:00
parent 4de6db13f9
commit 3c4a50dc05
10 changed files with 233 additions and 36 deletions

View file

@ -22,6 +22,7 @@ _cache = None
_DEFAULTS = {
'proxy_target_url': '',
'proxy_api_key': '',
'debug_mode': '',
'model_mappings': {},
}
@ -77,6 +78,12 @@ def get_key():
return get().get('proxy_api_key') or Config.PROXY_API_KEY
def get_debug_mode():
"""获取当前生效的调试模式,优先使用持久化配置。"""
mode = (get().get('debug_mode') or '').strip().lower()
return mode if mode in ('off', 'simple', 'verbose') else Config.DEBUG_MODE
def resolve_model(model_name):
"""解析模型映射并返回完整的上游路由信息。"""
settings = get()