refacotr code
This commit is contained in:
parent
e11157ec41
commit
095efe428a
|
|
@ -26,6 +26,7 @@ import org.springframework.ai.chat.client.ChatClient;
|
||||||
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
|
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
|
||||||
import org.springframework.ai.chat.client.advisor.QuestionAnswerAdvisor;
|
import org.springframework.ai.chat.client.advisor.QuestionAnswerAdvisor;
|
||||||
import org.springframework.ai.chat.messages.UserMessage;
|
import org.springframework.ai.chat.messages.UserMessage;
|
||||||
|
import org.springframework.ai.chat.model.ChatResponse;
|
||||||
import org.springframework.ai.chat.prompt.Prompt;
|
import org.springframework.ai.chat.prompt.Prompt;
|
||||||
import org.springframework.ai.document.Document;
|
import org.springframework.ai.document.Document;
|
||||||
import org.springframework.ai.document.DocumentReader;
|
import org.springframework.ai.document.DocumentReader;
|
||||||
|
|
@ -35,7 +36,6 @@ import org.springframework.ai.reader.TextReader;
|
||||||
import org.springframework.ai.reader.pdf.PagePdfDocumentReader;
|
import org.springframework.ai.reader.pdf.PagePdfDocumentReader;
|
||||||
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
|
import org.springframework.ai.transformer.splitter.TokenTextSplitter;
|
||||||
import org.springframework.ai.vectorstore.VectorStore;
|
import org.springframework.ai.vectorstore.VectorStore;
|
||||||
import org.springframework.ai.chat.model.ChatResponse;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
@ -52,29 +52,22 @@ import java.util.stream.Collectors;
|
||||||
@Service
|
@Service
|
||||||
public class ChatService {
|
public class ChatService {
|
||||||
|
|
||||||
|
private static final List<String> ALLOWS_FILE_TYPES = List.of("doc", "docx", "txt", "csv", "xls", "xlsx", "pdf", "ppt", "pptx");
|
||||||
@Resource
|
@Resource
|
||||||
private VectorStore vectorStore;
|
private VectorStore vectorStore;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private OllamaChatModel model;
|
private OllamaChatModel model;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private MessageChatMemoryAdvisor messageChatMemoryAdvisor;
|
private MessageChatMemoryAdvisor messageChatMemoryAdvisor;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private QuestionAnswerAdvisor questionAnswerAdvisor;
|
private QuestionAnswerAdvisor questionAnswerAdvisor;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AiFileUploadRecordMapper aiFileUploadRecordMapper;
|
private AiFileUploadRecordMapper aiFileUploadRecordMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AiQuestionRecordMapper aiQuestionRecordMapper;
|
private AiQuestionRecordMapper aiQuestionRecordMapper;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ElePropertyConfig elePropertyConfig;
|
private ElePropertyConfig elePropertyConfig;
|
||||||
|
|
||||||
private static final List<String> ALLOWS_FILE_TYPES = List.of("doc", "docx", "txt", "csv", "xls", "xlsx", "pdf", "ppt", "pptx");
|
|
||||||
|
|
||||||
public ElectromagneticResult<?> deleteDocument(List<String> ids) {
|
public ElectromagneticResult<?> deleteDocument(List<String> ids) {
|
||||||
List<String> vectorIds = aiFileUploadRecordMapper.selectList(Wrappers.lambdaQuery(AiFileUploadRecord.class)
|
List<String> vectorIds = aiFileUploadRecordMapper.selectList(Wrappers.lambdaQuery(AiFileUploadRecord.class)
|
||||||
.in(AiFileUploadRecord::getId, ids))
|
.in(AiFileUploadRecord::getId, ids))
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,6 @@ import com.electromagnetic.industry.software.manage.service.FileFormatService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFormat> implements FileFormatService {
|
public class FileFormatServiceImpl extends ServiceImpl<FileFormatMapper, FileFormat> implements FileFormatService {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ spring.datasource.username=em_user_dev
|
||||||
spring.datasource.password=Szsd#2O25$dev
|
spring.datasource.password=Szsd#2O25$dev
|
||||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|
||||||
# es
|
# es
|
||||||
spring.elasticsearch.password=123456
|
spring.elasticsearch.password=123456
|
||||||
spring.elasticsearch.username=elastic
|
spring.elasticsearch.username=elastic
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue