mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-21 06:04:19 +08:00
Merge branch 'master' into master
This commit is contained in:
2
.github/workflows/centos-ci.yml
vendored
2
.github/workflows/centos-ci.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [8, 11, 21] # 定义要测试的JDK版本
|
||||
java-version: [21] # 定义要测试的JDK版本
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
2
.github/workflows/mac-ci.yml
vendored
2
.github/workflows/mac-ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [8, 11, 21] # Define the JDK versions to test
|
||||
java-version: [21] # Define the JDK versions to test
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
2
.github/workflows/ubuntu-ci.yml
vendored
2
.github/workflows/ubuntu-ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [8, 11, 21] # 定义要测试的JDK版本
|
||||
java-version: [21] # 定义要测试的JDK版本
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
2
.github/workflows/windows-ci.yml
vendored
2
.github/workflows/windows-ci.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
java-version: [8, 11, 21] # Add JDK 21 to the matrix
|
||||
java-version: [21] # Add JDK 21 to the matrix
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -18,6 +18,9 @@ public class AuthenticationConfig {
|
||||
@Value("${s2.authentication.include.path:/api}")
|
||||
private String includePath;
|
||||
|
||||
@Value("${s2.authentication.strategy:http}")
|
||||
private String strategy;
|
||||
|
||||
@Value("${s2.authentication.enable:false}")
|
||||
private boolean enabled;
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
public interface UserStrategy {
|
||||
|
||||
String getStrategyName();
|
||||
|
||||
boolean accept(boolean isEnableAuthentication);
|
||||
|
||||
User findUser(HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
@@ -9,6 +9,13 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class FakeUserStrategy implements UserStrategy {
|
||||
|
||||
public static final String STRATEGY_NAME = "fake";
|
||||
|
||||
@Override
|
||||
public String getStrategyName() {
|
||||
return STRATEGY_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(boolean isEnableAuthentication) {
|
||||
return !isEnableAuthentication;
|
||||
|
||||
@@ -14,12 +14,18 @@ import java.util.Optional;
|
||||
@Service
|
||||
public class HttpHeaderUserStrategy implements UserStrategy {
|
||||
|
||||
public static final String STRATEGY_NAME = "http";
|
||||
private final TokenService tokenService;
|
||||
|
||||
public HttpHeaderUserStrategy(TokenService tokenService) {
|
||||
this.tokenService = tokenService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStrategyName() {
|
||||
return STRATEGY_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean accept(boolean isEnableAuthentication) {
|
||||
return isEnableAuthentication;
|
||||
|
||||
@@ -9,6 +9,7 @@ import lombok.Data;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Configuration
|
||||
@Data
|
||||
@@ -26,10 +27,26 @@ public class UserStrategyFactory {
|
||||
|
||||
@PostConstruct
|
||||
public void setUserStrategy() {
|
||||
for (UserStrategy userStrategy : userStrategyList) {
|
||||
if (userStrategy.accept(authenticationConfig.isEnabled())) {
|
||||
UserHolder.setStrategy(userStrategy);
|
||||
|
||||
boolean enabled = authenticationConfig.isEnabled();
|
||||
if (!enabled) {
|
||||
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,7 +8,6 @@ import java.util.List;
|
||||
|
||||
/** extended information command about model */
|
||||
@Data
|
||||
@ToString
|
||||
public class ChatConfigBaseReq {
|
||||
|
||||
private Long modelId;
|
||||
|
||||
@@ -3,11 +3,15 @@ package com.tencent.supersonic.chat.api.pojo.request;
|
||||
import com.tencent.supersonic.chat.api.pojo.enums.MemoryReviewResult;
|
||||
import com.tencent.supersonic.chat.api.pojo.enums.MemoryStatus;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChatMemoryUpdateReq {
|
||||
|
||||
@NotNull(message = "id不可为空")
|
||||
|
||||
@@ -4,7 +4,6 @@ import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class ItemNameVisibility {
|
||||
|
||||
private ItemNameVisibilityInfo aggVisibilityInfo;
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class ItemNameVisibilityInfo {
|
||||
|
||||
/** invisible dimensions */
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class ItemVisibility {
|
||||
|
||||
/** invisible dimensions */
|
||||
|
||||
@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RecommendedQuestionReq {
|
||||
|
||||
@@ -6,7 +6,6 @@ import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ToString
|
||||
@Data
|
||||
public class DictLatestTaskResp {
|
||||
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.tencent.supersonic.chat.api.pojo.response;
|
||||
import com.tencent.supersonic.chat.api.pojo.request.RecommendedQuestionReq;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class RecommendQuestionResp {
|
||||
private Long modelId;
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.tencent.supersonic.chat.api.pojo.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SimilarQueryRecallResp {
|
||||
|
||||
private Long queryId;
|
||||
|
||||
@@ -343,18 +343,25 @@ public class DataModelNode extends SemanticNode {
|
||||
Map<String, Long> orders = new HashMap<>();
|
||||
joinDataModelNames.add(baseDataModel.getName());
|
||||
orders.put(baseDataModel.getName(), 0L);
|
||||
|
||||
// Adjust the order of tables in the data source to facilitate subsequent joins
|
||||
ArrayList<String> joinTables = new ArrayList<>();
|
||||
for (JoinRelation joinRelation : ontology.getJoinRelations()) {
|
||||
if (joinDataModelNames.contains(joinRelation.getLeft())
|
||||
&& joinDataModelNames.contains(joinRelation.getRight())) {
|
||||
orders.put(joinRelation.getLeft(), 0L);
|
||||
orders.put(joinRelation.getRight(), 1L);
|
||||
joinTables.add(joinRelation.getLeft());
|
||||
joinTables.add(joinRelation.getRight());
|
||||
}
|
||||
}
|
||||
orders.entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(d -> {
|
||||
joinDataModels.add(ontology.getDataModelMap().get(d.getKey()));
|
||||
});
|
||||
for (String joinTable : joinTables) {
|
||||
orders.put(joinTable, orders.getOrDefault(joinTable, 0L) + 1L);
|
||||
}
|
||||
orders.entrySet().stream()
|
||||
.sorted((entry1, entry2) -> entry2.getValue().compareTo(entry1.getValue())) // 倒序排序
|
||||
.forEach(d -> {
|
||||
joinDataModels.add(ontology.getDataModelMap().get(d.getKey()));
|
||||
});
|
||||
}
|
||||
|
||||
return joinDataModels;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,6 +306,16 @@ public class JoinRender extends Renderer {
|
||||
r.getMiddle(), tableView.getAlias() + "." + r.getRight()))
|
||||
.collect(Collectors.toList()));
|
||||
matchJoinRelation.setJoinType(joinRelation.getJoinType());
|
||||
// Added join condition judgment to solve the problem of join condition order
|
||||
} else if (joinRelation.getLeft()
|
||||
.equalsIgnoreCase(tableView.getDataModel().getName())
|
||||
&& before.containsKey(joinRelation.getRight())) {
|
||||
matchJoinRelation.setJoinCondition(joinRelation.getJoinCondition().stream()
|
||||
.map(r -> Triple.of(
|
||||
before.get(joinRelation.getRight()) + "." + r.getRight(),
|
||||
r.getMiddle(), tableView.getAlias() + "." + r.getLeft()))
|
||||
.collect(Collectors.toList()));
|
||||
matchJoinRelation.setJoinType(joinRelation.getJoinType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ const AgentsSection: React.FC<Props> = ({
|
||||
}}
|
||||
>
|
||||
<Switch
|
||||
key={agent.id}
|
||||
size="small"
|
||||
defaultChecked={status === 1}
|
||||
onChange={(value) => {
|
||||
|
||||
Reference in New Issue
Block a user