Skip to content

Commit

Permalink
Revert "Merge pull request #3 from Marcel2511/revert-2-revert-1-p2t-w…
Browse files Browse the repository at this point in the history
…ebservice-BackendTestsLLM"

This reverts commit 0599fb2, reversing
changes made to 065daca.
  • Loading branch information
Marcel2511 committed Jun 3, 2024
1 parent 0599fb2 commit 0aa380b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ build/

### VS Code ###
.vscode/

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@
<id>spotless-check</id>
<phase>compile</phase>
<goals>
<goal>apply</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
32 changes: 0 additions & 32 deletions src/main/java/de/dhbw/woped/process2text/config/WebConfig.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.dhbw.woped.process2text.controller;

import de.dhbw.woped.process2text.service.P2TLLMService;
import de.dhbw.woped.process2text.service.P2TService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
Expand All @@ -9,42 +8,24 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(origins = "http://localhost:4200")
@RestController
@Slf4j
public class P2TController {

Logger logger = LoggerFactory.getLogger(P2TController.class);

@Autowired private P2TService p2tService;

@Autowired private P2TLLMService llmService;
@Autowired P2TService p2tService;

@ApiOperation(value = "Translate a process model into human readable text.")
@PostMapping(value = "/generateText", consumes = "text/plain", produces = "text/plain")
protected String generateText(@RequestBody String body) {
if (logger.isDebugEnabled()) {
logger.debug("Received body: " + body.replaceAll("[\n\r\t]", "_"));
if (logger
.isDebugEnabled()) { // required so that body.replaceAll is only invoked in case the body is
// logged
logger.debug(body.replaceAll("[\n\r\t]", "_"));
}
String response = p2tService.generateText(body);
logger.debug("Response: " + response);
return response;
}

@ApiOperation(
value =
"Translate a process model into human readable text using OpenAIs Large Language Model"
+ " GPT-4 Turbo.")
@PostMapping(value = "/generateTextLLM", consumes = "text/plain", produces = "text/plain")
protected String generateTextLLM(
@RequestBody String body,
@RequestParam(required = false) String apiKey,
@RequestParam(required = false) String prompt) {
if (logger.isDebugEnabled()) {
logger.debug("Received body: " + body.replaceAll("[\n\r\t]", "_"));
}
String response = llmService.callLLM(body, apiKey, prompt);
logger.debug("LLM Response: " + response);
return response;
return p2tService.generateText(body);
}
}

// TEST

This file was deleted.

0 comments on commit 0aa380b

Please sign in to comment.