diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/ai/RepositoryLocaleAIPromptRepository.java b/webapp/src/main/java/com/box/l10n/mojito/service/ai/RepositoryLocaleAIPromptRepository.java index 95cf07f9af..faca76c8e5 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/ai/RepositoryLocaleAIPromptRepository.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/ai/RepositoryLocaleAIPromptRepository.java @@ -9,10 +9,6 @@ public interface RepositoryLocaleAIPromptRepository extends JpaRepository { - @Query( - "SELECT rlap.repository.id FROM RepositoryLocaleAIPrompt rlap WHERE rlap.aiPrompt.id = :aiPromptId") - List findRepositoryIdsByAiPromptId(@Param("aiPromptId") Long aiPromptId); - @Query( "SELECT count(rlap.id) FROM RepositoryLocaleAIPrompt rlap " + "JOIN AIPrompt aip ON rlap.aiPrompt.id = aip.id " @@ -24,7 +20,7 @@ public interface RepositoryLocaleAIPromptRepository "SELECT rlap FROM RepositoryLocaleAIPrompt rlap " + "JOIN rlap.aiPrompt aip " + "JOIN aip.promptType aipt " - + "WHERE rlap.repository.id = :repositoryId AND aip.deleted = false AND aipt.name = 'TRANSLATION'") + + "WHERE rlap.repository.id = :repositoryId AND rlap.disabled = false AND aip.deleted = false AND aipt.name = 'TRANSLATION'") List getActiveTranslationPromptsByRepository( @Param("repositoryId") Long repositoryId); } diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationJobScheduler.java b/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationJobScheduler.java index e7e19a10eb..8ac79fabf1 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationJobScheduler.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationJobScheduler.java @@ -7,6 +7,8 @@ import com.box.l10n.mojito.quartz.QuartzJobInfo; import com.box.l10n.mojito.quartz.QuartzPollableTaskScheduler; import com.box.l10n.mojito.service.ai.RepositoryLocaleAIPromptRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -16,6 +18,8 @@ @ConditionalOnProperty(value = "l10n.ai.translation.enabled", havingValue = "true") public class AITranslationJobScheduler { + private static Logger logger = LoggerFactory.getLogger(AITranslationJobScheduler.class); + @Autowired RepositoryLocaleAIPromptRepository repositoryLocaleAIPromptRepository; @Autowired TmTextUnitPendingMTRepository tmTextUnitPendingMTRepository; @@ -29,6 +33,7 @@ public void scheduleAITranslationJob(AITranslateJobInput input) { if (repositoryLocaleAIPromptRepository.findCountOfActiveRepositoryTranslationPrompts( input.getRepositoryId()) > 0) { + logger.debug("Scheduling AI translation for tmTextUnitId: {}", input.getTmTextUnitId()); persistToPendingMTTable(input); scheduleQuartzJob(input); } diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationTextUnitFilterService.java b/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationTextUnitFilterService.java index f836cbc29a..1eb1c201ea 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationTextUnitFilterService.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/ai/translation/AITranslationTextUnitFilterService.java @@ -58,7 +58,7 @@ public boolean isTranslatable(TMTextUnit tmTextUnit, Repository repository) { } logger.debug( - "Text unit with name: {} should be translated: {}", tmTextUnit.getName(), isTranslatable); + "Text unit with name: {}, should be translated: {}", tmTextUnit.getName(), isTranslatable); return isTranslatable; } diff --git a/webapp/src/main/java/com/box/l10n/mojito/service/assetExtraction/AssetExtractionService.java b/webapp/src/main/java/com/box/l10n/mojito/service/assetExtraction/AssetExtractionService.java index 783b629666..ca7e967565 100644 --- a/webapp/src/main/java/com/box/l10n/mojito/service/assetExtraction/AssetExtractionService.java +++ b/webapp/src/main/java/com/box/l10n/mojito/service/assetExtraction/AssetExtractionService.java @@ -279,6 +279,9 @@ void updatePushRun( @Async void scheduleAITranslation(Long repositoryId, CreateTextUnitsResult createTextUnitsResult) { for (BranchStateTextUnit branchStateTextUnit : createTextUnitsResult.getCreatedTextUnits()) { + logger.debug( + "Sending tmTextUnitId: {} information to AI Translation scheduler", + branchStateTextUnit.getTmTextUnitId()); AITranslateJobInput aiTranslateJobInput = new AITranslateJobInput(); aiTranslateJobInput.setRepositoryId(repositoryId); aiTranslateJobInput.setTmTextUnitId(branchStateTextUnit.getTmTextUnitId());