|
@@ -5,6 +5,7 @@ import com.sxtvs.api.chatgpt.dto.CompletionsParamsDto;
|
|
|
import com.sxtvs.api.chatgpt.dto.CompletionsRequestDto;
|
|
|
import com.sxtvs.api.chatgpt.dto.CompletionsResponseDto;
|
|
|
import com.sxtvs.api.chatgpt.dto.GptResponse;
|
|
|
+import com.sxtvs.core.sls.AliyunLogger;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.apache.hc.client5.http.fluent.Request;
|
|
|
import org.apache.hc.core5.http.ContentType;
|
|
@@ -21,6 +22,9 @@ public class ChatGptController {
|
|
|
@Autowired
|
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AliyunLogger logger;
|
|
|
+
|
|
|
@SneakyThrows
|
|
|
@RequestMapping("completions")
|
|
|
public CompletionsResponseDto completions(@RequestBody CompletionsRequestDto dto) {
|
|
@@ -35,6 +39,7 @@ public class ChatGptController {
|
|
|
var completionsResponseDto = new CompletionsResponseDto();
|
|
|
var text = gptResponse.getChoices().stream().map(GptResponse.ChoicesDTO::getText).findFirst().orElse("").trim();
|
|
|
completionsResponseDto.setResult(text);
|
|
|
+ logger.info("prompt",dto.getPrompt(),"result",text);
|
|
|
return completionsResponseDto;
|
|
|
}
|
|
|
|