移除 AI logger 未用 stack 推斷
Some checks failed
CD Pipeline / deploy (push) Has been cancelled

This commit is contained in:
OoO
2026-05-13 11:54:16 +08:00
parent 49c576bc4f
commit 1aeb4a4b8e
2 changed files with 1 additions and 17 deletions

View File

@@ -24,7 +24,6 @@ services/ai_call_logger.py
from __future__ import annotations
import hashlib
import inspect
import logging
import os
import threading
@@ -438,18 +437,3 @@ def _safe_meta_json(meta: Dict[str, Any]) -> str:
except Exception as e:
logger.warning("[AICallLogger] meta json dump failed: %s", e)
return '{}'
# ─────────────────────────────────────────────────────────────────────────────
# 工具caller 自動推斷caller 沒給時用)
# ─────────────────────────────────────────────────────────────────────────────
def infer_caller_from_stack(default: str = 'unknown') -> str:
"""從 inspect.stack() 推斷 caller取上 1 層的 module 名末段)。"""
try:
frame = inspect.stack()[2]
module = inspect.getmodule(frame.frame)
if module and module.__name__:
return module.__name__.split('.')[-1][:64]
except Exception:
logger.debug("[AICallLogger] infer caller from stack failed", exc_info=True)
return default