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