mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-30 13:04:27 +08:00
Compare commits
1 Commits
463b7eee81
...
b883831a17
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b883831a17 |
2
.github/workflows/centos-ci.yml
vendored
2
.github/workflows/centos-ci.yml
vendored
@@ -15,7 +15,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/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;
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ 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);
|
||||||
|
|||||||
@@ -9,13 +9,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;
|
||||||
|
|||||||
@@ -14,18 +14,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() {
|
||||||
|
|
||||||
boolean enabled = authenticationConfig.isEnabled();
|
|
||||||
if (!enabled) {
|
|
||||||
for (UserStrategy userStrategy : userStrategyList) {
|
for (UserStrategy userStrategy : userStrategyList) {
|
||||||
if (userStrategy.accept(authenticationConfig.isEnabled())) {
|
if (userStrategy.accept(authenticationConfig.isEnabled())) {
|
||||||
UserHolder.setStrategy(userStrategy);
|
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;
|
||||||
|
|||||||
@@ -3,15 +3,11 @@ 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不可为空")
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user