Просмотр исходного кода

向量匹配视频 实验账号配置

wangyunpeng 5 дней назад
Родитель
Сommit
d553e3b7d0

+ 21 - 2
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -113,6 +113,9 @@ public class CoreServiceImpl implements CoreService {
     @Value("${recall.video.config.code:VIDEO_TOPIC}")
     @Value("${recall.video.config.code:VIDEO_TOPIC}")
     private String recallVideoConfigCode;
     private String recallVideoConfigCode;
 
 
+    @ApolloJsonValue("${recall.publish.miniprogram.accounts:[]}")
+    private List<String> recallPublishMiniprogramAccounts;
+
 
 
     public void initAccountSpecialSettings() {
     public void initAccountSpecialSettings() {
         List<SpecialSettingVO> specialSettings = aigcService.getSpecialSetting();
         List<SpecialSettingVO> specialSettings = aigcService.getSpecialSetting();
@@ -855,8 +858,10 @@ public class CoreServiceImpl implements CoreService {
         List<PublishMiniprogram> publishMiniprogramList = publicContentService.getPublishMiniprograms(publishContent);
         List<PublishMiniprogram> publishMiniprogramList = publicContentService.getPublishMiniprograms(publishContent);
         //不存在则重新生成
         //不存在则重新生成
         if (CollectionUtils.isEmpty(publishMiniprogramList)) {
         if (CollectionUtils.isEmpty(publishMiniprogramList)) {
-            // 优先尝试 recallWithScore 召回的视频
-            publishMiniprogramList = getRecallPublishMiniprograms(publishContent, planAccount);
+            // 优先尝试 recallWithScore 召回的视频(仅配置的账号或配置为ALL时生效)
+            if (isRecallPublishMiniprogramAccount(planAccount.getAccountName())) {
+                publishMiniprogramList = getRecallPublishMiniprograms(publishContent, planAccount);
+            }
             if (CollectionUtils.isEmpty(publishMiniprogramList)) {
             if (CollectionUtils.isEmpty(publishMiniprogramList)) {
                 // 回退到现有流程
                 // 回退到现有流程
                 if (Objects.equals(publishContent.getSourceType(), SourceTypesEnum.longArticleVideoPoolSource.getVal())) {
                 if (Objects.equals(publishContent.getSourceType(), SourceTypesEnum.longArticleVideoPoolSource.getVal())) {
@@ -892,6 +897,20 @@ public class CoreServiceImpl implements CoreService {
         return getPublishCardList(publishMiniprogramList);
         return getPublishCardList(publishMiniprogramList);
     }
     }
 
 
+    /**
+     * 判断当前账号是否走 recallWithScore 召回小程序发布流程
+     * 配置列表为空时关闭,包含 "ALL" 时所有账号生效,否则仅列表中的账号生效
+     */
+    private boolean isRecallPublishMiniprogramAccount(String accountName) {
+        if (CollectionUtils.isEmpty(recallPublishMiniprogramAccounts)) {
+            return false;
+        }
+        if (recallPublishMiniprogramAccounts.contains("ALL")) {
+            return true;
+        }
+        return recallPublishMiniprogramAccounts.contains(accountName);
+    }
+
     /**
     /**
      * 优先从 recallWithScore 召回结果中获取小程序视频,发布后生成小程序卡片
      * 优先从 recallWithScore 召回结果中获取小程序视频,发布后生成小程序卡片
      * 返回空列表时表示无召回结果,调用方应回退到现有流程
      * 返回空列表时表示无召回结果,调用方应回退到现有流程