mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-14 00:20:06 +08:00
✨ feat(llm): 为 OpenAI 兼容请求体添加日志净化
This commit is contained in:
@@ -187,8 +187,12 @@ class LLMModel(LLMModelBase):
|
||||
logger.debug(f"🔑 API密钥: {masked_key}")
|
||||
logger.debug(f"📋 请求头: {dict(request_data.headers)}")
|
||||
|
||||
sanitizer_req_context_map = {"gemini": "gemini_request"}
|
||||
sanitizer_req_context = sanitizer_req_context_map.get(
|
||||
self.api_type, "openai_request"
|
||||
)
|
||||
sanitized_body = sanitize_for_logging(
|
||||
request_data.body, context="gemini_request"
|
||||
request_data.body, context=sanitizer_req_context
|
||||
)
|
||||
request_body_str = json.dumps(sanitized_body, ensure_ascii=False, indent=2)
|
||||
logger.debug(f"📦 请求体: {request_body_str}")
|
||||
|
||||
Reference in New Issue
Block a user