secont commit

This commit is contained in:
Mohammad Zwaib
2026-07-07 20:10:24 +02:00
parent 2306b12def
commit 3b2d705e62
39 changed files with 2451 additions and 0 deletions
@@ -0,0 +1,36 @@
package com.homme.demo.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.GetMapping;
import com.homme.demo.dto.ProcessedWordFileResponseDto;
import com.homme.demo.service.HumbeeService;
@RestController("humbee")
public class HumbeeController {
@Autowired
private HumbeeService humbeeService;
@GetMapping("/word-links")
public List<ProcessedWordFileResponseDto> getWordLinks() throws Exception {
return humbeeService.getWordLinks();
}
}
@@ -0,0 +1,45 @@
package com.homme.demo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.homme.demo.dto.AskResponse;
import com.homme.demo.input.AskRequest;
import com.homme.demo.service.RagService;
@RestController
public class SearchController {
@Autowired
private RagService ragService;
@PostMapping("/ask")
public AskResponse ask(@RequestBody AskRequest request) {
String question = (request == null) ? null : request.getQuestion();
if (question == null || question.isBlank()) {
return AskResponse.builder()
.answer("Bitte stellen Sie eine Frage.")
.build();
}
return AskResponse.builder()
.answer(ragService.answerQuestion(question))
.build();
}
@GetMapping("/ask")
public AskResponse askGet(@RequestParam String question) {
return AskResponse.builder()
.answer(ragService.answerQuestion(question))
.build();
}
}
@@ -0,0 +1,76 @@
package com.homme.demo.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import com.homme.demo.service.AzureEmbeddingService;
import com.homme.demo.service.AzureMistralService;
import com.homme.demo.service.DocumentService;
import com.homme.demo.service.DocumentStorageService;
@RestController
public class TestController {
@Autowired
private AzureMistralService azureMistralService;
@Autowired
private AzureEmbeddingService azureEmbeddingService;
@Autowired
private DocumentStorageService docuemntStorageService;
@Autowired
private DocumentService documentService;
@GetMapping("/test-mistral")
public String testMistral() {
System.out.println("rrrrr");
try {
String antwort = azureMistralService.askMistral(
"du bist ein hilfreicher Assistent. ",
"Hallo, Weißt du, was Borsig11 ein gemeinnütziger Verein in der Dortmunder Nordstadt ist ?");
return "Ok : "+ antwort ;
}catch(Exception e) {
return "Fehler: "+e.getMessage();
}
}
@GetMapping("/test-embedding")
public String testEmbedding() {
System.out.println("test-embedding");
List<Double> embedding = azureEmbeddingService.createEmbedding("Hallo Ruhrgebiet");
return " Embedding length = "+ embedding.size();
}
@GetMapping("/fill-missing-embedding")
public int fillMissingEmbedding() {
return docuemntStorageService.fillMissingEmbedding();
}
@GetMapping("/getDocuemntRawClean/{id}")
public ResponseEntity<?> getDocuemntRawClean(@PathVariable int id){
System.out.println("rrrrrrr");
return documentService.getDocumentRawClean(id);
}
}