🐛 文章内容过少调用百度摘要 api 失败问题修复
This commit is contained in:
parent
eacb753e55
commit
1aa4797ef7
@ -187,10 +187,15 @@ public class ArticleServiceImpl extends AbstractService<Article> implements Arti
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(articleContentHtml)) {
|
||||
String previewContent = BaiDuAipUtils.getNewsSummary(newArticle.getArticleTitle(), articleContentHtml, MAX_PREVIEW);
|
||||
String previewContent;
|
||||
if (articleContentHtml.length() > MAX_PREVIEW) {
|
||||
previewContent = BaiDuAipUtils.getNewsSummary(newArticle.getArticleTitle(), articleContentHtml, MAX_PREVIEW);
|
||||
if (previewContent.length() > MAX_PREVIEW) {
|
||||
previewContent = previewContent.substring(0, MAX_PREVIEW);
|
||||
}
|
||||
} else {
|
||||
previewContent = Html2TextUtil.getContent(articleContentHtml);
|
||||
}
|
||||
newArticle.setArticlePreviewContent(previewContent);
|
||||
}
|
||||
articleMapper.updateByPrimaryKeySelective(newArticle);
|
||||
|
Loading…
Reference in New Issue
Block a user