diff --git a/services/task_service.py b/services/task_service.py index 0689f57..b3da287 100644 --- a/services/task_service.py +++ b/services/task_service.py @@ -102,15 +102,18 @@ class BackgroundTaskService: # 检查URL是否已存在 existing = db.search_articles(url) if not any(a.get('url') == url for a in existing): + # 获取抓取到的网页标题 + page_title = fetch_result.get('title', '') or title + article_id = db.add_article( - product_names=[title], + product_names=[], # 产品名称留空,后续手动关联 category=category or '', keywords=keywords or [], summary=content[:200], content=content, source=url, url=url, - search_title=title + search_title=title # 搜索结果的标题 ) if article_id: saved_count += 1 diff --git a/static/css/library.css b/static/css/library.css index 1c98faf..e68d447 100644 --- a/static/css/library.css +++ b/static/css/library.css @@ -250,7 +250,7 @@ color: #667eea; } -.article-page-title { +.article-products { font-size: 13px; color: #666; margin-bottom: 10px; @@ -259,7 +259,7 @@ border-radius: 4px; } -.article-page-title i { +.article-products i { color: #4caf50; } diff --git a/static/js/library.js b/static/js/library.js index bd62171..888a1ee 100644 --- a/static/js/library.js +++ b/static/js/library.js @@ -110,7 +110,7 @@ function displayArticles() { const productNames = safeParseJSON(article.product_names, []); const keywords = safeParseJSON(article.keywords, []); - // 确定显示标题:优先 search_title,其次 product_names,最后来源 + // 确定显示标题:优先 search_title(搜索标题),其次 product_names(产品名称),最后来源 const displayTitle = article.search_title || productNames.join(', ') || article.source || '未命名'; return ` @@ -133,9 +133,9 @@ function displayArticles() { - ${article.search_title && productNames.length > 0 && article.search_title !== productNames.join(', ') ? ` -