更新了新闻,刷新了产品的分析
This commit is contained in:
@@ -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数据库"""
|
||||
|
||||
Reference in New Issue
Block a user