3 Commits

Author SHA1 Message Date
supersonicbi
1ab5d9c7e6 (improvement)(chat)Default s2.parser.field.count.threshold set to 0.
Some checks failed
supersonic CentOS CI / build (21) (push) Has been cancelled
supersonic mac CI / build (21) (push) Has been cancelled
supersonic ubuntu CI / build (21) (push) Has been cancelled
supersonic windows CI / build (21) (push) Has been cancelled
2025-05-06 15:56:50 +08:00
supersonicbi
2b13866c0b (improvement)(common)Support more date string formats. 2025-05-06 15:56:03 +08:00
supersonicbi
e812884802 (fix)(chat)Chat only should return queries with empty query result. 2025-05-06 09:53:07 +08:00
5 changed files with 26 additions and 14 deletions

View File

@@ -148,7 +148,7 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
chatQueryDO.setUserName(chatParseReq.getUser().getName());
chatQueryDO.setQueryText(chatParseReq.getQueryText());
chatQueryDO.setAgentId(chatParseReq.getAgentId());
chatQueryDO.setQueryResult("");
chatQueryDO.setQueryResult("{}");
chatQueryDO.setQueryState(1);
try {
chatQueryDOMapper.insert(chatQueryDO);

View File

@@ -36,9 +36,9 @@ public class ChatModelParameters {
new Parameter("timeOut", "60", "超时时间(秒)", "", "number", MODULE_NAME);
public static List<Parameter> getParameters() {
return Lists.newArrayList(CHAT_MODEL_PROVIDER, CHAT_MODEL_BASE_URL,
CHAT_MODEL_API_KEY, CHAT_MODEL_NAME, CHAT_MODEL_API_VERSION,
CHAT_MODEL_TEMPERATURE, CHAT_MODEL_TIMEOUT);
return Lists.newArrayList(CHAT_MODEL_PROVIDER, CHAT_MODEL_BASE_URL, CHAT_MODEL_API_KEY,
CHAT_MODEL_NAME, CHAT_MODEL_API_VERSION, CHAT_MODEL_TEMPERATURE,
CHAT_MODEL_TIMEOUT);
}
private static List<String> getCandidateProviders() {

View File

@@ -242,10 +242,8 @@ public class DateModeUtils {
return String.format("%s >= '%s' and %s <= '%s'", dateField,
dateInfo.getStartDate(), dateField, dateInfo.getEndDate());
}
LocalDate endData =
LocalDate.parse(dateInfo.getEndDate(), DateTimeFormatter.ofPattern(DAY_FORMAT));
LocalDate startData = LocalDate.parse(dateInfo.getStartDate(),
DateTimeFormatter.ofPattern(DAY_FORMAT));
LocalDate endData = DateUtils.parseDate(dateInfo.getEndDate());
LocalDate startData = DateUtils.parseDate(dateInfo.getStartDate());
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(MONTH_FORMAT);
return String.format("%s >= '%s' and %s <= '%s'", dateField,
startData.format(formatter), dateField, endData.format(formatter));

View File

@@ -75,7 +75,7 @@ public class DateUtils {
}
public static String getBeforeDate(String currentDate, DatePeriodEnum datePeriodEnum) {
LocalDate specifiedDate = LocalDate.parse(currentDate, DEFAULT_DATE_FORMATTER2);
LocalDate specifiedDate = parseDate(currentDate);
LocalDate startDate;
switch (datePeriodEnum) {
case MONTH:
@@ -93,7 +93,7 @@ public class DateUtils {
public static String getBeforeDate(String currentDate, int intervalDay,
DatePeriodEnum datePeriodEnum) {
LocalDate specifiedDate = LocalDate.parse(currentDate, DEFAULT_DATE_FORMATTER2);
LocalDate specifiedDate = parseDate(currentDate);
LocalDate result = null;
switch (datePeriodEnum) {
case DAY:
@@ -161,11 +161,25 @@ public class DateUtils {
return !timeString.equals("00:00:00");
}
public static LocalDate parseDate(String timeString) {
DateTimeFormatter[] dateFormatters =
{DateTimeFormatter.ofPattern("yyyyMMdd"), DateTimeFormatter.ofPattern("yyyy-MM-dd"),
DateTimeFormatter.ofPattern("yyyy/MM/dd"),
DateTimeFormatter.ofPattern("yyyy-MM")};
for (DateTimeFormatter formatter : dateFormatters) {
try {
return LocalDate.parse(timeString, formatter);
} catch (DateTimeParseException ignored) {
}
}
return null;
}
public static List<String> getDateList(String startDateStr, String endDateStr,
DatePeriodEnum period) {
try {
LocalDate startDate = LocalDate.parse(startDateStr);
LocalDate endDate = LocalDate.parse(endDateStr);
LocalDate startDate = parseDate(startDateStr);
LocalDate endDate = parseDate(endDateStr);
List<String> datesInRange = new ArrayList<>();
LocalDate currentDate = startDate;
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
@@ -189,7 +203,7 @@ public class DateUtils {
}
public static boolean isAnyDateString(String value) {
List<String> formats = Arrays.asList("yyyy-MM-dd", "yyyy-MM", "yyyy/MM/dd");
List<String> formats = Arrays.asList("yyyy-MM-dd", "yyyy-MM", "yyyy/MM/dd", "yyyyMMdd");
return isAnyDateString(value, formats);
}

View File

@@ -54,7 +54,7 @@ public class ParserConfig extends ParameterConfig {
new Parameter("s2.parser.show.count", "3", "解析结果展示个数", "前端展示的解析个数", "number", "语义解析配置");
public static final Parameter PARSER_FIELDS_COUNT_THRESHOLD =
new Parameter("s2.parser.field.count.threshold", "3", "语义字段个数阈值",
new Parameter("s2.parser.field.count.threshold", "0", "语义字段个数阈值",
"如果映射字段小于该阈值则将数据集所有字段输入LLM", "number", "语义解析配置");
@Override