WordPress

This commit is contained in:
Mohammad Zwaib
2026-07-15 20:47:58 +02:00
parent d6153521ca
commit daf48f3f91
29 changed files with 1203 additions and 128 deletions
@@ -0,0 +1,48 @@
package com.homme.demo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.homme.demo.dto.AskResponse;
import com.homme.demo.service.RagService;
@CrossOrigin(origins = "${homme.cors.allowed-origins}")
@RestController
@RequestMapping("/chat")
public class ChatController {
@Autowired
private RagService ragService;
@PostMapping("/ask")
public AskResponse ask(@RequestParam String question) {
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();
}
}