Merge branch 'master' into master

This commit is contained in:
mislayming
2024-12-10 22:04:56 +08:00
committed by GitHub
21 changed files with 76 additions and 19 deletions

View File

@@ -15,7 +15,7 @@ jobs:
strategy: strategy:
matrix: matrix:
java-version: [8, 11, 21] # 定义要测试的JDK版本 java-version: [21] # 定义要测试的JDK版本
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -14,7 +14,7 @@ jobs:
strategy: strategy:
matrix: matrix:
java-version: [8, 11, 21] # Define the JDK versions to test java-version: [21] # Define the JDK versions to test
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -14,7 +14,7 @@ jobs:
strategy: strategy:
matrix: matrix:
java-version: [8, 11, 21] # 定义要测试的JDK版本 java-version: [21] # 定义要测试的JDK版本
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -14,7 +14,7 @@ jobs:
strategy: strategy:
matrix: matrix:
java-version: [8, 11, 21] # Add JDK 21 to the matrix java-version: [21] # Add JDK 21 to the matrix
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -18,6 +18,9 @@ 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;

View File

@@ -6,6 +6,8 @@ import jakarta.servlet.http.HttpServletResponse;
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);

View File

@@ -9,6 +9,13 @@ 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;

View File

@@ -14,12 +14,18 @@ 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;

View File

@@ -9,6 +9,7 @@ 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
@@ -26,10 +27,26 @@ public class UserStrategyFactory {
@PostConstruct @PostConstruct
public void setUserStrategy() { public void setUserStrategy() {
for (UserStrategy userStrategy : userStrategyList) {
if (userStrategy.accept(authenticationConfig.isEnabled())) { boolean enabled = authenticationConfig.isEnabled();
UserHolder.setStrategy(userStrategy); 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);
} }
} }
} }

View File

@@ -8,7 +8,6 @@ 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;

View File

@@ -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.MemoryReviewResult;
import com.tencent.supersonic.chat.api.pojo.enums.MemoryStatus; import com.tencent.supersonic.chat.api.pojo.enums.MemoryStatus;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
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不可为空")

View File

@@ -4,7 +4,6 @@ import lombok.Data;
import lombok.ToString; import lombok.ToString;
@Data @Data
@ToString
public class ItemNameVisibility { public class ItemNameVisibility {
private ItemNameVisibilityInfo aggVisibilityInfo; private ItemNameVisibilityInfo aggVisibilityInfo;

View File

@@ -7,7 +7,6 @@ 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 */

View File

@@ -7,7 +7,6 @@ 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 */

View File

@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
import lombok.ToString; import lombok.ToString;
@Data @Data
@ToString
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class RecommendedQuestionReq { public class RecommendedQuestionReq {

View File

@@ -6,7 +6,6 @@ import lombok.ToString;
import java.util.Date; import java.util.Date;
@ToString
@Data @Data
public class DictLatestTaskResp { public class DictLatestTaskResp {

View File

@@ -3,10 +3,12 @@ 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;

View File

@@ -1,10 +1,14 @@
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;

View File

@@ -343,18 +343,25 @@ public class DataModelNode extends SemanticNode {
Map<String, Long> orders = new HashMap<>(); Map<String, Long> orders = new HashMap<>();
joinDataModelNames.add(baseDataModel.getName()); joinDataModelNames.add(baseDataModel.getName());
orders.put(baseDataModel.getName(), 0L); 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()) { for (JoinRelation joinRelation : ontology.getJoinRelations()) {
if (joinDataModelNames.contains(joinRelation.getLeft()) if (joinDataModelNames.contains(joinRelation.getLeft())
&& joinDataModelNames.contains(joinRelation.getRight())) { && joinDataModelNames.contains(joinRelation.getRight())) {
orders.put(joinRelation.getLeft(), 0L); joinTables.add(joinRelation.getLeft());
orders.put(joinRelation.getRight(), 1L); joinTables.add(joinRelation.getRight());
} }
} }
orders.entrySet().stream().sorted(Map.Entry.comparingByValue()).forEach(d -> { for (String joinTable : joinTables) {
joinDataModels.add(ontology.getDataModelMap().get(d.getKey())); 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; return joinDataModels;
} }

View File

@@ -306,6 +306,16 @@ public class JoinRender extends Renderer {
r.getMiddle(), tableView.getAlias() + "." + r.getRight())) r.getMiddle(), tableView.getAlias() + "." + r.getRight()))
.collect(Collectors.toList())); .collect(Collectors.toList()));
matchJoinRelation.setJoinType(joinRelation.getJoinType()); 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());
} }
} }
} }

View File

@@ -64,6 +64,7 @@ const AgentsSection: React.FC<Props> = ({
}} }}
> >
<Switch <Switch
key={agent.id}
size="small" size="small"
defaultChecked={status === 1} defaultChecked={status === 1}
onChange={(value) => { onChange={(value) => {