refactor(knowledge): 重构大模型配置
Spring AI默认大模型配置不支持同时配置两个文本大模型,比如一个文本大模型和一个图像大模型,改用自定义的配置
This commit is contained in:
@@ -32,6 +32,13 @@
|
||||
<hutool.version>5.8.27</hutool.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- 当前项目依赖 -->
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-model-openai</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-model-deepseek</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-starter-vector-store-qdrant</artifactId>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.configuration;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250527
|
||||
*/
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "file-store")
|
||||
public class FileStoreConfiguration {
|
||||
private String downloadPrefix;
|
||||
private String uploadPath;
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.configuration;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250527
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "knowledge")
|
||||
public class KnowledgeConfiguration {
|
||||
private String downloadPrefix;
|
||||
private String uploadPath;
|
||||
|
||||
public String getDownloadPrefix() {
|
||||
return downloadPrefix;
|
||||
}
|
||||
|
||||
public void setDownloadPrefix(String downloadPrefix) {
|
||||
this.downloadPrefix = downloadPrefix;
|
||||
}
|
||||
|
||||
public String getUploadPath() {
|
||||
return uploadPath;
|
||||
}
|
||||
|
||||
public void setUploadPath(String uploadPath) {
|
||||
this.uploadPath = uploadPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KnowledgeConfiguration{" +
|
||||
"downloadPrefix='" + downloadPrefix + '\'' +
|
||||
", uploadPath='" + uploadPath + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.configuration;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import java.time.Duration;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.noear.solon.ai.reranking.RerankingModel;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.ai.deepseek.DeepSeekChatModel;
|
||||
import org.springframework.ai.deepseek.DeepSeekChatOptions;
|
||||
import org.springframework.ai.deepseek.api.DeepSeekApi;
|
||||
import org.springframework.ai.document.MetadataMode;
|
||||
import org.springframework.ai.embedding.EmbeddingModel;
|
||||
import org.springframework.ai.openai.OpenAiChatModel;
|
||||
import org.springframework.ai.openai.OpenAiChatOptions;
|
||||
import org.springframework.ai.openai.OpenAiEmbeddingModel;
|
||||
import org.springframework.ai.openai.OpenAiEmbeddingOptions;
|
||||
import org.springframework.ai.openai.api.OpenAiApi;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestClient;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
@Slf4j
|
||||
@Configuration
|
||||
public class LlmConfiguration {
|
||||
@Bean("chat")
|
||||
public ChatClient.Builder chatClientBuilder(LlmProperties llmProperties, WebClient.Builder webClientBuilder, RestClient.Builder restClientBuilder) {
|
||||
Assert.notNull(llmProperties.getChat(), "chat properties is null");
|
||||
DeepSeekApi.Builder apiBuilder = DeepSeekApi.builder()
|
||||
.baseUrl(StrUtil.firstNonBlank(llmProperties.getChat().getBaseUrl(), llmProperties.getBaseUrl()))
|
||||
.apiKey(StrUtil.firstNonBlank(llmProperties.getChat().getApiKey(), llmProperties.getApiKey()))
|
||||
.webClientBuilder(webClientBuilder)
|
||||
.restClientBuilder(restClientBuilder);
|
||||
if (StrUtil.isNotBlank(llmProperties.getChat().getEndpoint())) {
|
||||
apiBuilder.completionsPath(llmProperties.getChat().getEndpoint());
|
||||
}
|
||||
return ChatClient.builder(
|
||||
DeepSeekChatModel.builder()
|
||||
.deepSeekApi(apiBuilder.build())
|
||||
.defaultOptions(
|
||||
DeepSeekChatOptions.builder()
|
||||
.model(llmProperties.getChat().getModel())
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Bean("visual")
|
||||
public ChatClient.Builder visualClientBuilder(LlmProperties llmProperties, WebClient.Builder webClientBuilder, RestClient.Builder restClientBuilder) {
|
||||
Assert.notNull(llmProperties.getVisual(), "visual properties is null");
|
||||
OpenAiApi.Builder apiBuilder = OpenAiApi.builder()
|
||||
.baseUrl(StrUtil.firstNonBlank(llmProperties.getVisual().getBaseUrl(), llmProperties.getBaseUrl()))
|
||||
.apiKey(StrUtil.firstNonBlank(llmProperties.getVisual().getApiKey(), llmProperties.getApiKey()))
|
||||
.webClientBuilder(webClientBuilder)
|
||||
.restClientBuilder(restClientBuilder);
|
||||
if (StrUtil.isNotBlank(llmProperties.getVisual().getEndpoint())) {
|
||||
apiBuilder.completionsPath(llmProperties.getVisual().getEndpoint());
|
||||
}
|
||||
return ChatClient.builder(
|
||||
OpenAiChatModel.builder()
|
||||
.openAiApi(apiBuilder.build())
|
||||
.defaultOptions(
|
||||
OpenAiChatOptions.builder()
|
||||
.model(llmProperties.getChat().getModel())
|
||||
.build()
|
||||
)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EmbeddingModel embeddingModel(LlmProperties llmProperties, WebClient.Builder webClientBuilder, RestClient.Builder restClientBuilder) {
|
||||
Assert.notNull(llmProperties.getEmbedding(), "embedding properties is null");
|
||||
OpenAiApi.Builder apiBuilder = OpenAiApi.builder()
|
||||
.baseUrl(StrUtil.firstNonBlank(llmProperties.getEmbedding().getBaseUrl(), llmProperties.getBaseUrl()))
|
||||
.apiKey(StrUtil.firstNonBlank(llmProperties.getEmbedding().getApiKey(), llmProperties.getApiKey()))
|
||||
.webClientBuilder(webClientBuilder)
|
||||
.restClientBuilder(restClientBuilder);
|
||||
if (StrUtil.isNotBlank(llmProperties.getEmbedding().getEndpoint())) {
|
||||
apiBuilder.embeddingsPath(llmProperties.getEmbedding().getEndpoint());
|
||||
}
|
||||
return new OpenAiEmbeddingModel(
|
||||
apiBuilder.build(),
|
||||
MetadataMode.EMBED,
|
||||
OpenAiEmbeddingOptions.builder()
|
||||
.model(llmProperties.getEmbedding().getModel())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RerankingModel rerankingModel(LlmProperties llmProperties) {
|
||||
Assert.notNull(llmProperties.getReranker(), "reranker properties is null");
|
||||
String url = llmProperties.getBaseUrl();
|
||||
if (StrUtil.isNotBlank(llmProperties.getReranker().getBaseUrl())) {
|
||||
url = llmProperties.getReranker().getBaseUrl();
|
||||
}
|
||||
if (StrUtil.isNotBlank(llmProperties.getReranker().getEndpoint())) {
|
||||
url += llmProperties.getReranker().getEndpoint();
|
||||
} else {
|
||||
url += "/v1/rerank";
|
||||
}
|
||||
return RerankingModel.of(url)
|
||||
.apiKey(StrUtil.firstNonBlank(llmProperties.getReranker().getApiKey(), llmProperties.getApiKey()))
|
||||
.model(llmProperties.getReranker().getModel())
|
||||
.timeout(Duration.ofMinutes(10))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.configuration;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Data
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "spring.llm")
|
||||
public class LlmProperties {
|
||||
private String baseUrl;
|
||||
private String apiKey;
|
||||
private ChatProperties chat;
|
||||
private ChatProperties visual;
|
||||
private ChatProperties embedding;
|
||||
private ChatProperties reranker;
|
||||
|
||||
@Data
|
||||
public static class ChatProperties {
|
||||
private String baseUrl;
|
||||
private String apiKey;
|
||||
private String model;
|
||||
private String endpoint;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.configuration;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import org.noear.solon.ai.reranking.RerankingModel;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250604
|
||||
*/
|
||||
@Configuration
|
||||
public class SolonConfiguration {
|
||||
@Bean
|
||||
public RerankingModel rerankingModel(SolonProperties solonProperties) {
|
||||
return RerankingModel.of(StrUtil.format("{}{}", solonProperties.getBaseUrl(), solonProperties.getRerank().getEndpoint()))
|
||||
.apiKey(solonProperties.getApiKey())
|
||||
.model(solonProperties.getRerank().getModel())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.configuration;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250604
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "solon")
|
||||
public class SolonProperties {
|
||||
private String baseUrl;
|
||||
private String apiKey;
|
||||
private Rerank rerank;
|
||||
|
||||
public String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void setBaseUrl(String baseUrl) {
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
public String getApiKey() {
|
||||
return apiKey;
|
||||
}
|
||||
|
||||
public void setApiKey(String apiKey) {
|
||||
this.apiKey = apiKey;
|
||||
}
|
||||
|
||||
public Rerank getRerank() {
|
||||
return rerank;
|
||||
}
|
||||
|
||||
public void setRerank(Rerank rerank) {
|
||||
this.rerank = rerank;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SolonProperties{" +
|
||||
"baseUrl='" + baseUrl + '\'' +
|
||||
", apiKey='" + apiKey + '\'' +
|
||||
", rerank=" + rerank +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static final class Rerank {
|
||||
private String model;
|
||||
private String endpoint;
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Rerank{" +
|
||||
"model='" + model + '\'' +
|
||||
", endpoint='" + endpoint + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import cn.hutool.core.util.URLUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.configuration.KnowledgeConfiguration;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.configuration.FileStoreConfiguration;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.entity.vo.DataFileVO;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.DataFileService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
@@ -17,6 +17,10 @@ import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.channels.FileChannel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -35,22 +39,21 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
* @author lanyuanxiaoyao
|
||||
* @date 2024-11-21
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/upload")
|
||||
public class DataFileController {
|
||||
private static final Logger log = LoggerFactory.getLogger(DataFileController.class);
|
||||
|
||||
private final KnowledgeConfiguration knowledgeConfiguration;
|
||||
private final FileStoreConfiguration fileStoreConfiguration;
|
||||
private final DataFileService dataFileService;
|
||||
private final String uploadFolderPath;
|
||||
private final String cacheFolderPath;
|
||||
private final String sliceFolderPath;
|
||||
|
||||
public DataFileController(KnowledgeConfiguration knowledgeConfiguration, DataFileService dataFileService) {
|
||||
this.knowledgeConfiguration = knowledgeConfiguration;
|
||||
public DataFileController(FileStoreConfiguration fileStoreConfiguration, DataFileService dataFileService) {
|
||||
this.fileStoreConfiguration = fileStoreConfiguration;
|
||||
this.dataFileService = dataFileService;
|
||||
|
||||
this.uploadFolderPath = knowledgeConfiguration.getUploadPath();
|
||||
this.uploadFolderPath = fileStoreConfiguration.getUploadPath();
|
||||
this.cacheFolderPath = StrUtil.format("{}/cache", uploadFolderPath);
|
||||
this.sliceFolderPath = StrUtil.format("{}/slice", uploadFolderPath);
|
||||
}
|
||||
@@ -59,7 +62,7 @@ public class DataFileController {
|
||||
public AmisResponse<FinishResponse> upload(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
String filename = file.getOriginalFilename();
|
||||
Long id = dataFileService.initialDataFile(filename);
|
||||
String url = StrUtil.format("{}/upload/download/{}", knowledgeConfiguration.getDownloadPrefix(), id);
|
||||
String url = StrUtil.format("{}/upload/download/{}", fileStoreConfiguration.getDownloadPrefix(), id);
|
||||
byte[] bytes = file.getBytes();
|
||||
String originMd5 = SecureUtil.md5(new ByteArrayInputStream(bytes));
|
||||
File targetFile = new File(StrUtil.format("{}/{}", uploadFolderPath, originMd5));
|
||||
@@ -156,7 +159,7 @@ public class DataFileController {
|
||||
request.uploadId,
|
||||
request.filename,
|
||||
request.uploadId.toString(),
|
||||
StrUtil.format("{}/upload/download/{}", knowledgeConfiguration.getDownloadPrefix(), request.uploadId)
|
||||
StrUtil.format("{}/upload/download/{}", fileStoreConfiguration.getDownloadPrefix(), request.uploadId)
|
||||
));
|
||||
} else {
|
||||
throw new RuntimeException("合并文件失败");
|
||||
@@ -169,213 +172,48 @@ public class DataFileController {
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class StartRequest {
|
||||
private String name;
|
||||
private String filename;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartRequest{" +
|
||||
"name='" + name + '\'' +
|
||||
", filename='" + filename + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static final class StartResponse {
|
||||
private String uploadId;
|
||||
|
||||
public StartResponse() {
|
||||
}
|
||||
|
||||
public StartResponse(String uploadId) {
|
||||
this.uploadId = uploadId;
|
||||
}
|
||||
|
||||
public String getUploadId() {
|
||||
return uploadId;
|
||||
}
|
||||
|
||||
public void setUploadId(String uploadId) {
|
||||
this.uploadId = uploadId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartResponse{" +
|
||||
"uploadId='" + uploadId + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static final class SliceResponse {
|
||||
@JsonProperty("eTag")
|
||||
private String eTag;
|
||||
|
||||
public SliceResponse() {
|
||||
}
|
||||
|
||||
public SliceResponse(String eTag) {
|
||||
this.eTag = eTag;
|
||||
}
|
||||
|
||||
public String geteTag() {
|
||||
return eTag;
|
||||
}
|
||||
|
||||
public void seteTag(String eTag) {
|
||||
this.eTag = eTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SliceResponse{" +
|
||||
"eTag='" + eTag + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class FinishRequest {
|
||||
private String filename;
|
||||
private Long uploadId;
|
||||
private ImmutableList<Part> partList;
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public Long getUploadId() {
|
||||
return uploadId;
|
||||
}
|
||||
|
||||
public void setUploadId(Long uploadId) {
|
||||
this.uploadId = uploadId;
|
||||
}
|
||||
|
||||
public ImmutableList<Part> getPartList() {
|
||||
return partList;
|
||||
}
|
||||
|
||||
public void setPartList(ImmutableList<Part> partList) {
|
||||
this.partList = partList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FinishRequest{" +
|
||||
"filename='" + filename + '\'' +
|
||||
", uploadId=" + uploadId +
|
||||
", partList=" + partList +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Data
|
||||
public static final class Part {
|
||||
private Integer partNumber;
|
||||
@JsonProperty("eTag")
|
||||
private String eTag;
|
||||
|
||||
public Integer getPartNumber() {
|
||||
return partNumber;
|
||||
}
|
||||
|
||||
public void setPartNumber(Integer partNumber) {
|
||||
this.partNumber = partNumber;
|
||||
}
|
||||
|
||||
public String geteTag() {
|
||||
return eTag;
|
||||
}
|
||||
|
||||
public void seteTag(String eTag) {
|
||||
this.eTag = eTag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Part{" +
|
||||
"partNumber=" + partNumber +
|
||||
", eTag='" + eTag + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static final class FinishResponse {
|
||||
private Long id;
|
||||
private String filename;
|
||||
private String value;
|
||||
private String url;
|
||||
|
||||
public FinishResponse() {
|
||||
}
|
||||
|
||||
public FinishResponse(Long id, String filename, String value, String url) {
|
||||
this.id = id;
|
||||
this.filename = filename;
|
||||
this.value = value;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FinishResponse{" +
|
||||
"id=" + id +
|
||||
", filename='" + filename + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
", url='" + url + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge;
|
||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.GroupService;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -14,11 +15,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250528
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("knowledge/group")
|
||||
public class GroupController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(GroupController.class);
|
||||
|
||||
private final GroupService groupService;
|
||||
|
||||
public GroupController(GroupService groupService) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.lanyuanxiaoyao.service.ai.knowledge.service.EmbeddingService;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.KnowledgeBaseService;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.list.ImmutableList;
|
||||
import org.slf4j.Logger;
|
||||
@@ -23,11 +24,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250515
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("knowledge")
|
||||
public class KnowledgeBaseController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(KnowledgeBaseController.class);
|
||||
|
||||
private final KnowledgeBaseService knowledgeBaseService;
|
||||
private final EmbeddingService embeddingService;
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.lanyuanxiaoyao.service.ai.knowledge.controller.knowledge;
|
||||
import com.lanyuanxiaoyao.service.ai.core.entity.amis.AmisResponse;
|
||||
import com.lanyuanxiaoyao.service.ai.knowledge.service.knowledge.SegmentService;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -14,11 +15,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250528
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("knowledge/segment")
|
||||
public class SegmentController {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SegmentController.class);
|
||||
|
||||
private final SegmentService segmentService;
|
||||
|
||||
public SegmentController(SegmentService segmentService) {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.lanyuanxiaoyao.service.ai.knowledge.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.eclipse.collections.api.factory.Lists;
|
||||
import org.eclipse.collections.api.factory.Maps;
|
||||
import org.springframework.ai.document.Document;
|
||||
@@ -10,6 +12,8 @@ import org.springframework.ai.document.Document;
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250523
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
public class EmbeddingContext {
|
||||
private Long vectorSourceId;
|
||||
private Long groupId;
|
||||
@@ -17,186 +21,19 @@ public class EmbeddingContext {
|
||||
private String content;
|
||||
private String file;
|
||||
private String fileFormat;
|
||||
@Builder.Default
|
||||
private List<Document> documents = Lists.mutable.empty();
|
||||
@Builder.Default
|
||||
private Map<String, Object> metadata = Maps.mutable.empty();
|
||||
|
||||
private EmbeddingContext(Builder builder) {
|
||||
setVectorSourceId(builder.vectorSourceId);
|
||||
setGroupId(builder.groupId);
|
||||
setConfig(builder.config);
|
||||
setContent(builder.content);
|
||||
setFile(builder.file);
|
||||
setFileFormat(builder.fileFormat);
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
|
||||
public Long getVectorSourceId() {
|
||||
return vectorSourceId;
|
||||
}
|
||||
|
||||
public void setVectorSourceId(Long vectorSourceId) {
|
||||
this.vectorSourceId = vectorSourceId;
|
||||
}
|
||||
|
||||
public Config getConfig() {
|
||||
return config;
|
||||
}
|
||||
|
||||
public void setConfig(Config config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getFileFormat() {
|
||||
return fileFormat;
|
||||
}
|
||||
|
||||
public void setFileFormat(String fileFormat) {
|
||||
this.fileFormat = fileFormat;
|
||||
}
|
||||
|
||||
public List<Document> getDocuments() {
|
||||
return documents;
|
||||
}
|
||||
|
||||
public void setDocuments(List<Document> documents) {
|
||||
this.documents = documents;
|
||||
}
|
||||
|
||||
public Map<String, Object> getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public void setMetadata(Map<String, Object> metadata) {
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EmbeddingContext{" +
|
||||
"vectorSourceId=" + vectorSourceId +
|
||||
", groupId=" + groupId +
|
||||
", config=" + config +
|
||||
", content='" + content + '\'' +
|
||||
", file='" + file + '\'' +
|
||||
", fileFormat='" + fileFormat + '\'' +
|
||||
", documents=" + documents +
|
||||
", metadata=" + metadata +
|
||||
'}';
|
||||
}
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public static final class Config {
|
||||
@Builder.Default
|
||||
private SplitStrategy splitStrategy = SplitStrategy.NORMAL;
|
||||
|
||||
private Config(Builder builder) {setSplitStrategy(builder.splitStrategy);}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public SplitStrategy getSplitStrategy() {
|
||||
return splitStrategy;
|
||||
}
|
||||
|
||||
public void setSplitStrategy(SplitStrategy splitStrategy) {
|
||||
this.splitStrategy = splitStrategy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Config{" +
|
||||
"splitStrategy=" + splitStrategy +
|
||||
'}';
|
||||
}
|
||||
|
||||
public enum SplitStrategy {
|
||||
NORMAL, LLM, QA
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private SplitStrategy splitStrategy;
|
||||
|
||||
private Builder() {}
|
||||
|
||||
public Builder splitStrategy(SplitStrategy val) {
|
||||
splitStrategy = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Config build() {
|
||||
return new Config(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private Long vectorSourceId;
|
||||
private Long groupId;
|
||||
private Config config;
|
||||
private String content;
|
||||
private String file;
|
||||
private String fileFormat;
|
||||
|
||||
private Builder() {}
|
||||
|
||||
public Builder vectorSourceId(Long val) {
|
||||
vectorSourceId = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder groupId(Long val) {
|
||||
groupId = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder config(Config val) {
|
||||
config = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder content(String val) {
|
||||
content = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder file(String val) {
|
||||
file = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder fileFormat(String val) {
|
||||
fileFormat = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EmbeddingContext build() {
|
||||
return new EmbeddingContext(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,64 +1,16 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250527
|
||||
*/
|
||||
@Data
|
||||
public class Group {
|
||||
private String id;
|
||||
private String name;
|
||||
private String status;
|
||||
private Long createdTime;
|
||||
private Long modifiedTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Long createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public Long getModifiedTime() {
|
||||
return modifiedTime;
|
||||
}
|
||||
|
||||
public void setModifiedTime(Long modifiedTime) {
|
||||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GroupVO{" +
|
||||
"id='" + id + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", status='" + status + '\'' +
|
||||
", createdTime=" + createdTime +
|
||||
", modifiedTime=" + modifiedTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250522
|
||||
*/
|
||||
@Data
|
||||
public class Knowledge {
|
||||
private Long id;
|
||||
private Long vectorSourceId;
|
||||
@@ -11,64 +14,4 @@ public class Knowledge {
|
||||
private String strategy;
|
||||
private Long createdTime;
|
||||
private Long modifiedTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getVectorSourceId() {
|
||||
return vectorSourceId;
|
||||
}
|
||||
|
||||
public void setVectorSourceId(Long vectorSourceId) {
|
||||
this.vectorSourceId = vectorSourceId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStrategy() {
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public void setStrategy(String strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public Long getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Long createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public Long getModifiedTime() {
|
||||
return modifiedTime;
|
||||
}
|
||||
|
||||
public void setModifiedTime(Long modifiedTime) {
|
||||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Knowledge{" +
|
||||
"id=" + id +
|
||||
", vectorSourceId=" + vectorSourceId +
|
||||
", name='" + name + '\'' +
|
||||
", strategy='" + strategy + '\'' +
|
||||
", createdTime=" + createdTime +
|
||||
", modifiedTime=" + modifiedTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250527
|
||||
*/
|
||||
@Data
|
||||
public class DataFileVO {
|
||||
private String id;
|
||||
private String filename;
|
||||
@@ -11,64 +14,4 @@ public class DataFileVO {
|
||||
private String md5;
|
||||
private String path;
|
||||
private String type;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public Long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getMd5() {
|
||||
return md5;
|
||||
}
|
||||
|
||||
public void setMd5(String md5) {
|
||||
this.md5 = md5;
|
||||
}
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
}
|
||||
|
||||
public void setPath(String path) {
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DataFile{" +
|
||||
"id='" + id + '\'' +
|
||||
", filename='" + filename + '\'' +
|
||||
", size=" + size +
|
||||
", md5='" + md5 + '\'' +
|
||||
", path='" + path + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250516
|
||||
*/
|
||||
@Data
|
||||
public class KnowledgeVO {
|
||||
private String id;
|
||||
private String vectorSourceId;
|
||||
@@ -15,100 +18,4 @@ public class KnowledgeVO {
|
||||
private String status;
|
||||
private Long createdTime;
|
||||
private Long modifiedTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getVectorSourceId() {
|
||||
return vectorSourceId;
|
||||
}
|
||||
|
||||
public void setVectorSourceId(String vectorSourceId) {
|
||||
this.vectorSourceId = vectorSourceId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getStrategy() {
|
||||
return strategy;
|
||||
}
|
||||
|
||||
public void setStrategy(String strategy) {
|
||||
this.strategy = strategy;
|
||||
}
|
||||
|
||||
public Long getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(Long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public Long getPoints() {
|
||||
return points;
|
||||
}
|
||||
|
||||
public void setPoints(Long points) {
|
||||
this.points = points;
|
||||
}
|
||||
|
||||
public Long getSegments() {
|
||||
return segments;
|
||||
}
|
||||
|
||||
public void setSegments(Long segments) {
|
||||
this.segments = segments;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getCreatedTime() {
|
||||
return createdTime;
|
||||
}
|
||||
|
||||
public void setCreatedTime(Long createdTime) {
|
||||
this.createdTime = createdTime;
|
||||
}
|
||||
|
||||
public Long getModifiedTime() {
|
||||
return modifiedTime;
|
||||
}
|
||||
|
||||
public void setModifiedTime(Long modifiedTime) {
|
||||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "KnowledgeVO{" +
|
||||
"id='" + id + '\'' +
|
||||
", vectorSourceId='" + vectorSourceId + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
", strategy='" + strategy + '\'' +
|
||||
", size=" + size +
|
||||
", points=" + points +
|
||||
", segments=" + segments +
|
||||
", status='" + status + '\'' +
|
||||
", createdTime=" + createdTime +
|
||||
", modifiedTime=" + modifiedTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +1,13 @@
|
||||
package com.lanyuanxiaoyao.service.ai.knowledge.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lanyuanxiaoyao
|
||||
* @version 20250516
|
||||
*/
|
||||
@Data
|
||||
public class SegmentVO {
|
||||
private String id;
|
||||
private String text;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PointVO{" +
|
||||
"id='" + id + '\'' +
|
||||
", text='" + text + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
*/
|
||||
@Service
|
||||
public class DataFileService {
|
||||
private static final Logger log = LoggerFactory.getLogger(DataFileService.class);
|
||||
private static final String DATA_FILE_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_file";
|
||||
|
||||
private final JdbcTemplate template;
|
||||
|
||||
@@ -28,8 +28,6 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class EmbeddingService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmbeddingService.class);
|
||||
|
||||
private final DataFileService dataFileService;
|
||||
private final FlowExecutor executor;
|
||||
private final KnowledgeBaseService knowledgeBaseService;
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class GroupService {
|
||||
public static final String GROUP_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_group";
|
||||
private static final Logger logger = LoggerFactory.getLogger(GroupService.class);
|
||||
private static final RowMapper<Group> groupMapper = (rs, row) -> {
|
||||
Group vo = new Group();
|
||||
vo.setId(String.valueOf(rs.getLong(1)));
|
||||
|
||||
@@ -34,7 +34,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Service
|
||||
public class KnowledgeBaseService {
|
||||
public static final String KNOWLEDGE_TABLE_NAME = Constants.DATABASE_NAME + ".service_ai_knowledge";
|
||||
private static final Logger logger = LoggerFactory.getLogger(KnowledgeBaseService.class);
|
||||
private static final RowMapper<Knowledge> knowledgeMapper = (rs, row) -> {
|
||||
Knowledge knowledge = new Knowledge();
|
||||
knowledge.setId(rs.getLong(1));
|
||||
|
||||
@@ -21,8 +21,6 @@ import org.springframework.stereotype.Service;
|
||||
*/
|
||||
@Service
|
||||
public class SegmentService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(SegmentService.class);
|
||||
|
||||
private final KnowledgeBaseService knowledgeBaseService;
|
||||
private final QdrantClient client;
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.springframework.ai.reader.tika.TikaDocumentReader;
|
||||
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
|
||||
import org.springframework.ai.vectorstore.VectorStore;
|
||||
import org.springframework.ai.vectorstore.qdrant.QdrantVectorStore;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.core.io.PathResource;
|
||||
|
||||
/**
|
||||
@@ -45,7 +46,7 @@ public class EmbeddingNodes {
|
||||
private final QdrantClient qdrantClient;
|
||||
private final EmbeddingModel embeddingModel;
|
||||
|
||||
public EmbeddingNodes(ChatClient.Builder builder, VectorStore vectorStore, EmbeddingModel embeddingModel) {
|
||||
public EmbeddingNodes(@Qualifier("chat") ChatClient.Builder builder, VectorStore vectorStore, EmbeddingModel embeddingModel) {
|
||||
this.chatClient = builder.build();
|
||||
this.qdrantClient = (QdrantClient) vectorStore.getNativeClient().orElseThrow();
|
||||
this.embeddingModel = embeddingModel;
|
||||
|
||||
@@ -4,27 +4,32 @@ spring:
|
||||
profiles:
|
||||
include: random-port,common,discovery,metrics,forest
|
||||
ai:
|
||||
openai:
|
||||
base-url: http://132.121.206.65:10086
|
||||
api-key: ENC(K+Hff9QGC+fcyi510VIDd9CaeK/IN5WBJ9rlkUsHEdDgIidW+stHHJlsK0lLPUXXREha+ToQZqqDXJrqSE+GUKCXklFhelD8bRHFXBIeP/ZzT2cxhzgKUXgjw3S0Qw2R)
|
||||
chat:
|
||||
options:
|
||||
model: 'Qwen3/qwen3-1.7b'
|
||||
embedding:
|
||||
options:
|
||||
model: 'Qwen3/qwen3-embedding-4b'
|
||||
vectorstore:
|
||||
qdrant:
|
||||
host: 132.121.206.65
|
||||
port: 29463
|
||||
api-key: ENC(0/0UkIKeAvyV17yNqSU3v04wmm8CdWKe4BYSSJa2FuBtK12TcZRJPdwk+ZpYnpISv+KmVTUrrmFBzAYrDR3ysA==)
|
||||
llm:
|
||||
base-url: http://132.121.206.65:10086
|
||||
api-key: ENC(K+Hff9QGC+fcyi510VIDd9CaeK/IN5WBJ9rlkUsHEdDgIidW+stHHJlsK0lLPUXXREha+ToQZqqDXJrqSE+GUKCXklFhelD8bRHFXBIeP/ZzT2cxhzgKUXgjw3S0Qw2R)
|
||||
chat:
|
||||
model: 'Qwen3/qwen3-1.7b'
|
||||
visual:
|
||||
model: 'Qwen2.5/qwen2.5-vl-7b'
|
||||
embedding:
|
||||
model: 'Qwen3/qwen3-embedding-4b'
|
||||
reranker:
|
||||
model: 'Bge-reranker-v2'
|
||||
autoconfigure:
|
||||
exclude: |
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiChatAutoConfiguration,
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiAudioSpeechAutoConfiguration,
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiAudioTranscriptionAutoConfiguration,
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiImageAutoConfiguration,
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiEmbeddingAutoConfiguration,
|
||||
org.springframework.ai.model.openai.autoconfigure.OpenAiModerationAutoConfiguration,
|
||||
org.springframework.ai.model.deepseek.autoconfigure.DeepSeekChatAutoConfiguration
|
||||
liteflow:
|
||||
rule-source: config/flow.xml
|
||||
print-banner: false
|
||||
check-node-exists: false
|
||||
solon:
|
||||
base-url: http://132.121.206.65:10086
|
||||
api-key: ENC(K+Hff9QGC+fcyi510VIDd9CaeK/IN5WBJ9rlkUsHEdDgIidW+stHHJlsK0lLPUXXREha+ToQZqqDXJrqSE+GUKCXklFhelD8bRHFXBIeP/ZzT2cxhzgKUXgjw3S0Qw2R)
|
||||
rerank:
|
||||
model: 'Bge-reranker-v2-vllm'
|
||||
endpoint: '/v1/rerank'
|
||||
@@ -176,8 +176,8 @@ deploy:
|
||||
jdk: "jdk17"
|
||||
replicas: 1
|
||||
arguments:
|
||||
"[knowledge.download-prefix]": 'http://132.126.207.130:35690/hudi_services/ai_knowledge'
|
||||
"[knowledge.upload-path]": ${deploy.runtime.data-path}/knowledge
|
||||
"[file-store.download-prefix]": 'http://132.126.207.130:35690/hudi_services/ai_knowledge'
|
||||
"[file-store.upload-path]": ${deploy.runtime.data-path}/knowledge
|
||||
"[spring.datasource.url]": ${deploy.runtime.database.config.url}
|
||||
"[spring.datasource.username]": ${deploy.runtime.database.config.username}
|
||||
"[spring.datasource.password]": ${deploy.runtime.database.config.password}
|
||||
|
||||
Reference in New Issue
Block a user