77 lines
1.9 KiB
Java
77 lines
1.9 KiB
Java
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);
|
|
|
|
|
|
}
|
|
|
|
}
|