add other format for vector

This commit is contained in:
2026-03-17 00:03:01 +01:00
parent 30e69ccbb3
commit 69349a8788
5 changed files with 17 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import org.springframework.ai.reader.tika.TikaDocumentReader;
import java.io.IOException;
import java.security.MessageDigest;
@@ -177,7 +178,13 @@ public class UserDocumentServiceImpl implements UserDocumentService {
}
};
List<Document> docs = new TextReader(resource).get();
List<Document> docs;
String ext = getExtensionOrTxt(filename);
if (ext.equals("txt")) {
docs = new TextReader(resource).get();
} else {
docs = new TikaDocumentReader(resource).get();
}
TokenTextSplitter splitter = TokenTextSplitter.builder()
.withChunkSize(chunkSize)

View File

@@ -24,6 +24,9 @@ spring.cloud.consul.discovery.deregister-critical-service-after=1m
management.endpoints.web.exposure.include=health,info
management.endpoint.health.show-details=always
spring.servlet.multipart.max-file-size=5MB
spring.servlet.multipart.max-request-size=10MB
spring.datasource.url=${SPRING_DATASOURCE_URL:jdbc:postgresql://localhost:5432/ragdb}
spring.datasource.username=${SPRING_DATASOURCE_USERNAME:postgres}
spring.datasource.password=${SPRING_DATASOURCE_PASSWORD:postgres}