[improvement][project]Optimize log files and outputs.

This commit is contained in:
jerryjzhang
2024-10-18 14:17:47 +08:00
parent 55a4d5a198
commit 5c8b9a0ee1
9 changed files with 26 additions and 35 deletions

View File

@@ -24,7 +24,7 @@ public class AliasGenerateHelper {
private static final Logger keyPipelineLog = LoggerFactory.getLogger("keyPipeline");
private static final String NAME_ALIAS_INSTRUCTION = ""
+ "\n#Role: You are a professional data analyst specializing in metrics and dimensions."
+ "#Role: You are a professional data analyst specializing in metrics and dimensions."
+ "\n#Task: You will be provided with metadata about a metric or dimension, please help "
+ "generate a few aliases in the same language as its `fieldName`." + "\n#Rules:"
+ "1. Please do not generate aliases like xxx1, xxx2, xxx3."
@@ -57,9 +57,8 @@ public class AliasGenerateHelper {
variable.put("desc", desc);
Prompt prompt = PromptTemplate.from(NAME_ALIAS_INSTRUCTION).apply(variable);
keyPipelineLog.info("AliasGenerateHelper.generateNameAlias reqPrompt:{}", prompt.text());
String response = getChatCompletion(prompt);
keyPipelineLog.info("AliasGenerateHelper.generateNameAlias modelResp:{}", response);
keyPipelineLog.info("AliasGenerateHelper.generateAlias modelReq:\n{} \nmodelResp:\n{}", prompt.text(), response);
return response;
}
@@ -68,9 +67,10 @@ public class AliasGenerateHelper {
variable.put("values", json);
Prompt prompt = PromptTemplate.from(VALUE_ALIAS_INSTRUCTION).apply(variable);
keyPipelineLog.info("AliasGenerateHelper.generateValueAlias reqPrompt:{}", prompt.text());
String response = getChatCompletion(prompt);
keyPipelineLog.info("AliasGenerateHelper.generateValueAlias modelResp:{}", response);
keyPipelineLog.info("AliasGenerateHelper.generateValueAlias modelReq:\n{} " +
"\nmodelResp:\n{}", prompt.text(), response);
return response;
}

View File

@@ -19,8 +19,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@@ -32,7 +30,6 @@ import java.util.stream.Collectors;
@Slf4j
public class ChatWorkflowEngine {
private static final Logger keyPipelineLog = LoggerFactory.getLogger("keyPipeline");
private final List<SchemaMapper> schemaMappers = ComponentFactory.getSchemaMappers();
private final List<SemanticParser> semanticParsers = ComponentFactory.getSemanticParsers();
private final List<SemanticCorrector> semanticCorrectors =
@@ -150,7 +147,7 @@ public class ChatWorkflowEngine {
if (StringUtils.isNotBlank(explain.getErrMsg())) {
errorMsg.add(explain.getErrMsg());
}
keyPipelineLog.info(
log.info(
"SqlInfoProcessor results:\n"
+ "Parsed S2SQL: {}\nCorrected S2SQL: {}\nQuery SQL: {}",
StringUtils.normalizeSpace(parseInfo.getSqlInfo().getParsedS2SQL()),

View File

@@ -213,7 +213,7 @@ public class DataSetSchemaBuilder {
}
private static void setDefaultTimeFormat(SchemaElement dimToAdd,
DimensionTimeTypeParams dimensionTimeTypeParams, String timeFormat) {
DimensionTimeTypeParams dimensionTimeTypeParams, String timeFormat) {
if (null != dimensionTimeTypeParams && TimeDimensionEnum.DAY.name()
.equalsIgnoreCase(dimensionTimeTypeParams.getTimeGranularity())) {
dimToAdd.getExtInfo().put(DimensionConstants.DIMENSION_TIME_FORMAT,