Commit 009914ed73f125a21f6e07793a53b53595b81b9d

Authored by cherishsince
1 parent a3530555

增加 swagger 注释

yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/controller/ChatController.java
... ... @@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.ai.chat.ChatResponse;
5 5 import cn.iocoder.yudao.framework.ai.chat.prompt.Prompt;
6 6 import cn.iocoder.yudao.framework.ai.config.AiClient;
7 7 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  8 +import io.swagger.v3.oas.annotations.Operation;
8 9 import io.swagger.v3.oas.annotations.tags.Tag;
9 10 import lombok.AllArgsConstructor;
10 11 import lombok.extern.slf4j.Slf4j;
... ... @@ -32,11 +33,10 @@ import java.util.function.Consumer;
32 33 @AllArgsConstructor
33 34 public class ChatController {
34 35  
35   -
36   -
37 36 @Autowired
38 37 private AiClient aiClient;
39 38  
  39 + @Operation(summary = "聊天-chat", description = "这个一般等待时间比较久,需要全部完成才会返回!")
40 40 @GetMapping("/chat")
41 41 public CommonResult<String> chat(@RequestParam("prompt") String prompt) {
42 42 ChatResponse callRes = aiClient.call(new Prompt(prompt), "qianWen");
... ... @@ -44,6 +44,7 @@ public class ChatController {
44 44 }
45 45  
46 46 // TODO @芋艿:调用这个方法异常,Unable to handle the Spring Security Exception because the response is already committed.
  47 + @Operation(summary = "聊天-stream", description = "这里跟通义千问一样采用的是 Server-Sent Events (SSE) 通讯模式")
47 48 @GetMapping(value = "/chatStream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
48 49 public SseEmitter chatStream(@RequestParam("prompt") String prompt) {
49 50 Utf8SseEmitter sseEmitter = new Utf8SseEmitter();
... ...