修复了一个分发提取过程中的问题

This commit is contained in:
jinye_huang 2025-05-15 16:06:41 +08:00
parent 90397ee4db
commit 26086e2a1d
2 changed files with 7 additions and 7 deletions

View File

@ -450,9 +450,9 @@ def send_emails(distribution_csv, output_dir, email_from, email_password,
try: try:
with open(file_path, 'r', encoding='utf-8') as f: with open(file_path, 'r', encoding='utf-8') as f:
article_content = f.read() article_content = f.read()
product_name = row.get('product', '') # product_name = row.get('product', '')
object_name = row.get('object', '') # object_name = row.get('object', '')
article_contents.append(f"{product_name} - {object_name}\n\n{article_content}\n\n{'='*50}\n\n") article_contents.append(f"\n\n{article_content}\n\n{'='*50}\n\n")
except Exception as e: except Exception as e:
logger.warning(f"读取文章内容失败: {file_path}, 错误: {e}") logger.warning(f"读取文章内容失败: {file_path}, 错误: {e}")

View File

@ -25,7 +25,7 @@ def init_database(db_path):
"""初始化数据库,创建表结构""" """初始化数据库,创建表结构"""
try: try:
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
conn.execute("PRAGMA foreign_keys = ON") conn.execute("PRAGMA foreign_keys = OFF") # 禁用外键约束
cursor = conn.cursor() cursor = conn.cursor()
# 创建内容表 # 创建内容表
@ -80,7 +80,7 @@ def record_to_database(
else: else:
try: try:
conn = sqlite3.connect(db_path) conn = sqlite3.connect(db_path)
conn.execute("PRAGMA foreign_keys = ON") conn.execute("PRAGMA foreign_keys = OFF") # 禁用外键约束
except sqlite3.Error as e: except sqlite3.Error as e:
logger.error(f"连接数据库失败: {e}") logger.error(f"连接数据库失败: {e}")
return False return False
@ -535,8 +535,8 @@ def main():
args = parser.parse_args() args = parser.parse_args()
# 默认值设置 # 默认值设置
source = args.source if args.source else "/root/autodl-tmp/TravelContentCreator/result/2025-05-12_21-36-33" source = args.source if args.source else "/root/autodl-tmp/TravelContentCreator/result/2025-05-14_22-10-37"
output = args.output if args.output else "/root/autodl-tmp/TravelContentCreator/output/2025-05-12_21-36-33" output = args.output if args.output else "/root/autodl-tmp/TravelContentCreator/output/2025-05-14_22-10-37"
run_id = args.run_id if args.run_id else os.path.basename(source) run_id = args.run_id if args.run_id else os.path.basename(source)
prefer_original = args.prefer_original prefer_original = args.prefer_original
db_path = args.db_path if args.db_path else '/root/autodl-tmp/TravelContentCreator/distribution.db' db_path = args.db_path if args.db_path else '/root/autodl-tmp/TravelContentCreator/distribution.db'