mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-30 13:04:27 +08:00
Compare commits
1 Commits
2169941926
...
f973faba04
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f973faba04 |
22
.github/workflows/centos-ci.yml
vendored
22
.github/workflows/centos-ci.yml
vendored
@@ -15,17 +15,11 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [21] # 定义要测试的JDK版本
|
java-version: [8, 11, 21] # 定义要测试的JDK版本
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up JDK ${{ matrix.java-version }}
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: ${{ matrix.java-version }}
|
|
||||||
distribution: 'adopt'
|
|
||||||
|
|
||||||
- name: Reset DNF repositories
|
- name: Reset DNF repositories
|
||||||
run: |
|
run: |
|
||||||
cd /etc/yum.repos.d/
|
cd /etc/yum.repos.d/
|
||||||
@@ -35,11 +29,21 @@ jobs:
|
|||||||
- name: Update DNF package index
|
- name: Update DNF package index
|
||||||
run: dnf makecache
|
run: dnf makecache
|
||||||
|
|
||||||
- name: Install Maven with retry
|
- name: Install Java and Maven with retry
|
||||||
run: |
|
run: |
|
||||||
|
if [ ${{ matrix.java-version }} -eq 8 ]; then
|
||||||
for i in {1..5}; do
|
for i in {1..5}; do
|
||||||
dnf install -y maven && break || sleep 15
|
dnf install -y java-1.8.0-openjdk-devel maven && break || sleep 15
|
||||||
done
|
done
|
||||||
|
elif [ ${{ matrix.java-version }} -eq 11 ]; then
|
||||||
|
for i in {1..5}; do
|
||||||
|
dnf install -y java-11-openjdk-devel maven && break || sleep 15
|
||||||
|
done
|
||||||
|
elif [ ${{ matrix.java-version }} -eq 21 ]; then
|
||||||
|
for i in {1..5}; do
|
||||||
|
dnf install -y java-21-openjdk-devel maven && break || sleep 15
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Verify Java and Maven installation
|
- name: Verify Java and Maven installation
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
2
.github/workflows/mac-ci.yml
vendored
2
.github/workflows/mac-ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [21] # Define the JDK versions to test
|
java-version: [8, 11, 21] # Define the JDK versions to test
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
2
.github/workflows/ubuntu-ci.yml
vendored
2
.github/workflows/ubuntu-ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [21] # 定义要测试的JDK版本
|
java-version: [8, 11, 21] # 定义要测试的JDK版本
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
2
.github/workflows/windows-ci.yml
vendored
2
.github/workflows/windows-ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
java-version: [21] # Add JDK 21 to the matrix
|
java-version: [8, 11, 21] # Add JDK 21 to the matrix
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|||||||
@@ -18,9 +18,6 @@ public class AuthenticationConfig {
|
|||||||
@Value("${s2.authentication.include.path:/api}")
|
@Value("${s2.authentication.include.path:/api}")
|
||||||
private String includePath;
|
private String includePath;
|
||||||
|
|
||||||
@Value("${s2.authentication.strategy:http}")
|
|
||||||
private String strategy;
|
|
||||||
|
|
||||||
@Value("${s2.authentication.enable:false}")
|
@Value("${s2.authentication.enable:false}")
|
||||||
private boolean enabled;
|
private boolean enabled;
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import com.tencent.supersonic.common.pojo.User;
|
|||||||
|
|
||||||
public interface UserStrategy {
|
public interface UserStrategy {
|
||||||
|
|
||||||
String getStrategyName();
|
|
||||||
|
|
||||||
boolean accept(boolean isEnableAuthentication);
|
boolean accept(boolean isEnableAuthentication);
|
||||||
|
|
||||||
User findUser(HttpServletRequest request, HttpServletResponse response);
|
User findUser(HttpServletRequest request, HttpServletResponse response);
|
||||||
|
|||||||
@@ -10,13 +10,6 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class FakeUserStrategy implements UserStrategy {
|
public class FakeUserStrategy implements UserStrategy {
|
||||||
|
|
||||||
public static final String STRATEGY_NAME = "fake";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStrategyName() {
|
|
||||||
return STRATEGY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(boolean isEnableAuthentication) {
|
public boolean accept(boolean isEnableAuthentication) {
|
||||||
return !isEnableAuthentication;
|
return !isEnableAuthentication;
|
||||||
|
|||||||
@@ -15,18 +15,12 @@ import java.util.Optional;
|
|||||||
@Service
|
@Service
|
||||||
public class HttpHeaderUserStrategy implements UserStrategy {
|
public class HttpHeaderUserStrategy implements UserStrategy {
|
||||||
|
|
||||||
public static final String STRATEGY_NAME = "http";
|
|
||||||
private final TokenService tokenService;
|
private final TokenService tokenService;
|
||||||
|
|
||||||
public HttpHeaderUserStrategy(TokenService tokenService) {
|
public HttpHeaderUserStrategy(TokenService tokenService) {
|
||||||
this.tokenService = tokenService;
|
this.tokenService = tokenService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStrategyName() {
|
|
||||||
return STRATEGY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean accept(boolean isEnableAuthentication) {
|
public boolean accept(boolean isEnableAuthentication) {
|
||||||
return isEnableAuthentication;
|
return isEnableAuthentication;
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import lombok.Data;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@Data
|
@Data
|
||||||
@@ -27,26 +26,10 @@ public class UserStrategyFactory {
|
|||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void setUserStrategy() {
|
public void setUserStrategy() {
|
||||||
|
for (UserStrategy userStrategy : userStrategyList) {
|
||||||
boolean enabled = authenticationConfig.isEnabled();
|
if (userStrategy.accept(authenticationConfig.isEnabled())) {
|
||||||
if (!enabled) {
|
UserHolder.setStrategy(userStrategy);
|
||||||
for (UserStrategy userStrategy : userStrategyList) {
|
|
||||||
if (userStrategy.accept(authenticationConfig.isEnabled())) {
|
|
||||||
UserHolder.setStrategy(userStrategy);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String strategy = authenticationConfig.getStrategy();
|
|
||||||
Optional<UserStrategy> strategyOptional = userStrategyList.stream()
|
|
||||||
.filter(t -> t.accept(true) && strategy.equalsIgnoreCase(t.getStrategyName()))
|
|
||||||
.findAny();
|
|
||||||
|
|
||||||
if (strategyOptional.isPresent()) {
|
|
||||||
UserHolder.setStrategy(strategyOptional.get());
|
|
||||||
} else {
|
|
||||||
throw new IllegalStateException("strategy is not found: " + strategy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
/** extended information command about model */
|
/** extended information command about model */
|
||||||
@Data
|
@Data
|
||||||
|
@ToString
|
||||||
public class ChatConfigBaseReq {
|
public class ChatConfigBaseReq {
|
||||||
|
|
||||||
private Long modelId;
|
private Long modelId;
|
||||||
|
|||||||
@@ -4,15 +4,11 @@ import javax.validation.constraints.NotNull;
|
|||||||
|
|
||||||
import com.tencent.supersonic.chat.api.pojo.enums.MemoryReviewResult;
|
import com.tencent.supersonic.chat.api.pojo.enums.MemoryReviewResult;
|
||||||
import com.tencent.supersonic.chat.api.pojo.enums.MemoryStatus;
|
import com.tencent.supersonic.chat.api.pojo.enums.MemoryStatus;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class ChatMemoryUpdateReq {
|
public class ChatMemoryUpdateReq {
|
||||||
|
|
||||||
@NotNull(message = "id不可为空")
|
@NotNull(message = "id不可为空")
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import lombok.Data;
|
|||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ToString
|
||||||
public class ItemNameVisibility {
|
public class ItemNameVisibility {
|
||||||
|
|
||||||
private ItemNameVisibilityInfo aggVisibilityInfo;
|
private ItemNameVisibilityInfo aggVisibilityInfo;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ToString
|
||||||
public class ItemNameVisibilityInfo {
|
public class ItemNameVisibilityInfo {
|
||||||
|
|
||||||
/** invisible dimensions */
|
/** invisible dimensions */
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ToString
|
||||||
public class ItemVisibility {
|
public class ItemVisibility {
|
||||||
|
|
||||||
/** invisible dimensions */
|
/** invisible dimensions */
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import lombok.NoArgsConstructor;
|
|||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ToString
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class RecommendedQuestionReq {
|
public class RecommendedQuestionReq {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import lombok.ToString;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
@ToString
|
||||||
@Data
|
@Data
|
||||||
public class DictLatestTaskResp {
|
public class DictLatestTaskResp {
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ package com.tencent.supersonic.chat.api.pojo.response;
|
|||||||
import com.tencent.supersonic.chat.api.pojo.request.RecommendedQuestionReq;
|
import com.tencent.supersonic.chat.api.pojo.request.RecommendedQuestionReq;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class RecommendQuestionResp {
|
public class RecommendQuestionResp {
|
||||||
private Long modelId;
|
private Long modelId;
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
package com.tencent.supersonic.chat.api.pojo.response;
|
package com.tencent.supersonic.chat.api.pojo.response;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public class SimilarQueryRecallResp {
|
public class SimilarQueryRecallResp {
|
||||||
|
|
||||||
private Long queryId;
|
private Long queryId;
|
||||||
|
|||||||
@@ -230,8 +230,7 @@ public class ChatQueryServiceImpl implements ChatQueryService {
|
|||||||
return queryResult;
|
return queryResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkMetricReplace(ChatQueryDataReq chatQueryDataReq,
|
private boolean checkMetricReplace(ChatQueryDataReq chatQueryDataReq, SemanticParseInfo parseInfo) {
|
||||||
SemanticParseInfo parseInfo) {
|
|
||||||
List<String> oriFields = getFieldsFromSql(parseInfo);
|
List<String> oriFields = getFieldsFromSql(parseInfo);
|
||||||
Set<SchemaElement> metrics = chatQueryDataReq.getMetrics();
|
Set<SchemaElement> metrics = chatQueryDataReq.getMetrics();
|
||||||
if (CollectionUtils.isEmpty(oriFields) || CollectionUtils.isEmpty(metrics)) {
|
if (CollectionUtils.isEmpty(oriFields) || CollectionUtils.isEmpty(metrics)) {
|
||||||
@@ -243,7 +242,7 @@ public class ChatQueryServiceImpl implements ChatQueryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String replaceFilters(ChatQueryDataReq queryData, SemanticParseInfo parseInfo,
|
private String replaceFilters(ChatQueryDataReq queryData, SemanticParseInfo parseInfo,
|
||||||
DataSetSchema dataSetSchema) {
|
DataSetSchema dataSetSchema) {
|
||||||
String correctorSql = parseInfo.getSqlInfo().getCorrectedS2SQL();
|
String correctorSql = parseInfo.getSqlInfo().getCorrectedS2SQL();
|
||||||
log.info("correctorSql before replacing:{}", correctorSql);
|
log.info("correctorSql before replacing:{}", correctorSql);
|
||||||
// get where filter and having filter
|
// get where filter and having filter
|
||||||
|
|||||||
Reference in New Issue
Block a user