Refactor code to improve readability and maintainability
- In AdvancedAIPromptSolver.java, removed unnecessary logging statement and fixed a typo in variable name. - In SourceCodeRagSolver.java, updated service name to match the correct module name. - In application.properties, added Eureka configuration for service discovery.
This commit is contained in:
@@ -73,7 +73,9 @@ public class AdvancedAIPromptSolver extends StepSolver {
|
|||||||
|
|
||||||
if(qai_output_entityType!=null && qai_output_entityType.equals("CiaOutputEntity")){
|
if(qai_output_entityType!=null && qai_output_entityType.equals("CiaOutputEntity")){
|
||||||
logger.info("Output is of type CiaOutputEntity");
|
logger.info("Output is of type CiaOutputEntity");
|
||||||
|
|
||||||
CiaOutputEntity ouputEntity = resp.entity(CiaOutputEntity.class);
|
CiaOutputEntity ouputEntity = resp.entity(CiaOutputEntity.class);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
String jsonOutput = objectMapper.writeValueAsString(ouputEntity);
|
String jsonOutput = objectMapper.writeValueAsString(ouputEntity);
|
||||||
|
|||||||
@@ -73,13 +73,18 @@ public class SourceCodeRagSolver extends StepSolver {
|
|||||||
similaritySearchCodeInput.setSimilarityThreshold(String.valueOf(this.threshold));
|
similaritySearchCodeInput.setSimilarityThreshold(String.valueOf(this.threshold));
|
||||||
similaritySearchCodeInput.setFilterExpression(this.rag_filter);
|
similaritySearchCodeInput.setFilterExpression(this.rag_filter);
|
||||||
|
|
||||||
ServiceInstance serviceInstance = discoveryClient.getInstances("java-source-code-service").get(0);
|
ServiceInstance serviceInstance = discoveryClient.getInstances("source-code-module").get(0);
|
||||||
RestTemplate restTemplate = new RestTemplate();
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
|
||||||
CodeRagResponse[] ragresponse =
|
CodeRagResponse[] ragresponse =
|
||||||
restTemplate.postForEntity(serviceInstance.getUri() + "/similarity-search-code",
|
restTemplate.postForEntity(serviceInstance.getUri() + "/similarity-search-code",
|
||||||
similaritySearchCodeInput,CodeRagResponse[].class ).getBody();
|
similaritySearchCodeInput,CodeRagResponse[].class ).getBody();
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: Replace above using Feign interface
|
||||||
|
// var code = codeSimilritySearch(xxxxxxx)
|
||||||
|
|
||||||
|
|
||||||
String code="";
|
String code="";
|
||||||
for (CodeRagResponse codeRagResponse : ragresponse) {
|
for (CodeRagResponse codeRagResponse : ragresponse) {
|
||||||
code += "SOURCE CODE OF "+codeRagResponse.getCodeType()+" : " + codeRagResponse.getFullyQualifiedName() +" \n";
|
code += "SOURCE CODE OF "+codeRagResponse.getCodeType()+" : " + codeRagResponse.getFullyQualifiedName() +" \n";
|
||||||
|
|||||||
@@ -33,3 +33,5 @@ spring.ai.vectorstore.neo4j.index-name:spring-ai-document-index
|
|||||||
spring.main.allow-bean-definition-overriding=true
|
spring.main.allow-bean-definition-overriding=true
|
||||||
logging.level.org.springframework.ai.chat.client.advisor=DEBUG
|
logging.level.org.springframework.ai.chat.client.advisor=DEBUG
|
||||||
|
|
||||||
|
eureka.client.serviceUrl.defaultZone: ${EUREKA_URI:http://localhost:8761/eureka}
|
||||||
|
eureka.instance.preferIpAddress: true
|
||||||
Reference in New Issue
Block a user