更新最新代码
This commit is contained in:
@@ -1,4 +1,24 @@
|
||||
# src/config.py
|
||||
|
||||
import yaml
|
||||
import os
|
||||
import logging
|
||||
from datetime import datetime
|
||||
|
||||
current_file = os.path.splitext(os.path.basename(__file__))[0]
|
||||
now_str = datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
log_filename = f"{current_file}_{now_str}.log"
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG,
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||
handlers=[
|
||||
logging.FileHandler(os.path.join("logs", log_filename), encoding="utf-8"),
|
||||
logging.StreamHandler()
|
||||
],
|
||||
)
|
||||
|
||||
logger = logging.getLogger(current_file)
|
||||
|
||||
class Config:
|
||||
def __init__(self, path="config.yaml"):
|
||||
@@ -35,3 +55,7 @@ class Config:
|
||||
@property
|
||||
def langsmith(self):
|
||||
return self._config.get("langsmith", {})
|
||||
|
||||
@property
|
||||
def max_retries(self):
|
||||
return self._config.get("max_retries", 3)
|
||||
|
||||
Reference in New Issue
Block a user