更新了新闻,刷新了产品的分析

This commit is contained in:
2025-11-27 20:29:25 +08:00
parent 4c2ee60431
commit 8cbd6462d3
13 changed files with 13941 additions and 4478 deletions

View File

@@ -30,11 +30,17 @@ class ProductAIAnalyzer:
self.db_path = db_path
self.api_url = "https://open.bigmodel.cn/api/paas/v4/chat/completions"
# 检查数据库文件是否存在
# 检查数据库文件是否存在,支持相对路径和绝对路径
if not os.path.exists(db_path):
raise FileNotFoundError(f"数据库文件不存在: {db_path}")
# 尝试在当前目录下查找
current_dir_db = os.path.join(os.path.dirname(__file__), db_path)
if os.path.exists(current_dir_db):
self.db_path = current_dir_db
logger.info(f"使用当前目录下的数据库文件: {current_dir_db}")
else:
raise FileNotFoundError(f"数据库文件不存在: {db_path}{current_dir_db}")
logger.info(f"初始化产品AI分析器数据库: {db_path}")
logger.info(f"初始化产品AI分析器数据库: {self.db_path}")
def connect_to_database(self) -> sqlite3.Connection:
"""连接到SQLite数据库"""