update file upload 3

This commit is contained in:
Florinda
2025-02-04 18:16:52 +01:00
parent bf4633f8ac
commit c24f95f1de
2 changed files with 8 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Random;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -28,6 +30,8 @@ public class FileService {
private static final String UPLOAD_DIR = "C:\\mnt\\hermione_storage\\documents\\file_input_scenarios\\";
private Logger logger = LoggerFactory.getLogger(FileService.class);
@Value("${file.upload-dir}")
private String uploadDir;
@@ -38,6 +42,8 @@ public class FileService {
folder.mkdirs(); // Crea la cartella se non esiste
}
logger.info("path folder:", folder.getAbsolutePath().toString());
File emailFolder = new File(folder, "email");
if (!emailFolder.exists()) {
@@ -82,6 +88,7 @@ public class FileService {
return ResponseEntity.ok(folderName);
} catch (Exception e) {
logger.error("Error uploading files: {}", e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body("Error uploading files: " + e.getMessage());
}

View File

@@ -65,7 +65,7 @@ spring.ai.vectorstore.chroma.client.port=8000
spring.ai.vectorstore.chroma.client.key-token=tKAJfN1Yv5lP7pKorJHGfHMQhNEcM9uu
spring.ai.vectorstore.chroma.initialize-schema=true
spring.ai.vectorstore.chroma.collection-name=olympus
file.upload-dir=mnt/hermione_storage/documents/file_input_scenarios/
file.upload-dir=/mnt/hermione_storage/documents/file_input_scenarios/
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB