Skip to content

Commit 7b23acd

Browse files
committed
fix FF14Prompt resolve FileSystemNotFoundException when reading classpath resources in JAR
1 parent 38549a8 commit 7b23acd

2 files changed

Lines changed: 21 additions & 24 deletions

File tree

.idea/workspace.xml

Lines changed: 20 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/com/phantoms/phantomsbackend/common/LLM/FF14Prompt.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ public static String getSystemPrompt() {
2424
if (SYSTEM_PROMPT == null) {
2525
try {
2626
ClassPathResource resource = new ClassPathResource("prompts/ff14-translator-prompt.md");
27-
Path path = Paths.get(resource.getURI());
28-
SYSTEM_PROMPT = Files.readString(path, StandardCharsets.UTF_8);
27+
SYSTEM_PROMPT = new String(resource.getInputStream().readAllBytes(), StandardCharsets.UTF_8);
2928
log.info("FF14翻译提示词加载成功,长度: {} 字符", SYSTEM_PROMPT.length());
3029
} catch (IOException e) {
3130
log.error("加载FF14翻译提示词失败", e);

0 commit comments

Comments
 (0)