init agent project

This commit is contained in:
Nelson
2026-04-06 17:51:06 +08:00
parent 8daeef22e7
commit 7b7a2af4c6
11 changed files with 582 additions and 2 deletions

35
common/__init__.py Normal file
View File

@@ -0,0 +1,35 @@
"""
公共模块
提供所有 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"]