From 69ce287cb56e5ebfb1ef9ccca18e1d962b1976f6 Mon Sep 17 00:00:00 2001 From: Annyfee <2287551746@qq.com> Date: Sat, 3 Jan 2026 16:15:33 +0800 Subject: [PATCH] chore(config): remove TensorFlow deprecation warning --- config.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index a758e27..43aea5f 100644 --- a/config.py +++ b/config.py @@ -12,7 +12,22 @@ try: except ImportError: pass # 如果没装 langsmith,省略 -# 3. 获取API_KEYS + +# 3. 解决TensorFlow & Numpy 兼容性告警 +def silence_framework_warnings(): + import os + import warnings + import logging + os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' + warnings.filterwarnings('ignore') + logging.getLogger('tensorflow').setLevel(logging.ERROR) + +silence_framework_warnings() + + + + +# 4. 获取API_KEYS OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") LANGCHAIN_API_KEY = os.getenv("LANGCHAIN_API_KEY") AMAP_MAPS_API_KEY = os.getenv("AMAP_MAPS_API_KEY")