Redact AI Buddy request parameters in operation logs (#1269)

This commit is contained in:
Wu Clan
2026-10-10 16:33:52 +08:00
committed by GitHub
parent f2bcd488ad
commit a0964d951e
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -244,6 +244,7 @@ class Settings(BaseSettings):
'old_password',
'new_password',
'confirm_password',
'secret',
]
OPERA_LOG_QUEUE_MAXSIZE: int = 100000
OPERA_LOG_QUEUE_BATCH_CONSUME_SIZE: int = 100
@@ -133,6 +133,12 @@ class OperaLogMiddleware(BaseHTTPMiddleware):
:return:
"""
args = {}
# 用于 ai-buddy 插件,避免交互输入、聊天和图像生成请求中的敏感内容写入操作日志
if '/input-requests/' in request.url.path or request.url.path.endswith((
'/chat/completions',
'/images/generations',
)):
return {'body': '[REDACTED]'}
# 查询参数
query_params = dict(request.query_params)