Skip to content

Commit

Permalink
Merge pull request #38 from WSE-research/bugfixFileReading
Browse files Browse the repository at this point in the history
Bugfix file reading
  • Loading branch information
dschiese authored May 27, 2024
2 parents bb02f53 + 9366e28 commit 91067bd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.wse</groupId>
<artifactId>qanary-explanation-service</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<name>Qanary explanation service</name>
<description>Webservice for rule-based explanation of QA-Systems as well as specific components</description>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion service_config/files/.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SPARQL_ENDPOINT=http://demos.swe.htwk-leipzig.de:40111/sparql
QANARY_PIPELINE_HOST=http://demos.swe.htwk-leipzig.de
QANARY_PIPELINE_HOST=demos.swe.htwk-leipzig.de
QANARY_PIPELINE_PORT=40111
VIRTUOSO_TRIPLESTORE_ENDPOINT=jdbc:virtuoso://demos.swe.htwk-leipzig.de:40142
VIRTUOSO_TRIPLESTORE_USERNAME=readWrite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@
import com.wse.qanaryexplanationservice.helper.pojos.InputQueryExample;
import com.wse.qanaryexplanationservice.helper.pojos.QanaryComponent;
import com.wse.qanaryexplanationservice.repositories.GenerativeExplanationsRepository;
import eu.wdaqua.qanary.commons.triplestoreconnectors.QanaryTripleStoreConnector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -175,8 +173,7 @@ public String createPrompt(int shots, GenerativeExplanationObject generativeExpl
}

public String getStringFromFile(String path) throws IOException {
File file = new ClassPathResource(path).getFile();
return new String(Files.readAllBytes(file.toPath()));
return QanaryTripleStoreConnector.readFileFromResources(path);
}

public String sendPrompt(String prompt, GptModel gptModel) throws Exception {
Expand Down

0 comments on commit 91067bd

Please sign in to comment.