mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 17:21:53 +08:00
【新增】AI:聊天对话的更新模型
This commit is contained in:
parent
c5aab1aebd
commit
20657ccaf3
@ -18,24 +18,21 @@ import java.util.List;
|
|||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
// TODO @芋艿:权限标识;
|
|
||||||
@Tag(name = "管理后台 - 聊天消息")
|
@Tag(name = "管理后台 - 聊天消息")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/ai/chat/message")
|
@RequestMapping("/ai/chat/message")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AiChatMessageController {
|
public class AiChatMessageController {
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AiChatService chatService;
|
private AiChatService chatService;
|
||||||
|
|
||||||
@Operation(summary = "发送消息(段式)", description = "一次性返回,响应较慢")
|
@Operation(summary = "发送消息(段式)", description = "一次性返回,响应较慢")
|
||||||
@PostMapping("/send")
|
@PostMapping("/send")
|
||||||
public CommonResult<AiChatMessageRespVO> sendMessage(@Validated @RequestBody AiChatMessageSendReqVO sendReqVO) {
|
public CommonResult<AiChatMessageRespVO> sendMessage(@Validated @RequestBody AiChatMessageSendReqVO sendReqVO) {
|
||||||
// TODO done @fan:使用 static import;这样就 success 就行了;
|
|
||||||
return success(chatService.chat(sendReqVO));
|
return success(chatService.chat(sendReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO @芋艿:调用这个方法异常,Unable to handle the Spring Security Exception because the response is already committed.;可以再试试
|
|
||||||
// TODO @fan:要不要使用 Flux 来返回;可以使用 Flux<AiChatMessageRespVO>
|
|
||||||
@Operation(summary = "发送消息(流式)", description = "流式返回,响应较快")
|
@Operation(summary = "发送消息(流式)", description = "流式返回,响应较快")
|
||||||
@PostMapping(value = "/send-stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
@PostMapping(value = "/send-stream", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||||
@PermitAll // 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题
|
@PermitAll // 解决 SSE 最终响应的时候,会被 Access Denied 拦截的问题
|
||||||
|
@ -32,11 +32,15 @@ public class AiChatConversationRespVO implements VO {
|
|||||||
private Long roleId;
|
private Long roleId;
|
||||||
|
|
||||||
@Schema(description = "模型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "模型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@Trans(type = TransType.SIMPLE, target = AiChatModelDO.class, fields = "name", ref = "modelName")
|
||||||
private Long modelId;
|
private Long modelId;
|
||||||
|
|
||||||
@Schema(description = "模型标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "ERNIE-Bot-turbo-0922")
|
@Schema(description = "模型标志", requiredMode = Schema.RequiredMode.REQUIRED, example = "ERNIE-Bot-turbo-0922")
|
||||||
private String model;
|
private String model;
|
||||||
|
|
||||||
|
@Schema(description = "模型名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
private String modelName;
|
||||||
|
|
||||||
@Schema(description = "角色设定", example = "一个快乐的程序员")
|
@Schema(description = "角色设定", example = "一个快乐的程序员")
|
||||||
private String systemMessage;
|
private String systemMessage;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user