新增搜索标题和网页标题双字段
- 数据库新增 search_title 字段存储搜索结果标题 - product_names 存储抓取到的网页标题 - 搜索页面显示两个标题(搜索标题 + 网页标题) - 内容库页面也显示两个标题
This commit is contained in:
+4
-1
@@ -108,6 +108,7 @@ def fetch_article():
|
||||
"""从URL抓取文章"""
|
||||
data = request.get_json()
|
||||
url = data.get('url')
|
||||
search_title = data.get('search_title') # 搜索结果的标题
|
||||
|
||||
if not url:
|
||||
return jsonify({'error': '请提供URL'}), 400
|
||||
@@ -116,6 +117,7 @@ def fetch_article():
|
||||
|
||||
if result and result.get('success'):
|
||||
# 自动保存到内容库
|
||||
# product_names 使用抓取到的标题,search_title 使用搜索结果的标题
|
||||
article_id = search_service.save_to_articles(
|
||||
product_names=data.get('product_names', [result['title']]),
|
||||
category=data.get('category'),
|
||||
@@ -123,7 +125,8 @@ def fetch_article():
|
||||
summary=result.get('description', ''),
|
||||
content=result['content'],
|
||||
source=url,
|
||||
url=url
|
||||
url=url,
|
||||
search_title=search_title
|
||||
)
|
||||
|
||||
return jsonify({
|
||||
|
||||
Reference in New Issue
Block a user