|
@@ -13,12 +13,14 @@ import com.tzld.longarticle.recommend.server.common.enums.StatusEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.aigc.PublishPlanInputSourceTypesEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.longArticle.ArticleVideoAuditStatusEnum;
|
|
|
import com.tzld.longarticle.recommend.server.common.enums.recommend.*;
|
|
|
+import com.tzld.longarticle.recommend.server.mapper.aigc.AigcBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.ArticleMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.crawler.CrawlerBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.mapper.longArticle.LongArticleBaseMapper;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.Content;
|
|
|
import com.tzld.longarticle.recommend.server.model.dto.ContentHisPublishArticle;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.CrawlerMetaArticle;
|
|
|
+import com.tzld.longarticle.recommend.server.model.entity.aigc.ProduceTaskAtom;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.aigc.PublishContent;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountAvgInfo;
|
|
|
import com.tzld.longarticle.recommend.server.model.entity.crawler.AccountCorrelation;
|
|
@@ -105,6 +107,8 @@ public class RecallService implements ApplicationContextAware {
|
|
|
LongArticlesTextRepository longArticlesTextRepository;
|
|
|
@Autowired
|
|
|
LongArticleTitleAuditRepository titleAuditRepository;
|
|
|
+ @Autowired
|
|
|
+ AigcBaseMapper aigcBaseMapper;
|
|
|
|
|
|
private final Map<String, RecallStrategy> strategyMap = new HashMap<>();
|
|
|
private ApplicationContext applicationContext;
|
|
@@ -346,6 +350,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
if (StringUtils.hasText(cache.getCategory())) {
|
|
|
content.setCategory(JSONArray.parseArray(cache.getCategory(), String.class));
|
|
|
}
|
|
|
+ content.setKimiSafeScore(cache.getKimiSafeScore());
|
|
|
content.setRootPublishTimestamp(cache.getRootPublishTimestamp());
|
|
|
content.setHisPublishArticleList(hisPublishArticleList);
|
|
|
setT0Data(content);
|
|
@@ -357,6 +362,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
if (CollectionUtils.isNotEmpty(articleWithHistory.getCategory())) {
|
|
|
content.setCategory(articleWithHistory.getCategory());
|
|
|
}
|
|
|
+ content.setKimiSafeScore(articleWithHistory.getKimiSafeScore());
|
|
|
content.setRootPublishTimestamp(articleWithHistory.getRootPublishTimestamp());
|
|
|
for (ContentHisPublishArticle article : content.getHisPublishArticleList()) {
|
|
|
article.setCorrelation(Optional.ofNullable(accountCorrelationMap.get(article.getGhId())).orElse(0.0));
|
|
@@ -414,6 +420,7 @@ public class RecallService implements ApplicationContextAware {
|
|
|
public Map<String, Content> getArticleWithHistory(List<TitleHisCacheParam> paramList, String type) {
|
|
|
Map<String, Content> result = new HashMap<>();
|
|
|
List<String> titleMd5List = paramList.stream().map(TitleHisCacheParam::getTitleMd5).collect(Collectors.toList());
|
|
|
+ List<String> sourceIds = paramList.stream().map(TitleHisCacheParam::getSourceId).collect(Collectors.toList());
|
|
|
// 获取历史已发布文章
|
|
|
List<Article> hisArticleList = new ArrayList<>();
|
|
|
List<List<String>> titleMd5Partition = Lists.partition(new ArrayList<>(titleMd5List), 1000);
|
|
@@ -481,6 +488,10 @@ public class RecallService implements ApplicationContextAware {
|
|
|
.collect(Collectors.toMap(ArticleCategory::getChannelContentId, Function.identity(), (a, b) -> a));
|
|
|
Map<String, ArticleCategory> titleCategoryMap = articleCategoryList.stream()
|
|
|
.collect(Collectors.toMap(ArticleCategory::getTitleMd5, Function.identity(), (a, b) -> a));
|
|
|
+ // 根据sourceId查询kimiSafeScore
|
|
|
+ List<ProduceTaskAtom> safeScoreList = aigcBaseMapper.getProduceScoreByContentId(sourceIds);
|
|
|
+ Map<String, String> safeScoreMap = safeScoreList.stream()
|
|
|
+ .collect(Collectors.toMap(ProduceTaskAtom::getPlanExeId, ProduceTaskAtom::getOutput));
|
|
|
|
|
|
for (TitleHisCacheParam cacheParam : paramList) {
|
|
|
Content res = new Content();
|
|
@@ -495,6 +506,14 @@ public class RecallService implements ApplicationContextAware {
|
|
|
if (Objects.nonNull(category)) {
|
|
|
res.setCategory(Collections.singletonList(category.getCategory()));
|
|
|
}
|
|
|
+ // 设置kimiSafeScore
|
|
|
+ String safeScore = safeScoreMap.get(cacheParam.getSourceId());
|
|
|
+ if (StringUtils.hasText(safeScore)) {
|
|
|
+ safeScore = safeScore.replaceAll("\n","");
|
|
|
+ if (safeScore.length() == 1) {
|
|
|
+ res.setKimiSafeScore(safeScore);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 溯源查找源发布时间
|
|
|
ArticlePoolPromotionSource source = sourceMap.get(cacheParam.getCrawlerChannelContentId());
|
|
|
if (Objects.nonNull(source) && Objects.nonNull(source.getRootProduceContentId())) {
|