|
@@ -7,6 +7,7 @@ import lombok.SneakyThrows;
|
|
|
import org.apache.hc.client5.http.fluent.Request;
|
|
|
import org.apache.hc.core5.http.ContentType;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
@@ -18,7 +19,7 @@ public class ChatGptController {
|
|
|
|
|
|
@SneakyThrows
|
|
|
@RequestMapping("completions")
|
|
|
- public String completions(CompletionsRequestDto dto) {
|
|
|
+ public String completions(@RequestBody CompletionsRequestDto dto) {
|
|
|
var paramsDto = new CompletionsParamsDto(dto.getPrompt());
|
|
|
var response = Request.post("https://api.openai.com/v1/completions")
|
|
|
.setHeader("Authorization", "Bearer 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")
|