(improvement)(config) Split the application-local.yml file based on functionality. (#1250)

This commit is contained in:
lexluo09
2024-06-27 16:56:16 +08:00
committed by GitHub
parent 8b88528938
commit bbd61ac937
23 changed files with 162 additions and 163 deletions

View File

@@ -13,38 +13,38 @@ import java.util.stream.Collectors;
@Configuration
public class AuthenticationConfig {
@Value("${authentication.exclude.path:XXX}")
@Value("${s2.authentication.exclude.path:XXX}")
private String excludePath;
@Value("${authentication.include.path:/api}")
@Value("${s2.authentication.include.path:/api}")
private String includePath;
@Value("${authentication.enable:false}")
@Value("${s2.authentication.enable:false}")
private boolean enabled;
@Value("${authentication.token.default.appKey:supersonic}")
@Value("${s2.authentication.token.default.appKey:supersonic}")
private String tokenDefaultAppKey;
@Value("${authentication.token.appSecret:supersonic:WIaO9YRRVt+7QtpPvyWsARFngnEcbaKBk"
@Value("${s2.authentication.token.appSecret:supersonic:WIaO9YRRVt+7QtpPvyWsARFngnEcbaKBk"
+ "783uGFwMrbJBaochsqCH62L4Kijcb0sZCYoSsiKGV/zPml5MnZ3uQ==}")
private String tokenAppSecret;
@Value("${authentication.token.http.header.key:Authorization}")
@Value("${s2.authentication.token.http.header.key:Authorization}")
private String tokenHttpHeaderKey;
@Value("${authentication.token.http.app.key:App-Key}")
@Value("${s2.authentication.token.http.app.key:App-Key}")
private String tokenHttpHeaderAppKey;
@Value("${authentication.app.appId:appId}")
@Value("${s2.authentication.app.appId:appId}")
private String appId;
@Value("${authentication.app.timestamp:timestamp}")
@Value("${s2.authentication.app.timestamp:timestamp}")
private String timestamp;
@Value("${authentication.app.signature:signature}")
@Value("${s2.authentication.app.signature:signature}")
private String signature;
@Value("${authentication.token.timeout:7200000}")
@Value("${s2.authentication.token.timeout:7200000}")
private Long tokenTimeout;
public Map<String, String> getAppKeyToSecretMap() {

View File

@@ -15,7 +15,7 @@ import java.util.Objects;
@Slf4j
public class LoadRemoveService {
@Value("${mapper.remove.nature.prefix:}")
@Value("${s2.mapper.remove.nature.prefix:}")
private String mapperRemoveNaturePrefix;
public List removeNatures(List value) {

View File

@@ -37,16 +37,16 @@ import static com.tencent.supersonic.common.pojo.Constants.YEAR;
@Data
public class DateModeUtils {
@Value("${query.parameter.sys.date:sys_imp_date}")
@Value("${s2.query.parameter.sys.date:sys_imp_date}")
private String sysDateCol;
@Value("${query.parameter.sys.month:sys_imp_month}")
@Value("${s2.query.parameter.sys.month:sys_imp_month}")
private String sysDateMonthCol;
@Value("${query.parameter.sys.month:sys_imp_week}")
@Value("${s2.query.parameter.sys.month:sys_imp_week}")
private String sysDateWeekCol;
@Value("${query.parameter.sys.zipper.begin:start_}")
@Value("${s2.query.parameter.sys.zipper.begin:start_}")
private String sysZipperDateColBegin;
@Value("${query.parameter.sys.zipper.end:end_}")
@Value("${s2.query.parameter.sys.zipper.end:end_}")
private String sysZipperDateColEnd;
public Boolean recentMode(DateConf dateInfo) {

View File

@@ -15,10 +15,10 @@ import java.io.FileNotFoundException;
public class ChatLocalFileConfig {
@Value("${dict.directory.latest:/data/dictionary/custom}")
@Value("${s2.dict.directory.latest:/data/dictionary/custom}")
private String dictDirectoryLatest;
@Value("${dict.directory.backup:./dict/backup}")
@Value("${s2.dict.directory.backup:./dict/backup}")
private String dictDirectoryBackup;
public String getDictDirectoryLatest() {

View File

@@ -14,10 +14,10 @@ import java.io.FileNotFoundException;
public class LocalFileConfig {
@Value("${dict.directory.latest:/data/dictionary/custom}")
@Value("${s2.dict.directory.latest:/data/dictionary/custom}")
private String dictDirectoryLatest;
@Value("${dict.directory.backup:./data/dictionary/backup}")
@Value("${s2.dict.directory.backup:./data/dictionary/backup}")
private String dictDirectoryBackup;
public String getDictDirectoryLatest() {

View File

@@ -8,19 +8,19 @@ import org.springframework.context.annotation.Configuration;
@Data
public class CacheCommonConfig {
@Value("${cache.common.app:supersonic}")
@Value("${s2.cache.common.app:supersonic}")
private String cacheCommonApp;
@Value("${cache.common.env:dev}")
@Value("${s2.cache.common.env:dev}")
private String cacheCommonEnv;
@Value("${cache.common.version:0}")
@Value("${s2.cache.common.version:0}")
private Integer cacheCommonVersion;
@Value("${cache.common.expire.after.write:10}")
@Value("${s2.cache.common.expire.after.write:10}")
private Integer cacheCommonExpireAfterWrite;
@Value("${query.cache.enable:true}")
@Value("${s2.query.cache.enable:true}")
private Boolean cacheEnable;

View File

@@ -2,22 +2,23 @@ package com.tencent.supersonic.headless.core.cache;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.TimeUnit;
@Configuration
public class CaffeineCacheConfig {
@Autowired
private CacheCommonConfig cacheCommonConfig;
@Value("${caffeine.initial.capacity:500}")
@Value("${s2.caffeine.initial.capacity:500}")
private Integer caffeineInitialCapacity;
@Value("${caffeine.max.size:5000}")
@Value("${s2.caffeine.max.size:5000}")
private Integer caffeineMaximumSize;
@Bean(name = "caffeineCache")

View File

@@ -6,7 +6,7 @@ import org.springframework.context.annotation.Configuration;
@Data
@Configuration
public class AggregatorConfig {
@Value("${metric.aggregator.ratio.enable:true}")
@Value("${s2.metric.aggregator.ratio.enable:true}")
private Boolean enableRatio;
}

View File

@@ -8,37 +8,37 @@ import org.springframework.context.annotation.Configuration;
@Data
public class DefaultSemanticConfig {
@Value("${semantic.url.prefix:http://localhost:8081}")
@Value("${s2.semantic.url.prefix:http://localhost:8081}")
private String semanticUrl;
@Value("${searchByStruct.path:/api/semantic/query/struct}")
@Value("${s2.searchByStruct.path:/api/semantic/query/struct}")
private String searchByStructPath;
@Value("${searchByStruct.path:/api/semantic/query/multiStruct}")
@Value("${s2.searchByStruct.path:/api/semantic/query/multiStruct}")
private String searchByMultiStructPath;
@Value("${searchByStruct.path:/api/semantic/query/sql}")
@Value("${s2.searchByStruct.path:/api/semantic/query/sql}")
private String searchBySqlPath;
@Value("${searchByStruct.path:/api/semantic/query/queryDimValue}")
@Value("${s2.searchByStruct.path:/api/semantic/query/queryDimValue}")
private String queryDimValuePath;
@Value("${fetchModelSchemaPath.path:/api/semantic/schema}")
@Value("${s2.fetchModelSchemaPath.path:/api/semantic/schema}")
private String fetchModelSchemaPath;
@Value("${fetchModelList.path:/api/semantic/schema/dimension/page}")
@Value("${s2.fetchModelList.path:/api/semantic/schema/dimension/page}")
private String fetchDimensionPagePath;
@Value("${fetchModelList.path:/api/semantic/schema/metric/page}")
@Value("${s2.fetchModelList.path:/api/semantic/schema/metric/page}")
private String fetchMetricPagePath;
@Value("${fetchModelList.path:/api/semantic/schema/domain/list}")
@Value("${s2.fetchModelList.path:/api/semantic/schema/domain/list}")
private String fetchDomainListPath;
@Value("${fetchModelList.path:/api/semantic/schema/model/list}")
@Value("${s2.fetchModelList.path:/api/semantic/schema/model/list}")
private String fetchModelListPath;
@Value("${explain.path:/api/semantic/query/explain}")
@Value("${s2.explain.path:/api/semantic/query/explain}")
private String explainPath;
}

View File

@@ -8,28 +8,28 @@ import org.springframework.context.annotation.Configuration;
@Configuration
public class ExecutorConfig {
@Value("${metricParser.agg.mysql.lowVersion:5.7}")
@Value("${s2.metricParser.agg.mysql.lowVersion:5.7}")
private String mysqlLowVersion;
@Value("${metricParser.agg.ck.lowVersion:20.4}")
@Value("${s2.metricParser.agg.ck.lowVersion:20.4}")
private String ckLowVersion;
@Value("${internal.metric.cnt.suffix:internal_cnt}")
@Value("${s2.internal.metric.cnt.suffix:internal_cnt}")
private String internalMetricNameSuffix;
@Value("${accelerator.duckDb.enable:false}")
@Value("${s2.accelerator.duckDb.enable:false}")
private Boolean duckEnable = false;
@Value("${accelerator.duckDb.temp:/data1/duck/tmp/}")
@Value("${s2.accelerator.duckDb.temp:/data1/duck/tmp/}")
private String duckDbTemp;
@Value("${accelerator.duckDb.maximumPoolSize:10}")
@Value("${s2.accelerator.duckDb.maximumPoolSize:10}")
private Integer duckDbMaximumPoolSize;
@Value("${accelerator.duckDb.MaxLifetime:3}")
@Value("${s2.accelerator.duckDb.MaxLifetime:3}")
private Integer duckDbMaxLifetime;
@Value("${accelerator.duckDb.memoryLimit:31}")
@Value("${s2.accelerator.duckDb.memoryLimit:31}")
private Integer memoryLimit;
@Value("${accelerator.duckDb.threads:32}")
@Value("${s2.accelerator.duckDb.threads:32}")
private Integer threads;
}

View File

@@ -1,13 +1,19 @@
package com.tencent.supersonic.headless.core.utils;
import static com.tencent.supersonic.common.pojo.Constants.AT_SYMBOL;
import com.tencent.supersonic.common.pojo.QueryColumn;
import com.tencent.supersonic.common.util.DateUtils;
import com.tencent.supersonic.headless.api.pojo.enums.DataType;
import com.tencent.supersonic.headless.api.pojo.response.SemanticQueryResp;
import com.tencent.supersonic.headless.core.pojo.Database;
import com.tencent.supersonic.headless.core.pojo.JdbcDataSource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.sql.DataSource;
import java.rmi.ServerException;
import java.sql.Connection;
import java.sql.ResultSet;
@@ -21,13 +27,8 @@ import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import static com.tencent.supersonic.common.pojo.Constants.AT_SYMBOL;
/**
* tools functions about sql query
@@ -42,10 +43,10 @@ public class SqlUtils {
@Autowired
private JdbcDataSource jdbcDataSource;
@Value("${source.result-limit:1000000}")
@Value("${s2.source.result-limit:1000000}")
private int resultLimit;
@Value("${source.enable-query-log:false}")
@Value("${s2.source.enable-query-log:false}")
private boolean isQueryLogEnable;
@Getter

View File

@@ -41,7 +41,7 @@ import java.util.stream.Collectors;
@Slf4j
public class DimValueAspect {
@Value("${dimension.value.map.enable:true}")
@Value("${s2.dimension.value.map.enable:true}")
private Boolean dimensionValueMapEnable;
@Autowired
private DimensionService dimensionService;

View File

@@ -27,7 +27,7 @@ public class MetaEmbeddingListener implements ApplicationListener<DataEvent> {
@Autowired
private EmbeddingService embeddingService;
@Value("${embedding.operation.sleep.time:3000}")
@Value("${s2.embedding.operation.sleep.time:3000}")
private Integer embeddingOperationSleepTime;
@Async

View File

@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
@Repository
public class DictRepositoryImpl implements DictRepository {
@Value("${dict.task.num:10}")
@Value("${s2.dict.task.num:10}")
private Integer dictTaskNum;
private final DictTaskMapper dictTaskMapper;

View File

@@ -63,20 +63,18 @@ import static com.tencent.supersonic.common.pojo.Constants.SPACE;
@Slf4j
@Component
public class DictUtils {
private static String dateTimeFormatter = "yyyyMMddHHmmss";
@Value("${dimension.multi.value.split:#}")
@Value("${s2.dimension.multi.value.split:#}")
private String dimMultiValueSplit;
@Value("${item.value.max.count:100000}")
@Value("${s2.item.value.max.count:100000}")
private Long itemValueMaxCount;
@Value("${item.value.white.frequency:999999}")
@Value("${s2.item.value.white.frequency:999999}")
private Long itemValueWhiteFrequency;
@Value("${item.value.date.start:1}")
@Value("${s2.item.value.date.start:1}")
private Integer itemValueDateStart;
@Value("${item.value.date.end:1}")
@Value("${s2.item.value.date.end:1}")
private Integer itemValueDateEnd;

View File

@@ -28,52 +28,10 @@ spring:
mybatis:
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml
authentication:
enable: true
exclude:
path: /api/auth/user/register,/api/auth/user/login
token:
http:
header:
key: Authorization
logging:
level:
dev.langchain4j: DEBUG
dev.ai4j.openai4j: DEBUG
s2:
pyllm:
url: http://127.0.0.1:9092
parser:
url: ${s2.pyllm.url}
strategy: ONE_PASS_SELF_CONSISTENCY
exemplar-recall:
number: 10
few-shot:
number: 5
self-consistency:
number: 1
multi-turn:
enable: false
corrector:
additional:
information: true
date: true
functionCall:
url: ${s2.pyllm.url}
embedding:
url: ${s2.pyllm.url}
persistent:
path: /tmp
demo:
names: S2VisitsDemo,S2ArtistDemo,SmallTalkDemo
enableLLM: true
# swagger配置
swagger:
title: 'SuperSonic平台接口文档'

View File

@@ -1,10 +1,11 @@
spring:
profiles:
active: local
active: prd
application:
name: chat
config:
import:
- classpath:llm-config.yaml
- classpath:s2-config.yaml
- classpath:langchain4j-config.yaml
mybatis:
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml

View File

@@ -0,0 +1,40 @@
s2:
pyllm:
url: http://127.0.0.1:9092
parser:
url: ${s2.pyllm.url}
strategy: ONE_PASS_SELF_CONSISTENCY
exemplar-recall:
number: 10
few-shot:
number: 5
self-consistency:
number: 1
multi-turn:
enable: false
corrector:
additional:
information: true
date: true
functionCall:
url: ${s2.pyllm.url}
embedding:
url: ${s2.pyllm.url}
persistent:
path: /tmp
demo:
names: S2VisitsDemo,S2ArtistDemo,SmallTalkDemo
enableLLM: true
authentication:
enable: true
exclude:
path: /api/auth/user/register,/api/auth/user/login
token:
http:
header:
key: Authorization

View File

@@ -28,56 +28,10 @@ spring:
mybatis:
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml
authentication:
enable: true
exclude:
path: /api/auth/user/register,/api/auth/user/login
token:
http:
header:
key: Authorization
logging:
level:
dev.langchain4j: DEBUG
dev.ai4j.openai4j: DEBUG
s2:
pyllm:
url: http://127.0.0.1:9092
parser:
url: ${s2.pyllm.url}
strategy: ONE_PASS_SELF_CONSISTENCY
exemplar-recall:
number: 10
few-shot:
number: 5
self-consistency:
number: 1
multi-turn:
enable: false
corrector:
additional:
information: true
date: true
functionCall:
url: ${s2.pyllm.url}
embedding:
url: ${s2.pyllm.url}
persistent:
path: /tmp
demo:
names: S2VisitsDemo,S2ArtistDemo
enableLLM: false
schema:
cache:
enable: false
# swagger配置
swagger:
title: 'SuperSonic平台接口文档'

View File

@@ -1,10 +1,11 @@
spring:
profiles:
active: local
active: prd
application:
name: chat
config:
import:
- classpath:llm-config.yaml
- classpath:s2-config.yaml
- classpath:langchain4j-config.yaml
mybatis:
mapper-locations=classpath:mappers/custom/*.xml,classpath*:/mappers/*.xml

View File

@@ -0,0 +1,45 @@
s2:
pyllm:
url: http://127.0.0.1:9092
parser:
url: ${s2.pyllm.url}
strategy: ONE_PASS_SELF_CONSISTENCY
exemplar-recall:
number: 10
few-shot:
number: 5
self-consistency:
number: 1
multi-turn:
enable: false
corrector:
additional:
information: true
date: true
functionCall:
url: ${s2.pyllm.url}
embedding:
url: ${s2.pyllm.url}
persistent:
path: /tmp
demo:
names: S2VisitsDemo,S2ArtistDemo
enableLLM: false
schema:
cache:
enable: false
authentication:
enable: true
exclude:
path: /api/auth/user/register,/api/auth/user/login
token:
http:
header:
key: Authorization