"""
LangSmith Tracing 配置
提供 Callback 工厂函数，用于 LangGraph 追踪
"""

from langchain_core.tracers import LangChainTracer

from app.config import settings


def get_langsmith_callbacks() -> list:
    """
    根据配置返回 LangSmith Callback 列表
    未启用时返回空列表
    """
    if not settings.LANGSMITH_TRACING:
        return []

    if not settings.LANGSMITH_API_KEY:
        return []

    return [
        LangChainTracer(
            project_name=settings.LANGSMITH_PROJECT,
        )
    ]
