Skip to content

Commit 1ac4e67

Browse files
committed
refactor(ChatGptService): use java.nio library for file checking
Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>
1 parent c522fdc commit 1ac4e67

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

application/src/main/java/org/togetherjava/tjbot/features/chatgpt/ChatGptService.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
import javax.annotation.Nullable;
2121

22-
import java.io.File;
22+
import java.nio.file.Files;
2323
import java.nio.file.Path;
2424
import java.time.Duration;
2525
import java.util.List;
@@ -141,8 +141,7 @@ public Optional<String> uploadFileIfNotExists(Path filePath, FilePurpose purpose
141141
return Optional.empty();
142142
}
143143

144-
File file = filePath.toFile();
145-
if (!file.exists()) {
144+
if (!Files.notExists(filePath)) {
146145
logger.warn("Could not find file '{}' to upload to ChatGPT", filePath);
147146
return Optional.empty();
148147
}

0 commit comments

Comments
 (0)