add other format for vector
This commit is contained in:
@@ -137,6 +137,10 @@
|
||||
<groupId>org.springframework.kafka</groupId>
|
||||
<artifactId>spring-kafka</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-tika-document-reader</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -29,12 +29,9 @@ export const PREFIX_UPLOAD_STREAM = "/upload-stream";
|
||||
export const FORM_DATA_FILES = "files";
|
||||
export const TYPE_WINDOW_UNDEFINED = "undefined";
|
||||
export const TOKEN_UNDEFINED = "undefined";
|
||||
export const MAX_FILE_SIZE_KB = 10;
|
||||
export const MAX_FILE_SIZE_KB = 2048;
|
||||
export const MAX_FILES_TO_UPLOAD = 3;
|
||||
export const DEFAULT_ERROR_STATUS = 500;
|
||||
export const FULFILLED_BUT_NOT_SUCCESS_ERROR_STATUS = 999;
|
||||
export const UNKNOWN_ERROR_AFTER_FULFILLED_QUERY =
|
||||
"Unknown error after fulfilled query";
|
||||
export const UNKNOWN_ERROR = "Unknown error";
|
||||
export const STATUS_UNAUTHORIZED = "unauthorized";
|
||||
export const HTTP_STATUS_UNAUTHORIZED_CODE = 401;
|
||||
|
||||
@@ -28,7 +28,7 @@ const FileSelector = ({ disabled, onFilesChange }) => {
|
||||
<input
|
||||
ref={fileInputRef}
|
||||
type="file"
|
||||
accept=".txt"
|
||||
accept=".txt,.pdf,.docx,.doc,.md,.rtf,.html"
|
||||
multiple
|
||||
style={{ display: "none" }}
|
||||
onChange={onFilesChange}
|
||||
|
||||
Reference in New Issue
Block a user