Files
Agents/common/__init__.py
2026-04-06 17:51:06 +08:00

36 lines
874 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
公共模块
提供所有 Agent 共用的基础配置和工具:
- 环境变量加载(.env
- 日志配置
- 模型调用日志回调
"""
import os
import logging
from pathlib import Path
# ============================================================
# 项目根目录 & 环境初始化
# ============================================================
_PROJECT_ROOT = Path(__file__).parent.parent
# 加载 .env 文件
from dotenv import load_dotenv
load_dotenv(_PROJECT_ROOT / ".env")
# ============================================================
# 日志配置
# ============================================================
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(name)s] %(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
from .logger import get_model_callbacks # noqa: E402
__all__ = ["get_model_callbacks"]