zyx 2 năm trước cách đây
mục cha
commit
92475692dd

+ 2 - 1
src/main/java/com/sxtvs/api/chatgpt/controller/ChatGptController.java

@@ -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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")

+ 0 - 1
src/main/resources/application.properties

@@ -1,2 +1 @@
 
-server.port=8081