修复搜索抓取相关问题

1. 放宽搜索结果过滤条件,返回更多结果
2. 抓取返回详细错误信息(如超时、网络错误等)
3. 错误信息记录到失败URL库中
4. 统一返回格式包含success字段
This commit is contained in:
2026-07-13 23:40:13 +08:00
parent b0d98b78d9
commit 24f0d3c35b
2 changed files with 17 additions and 8 deletions
+3 -2
View File
@@ -114,7 +114,7 @@ def fetch_article():
result = search_service.fetch_url_content(url)
if result:
if result and result.get('success'):
# 自动保存到内容库
article_id = search_service.save_to_articles(
product_names=data.get('product_names', [result['title']]),
@@ -132,7 +132,8 @@ def fetch_article():
'data': result
})
else:
return jsonify({'error': '抓取失败'}), 500
error_msg = result.get('error', '抓取失败') if result else '抓取失败'
return jsonify({'success': False, 'error': error_msg}), 500
@bp.route('/internet-search', methods=['POST'])
def internet_search():