Thanks you use gpt4-copilot-java
\n" + + " \n" + + " \n" + + "\n" + + "\n", HttpStatus.OK); + } +} \ No newline at end of file diff --git a/src/main/java/com/gpt4/copilot/controller/chatController.java b/src/main/java/com/gpt4/copilot/controller/chatController.java new file mode 100644 index 0000000..a5822a7 --- /dev/null +++ b/src/main/java/com/gpt4/copilot/controller/chatController.java @@ -0,0 +1,1003 @@ +package com.gpt4.copilot.controller; + +import com.alibaba.fastjson2.JSON; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.gpt4.copilot.pojo.Result; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import lombok.extern.slf4j.Slf4j; +import okhttp3.*; +import org.apache.commons.lang.StringUtils; +import org.json.JSONException; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.*; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author Yangyang + * @create 2023-12-25 18:29 + */ + +@Slf4j +@RestController() +public class chatController { + /** + * 缓存cocopilotToken + */ + private static final HashMap