filter exec list

This commit is contained in:
Florinda
2024-11-19 10:19:58 +01:00
parent b778c82f97
commit ea5162f61f
3 changed files with 13 additions and 7 deletions

View File

@@ -2,6 +2,7 @@ package com.olympus.hermione.repository;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
@@ -21,10 +22,11 @@ public interface ScenarioExecutionRepository extends MongoRepository<ScenarioExe
List<ScenarioExecution> findByExecutedByUserIdAndInputs(String userId, String selectedProject, String selectedApplication);
@Query("{ $and: [ { 'executedByUserId': ?0 }, { 'scenarioExecutionInput.inputs.selected_project': ?1 }, { 'scenarioExecutionInput.inputs.selected_application': ?2 } ] }")
List<ScenarioExecution> findByExecutedByUserIdAndInputsOrderByStartDateDesc(String userId, String value1, String value2);
List<ScenarioExecution> getFromProjectAndAPP(String userId, String value1, String value2, Sort sort);
//findByExecutedByUserIdAndInputsOrderByStartDateDesc
@Query("{ $and: [ { 'executedByUserId': ?0 }, { 'scenarioExecutionInput.inputs.selected_project': ?1 }")
List<ScenarioExecution> findByExecutedByUserIdAndSingleInputOrderByStartDateDesc(String userId, String value1);
@Query("{ $and: [ { 'executedByUserId': ?0 }, { 'scenarioExecutionInput.inputs.selected_project': ?1 } ] }")
List<ScenarioExecution> getFromProject(String userId, String value1, Sort sort);

View File

@@ -19,6 +19,7 @@ import org.springframework.ai.openai.api.OpenAiApi;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.data.domain.Sort;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
@@ -348,10 +349,10 @@ public class ScenarioExecutionService {
User principal = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
if(principal.getSelectedApplication()!=null){
lstScenarioExecution = scenarioExecutionRepository.findByExecutedByUserIdAndInputsOrderByStartDateDesc(principal.getId(), principal.getSelectedProject().getInternal_name(), principal.getSelectedApplication().getInternal_name());
lstScenarioExecution = scenarioExecutionRepository.getFromProjectAndAPP(principal.getId(), principal.getSelectedProject().getInternal_name(), principal.getSelectedApplication().getInternal_name(), Sort.by(Sort.Direction.DESC, "startDate"));
}else{
lstScenarioExecution = scenarioExecutionRepository.findByExecutedByUserIdAndInputsOrderByStartDateDesc(principal.getId(), principal.getSelectedProject().getInternal_name(), null);
lstScenarioExecution = scenarioExecutionRepository.getFromProject(principal.getId(), principal.getSelectedProject().getInternal_name(), Sort.by(Sort.Direction.DESC, "startDate"));
}
return lstScenarioExecution;

View File

@@ -25,8 +25,11 @@ spring.ai.openai.api-key=sk-proj-j3TFJ0h348DIzMrYYfyUT3BlbkFJjk4HMc8A2ux2Asg8Y7H
spring.ai.openai.chat.options.model=gpt-4o-mini
spring.main.allow-circular-references=true
spring.ai.azure.openai.api-key=9fb33cc69d914d4c8225b974876510b5
spring.ai.azure.openai.endpoint=https://ai-olympus.openai.azure.com/
spring.ai.azure.openai.api-key=4eHwvw6h7vHxTmI2870cR3EpEBs5L9sXZabr9nz37y39TXtk0xY5JQQJ99AKAC5RqLJXJ3w3AAABACOGLdow
spring.ai.azure.openai.endpoint=https://ai-olympus-new.openai.azure.com/
#spring.ai.azure.openai.api-key=9fb33cc69d914d4c8225b974876510b5
#spring.ai.azure.openai.endpoint=https://ai-olympus.openai.azure.com/
spring.ai.azure.openai.chat.options.deployment-name=gpt-4o-mini
spring.ai.azure.openai.chat.options.temperature=0.7