流式输出,秒级,效果非常棒
This commit is contained in:
@@ -12,8 +12,10 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -62,6 +64,13 @@ public class AiQaItemController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/askAIStream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
@Operation(summary = "客户问答(大模型流式)", description = "流式返回大模型回答分片,流完成后自动落库")
|
||||
public Flux<String> askCustomerStream(
|
||||
@Parameter(description = "提问请求", required = true) @RequestBody AiQaCustomerAskRequestDto request) {
|
||||
return aiQaCustomerAskService.askCustomerStream(request);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增", description = "新增 AI 问答子表记录")
|
||||
public ResponseEntity<Map<String, Object>> add(
|
||||
|
||||
Reference in New Issue
Block a user