|
@@ -5,8 +5,10 @@ import com.sxtvs.open.api.chat.service.impl.KimiChatServiceImpl;
|
|
|
import com.sxtvs.open.api.review.service.impl.SSEService;
|
|
|
import com.sxtvs.open.core.advice.NoAPIResponse;
|
|
|
import com.sxtvs.open.core.auth.LoginRequired;
|
|
|
+import com.sxtvs.open.core.sls.AliyunLogger;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -22,13 +24,19 @@ public class SseController {
|
|
|
@Resource
|
|
|
private SSEService sseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private AliyunLogger logger;
|
|
|
+
|
|
|
@GetMapping(path = "/sse", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
|
|
@NoAPIResponse
|
|
|
public SseEmitter handleSse(@RequestParam("token") String token) throws IOException {
|
|
|
+ logger.debug("msg","1");
|
|
|
SseEmitter sseEmitter = new SseEmitter(0L); // 设置超时时间
|
|
|
+ logger.debug("msg","3");
|
|
|
sseService.monitor(token, sseEmitter);
|
|
|
+ logger.debug("msg","4");
|
|
|
sseEmitter.send(SseEmitter.event().name("hello").data("hello"));
|
|
|
-
|
|
|
+ logger.debug("msg","5");
|
|
|
return sseEmitter;
|
|
|
}
|
|
|
|