feat: 新增 ScriptChatController 统一流式接口
This commit is contained in:
@@ -124,8 +124,18 @@ public class MessageController {
|
|||||||
/**
|
/**
|
||||||
* 删除消息
|
* 删除消息
|
||||||
*/
|
*/
|
||||||
|
@Operation(summary = "删除消息", description = "删除指定的消息。")
|
||||||
|
@DeleteMapping(value = "/delete")
|
||||||
|
public Result<Void> delete(@Parameter(description = "消息 ID") @RequestParam String id) {
|
||||||
|
boolean deleted = messageService.deleteMessage(id);
|
||||||
|
if (!deleted) {
|
||||||
|
return Result.error("删除失败");
|
||||||
|
}
|
||||||
|
return Result.success();
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "删除版本消息", description = "删除指定的剧本版本消息,不能删除当前生效版本。")
|
@Operation(summary = "删除版本消息", description = "删除指定的剧本版本消息,不能删除当前生效版本。")
|
||||||
@DeleteMapping(value = "/version")
|
@DeleteMapping(value = "/deleteVersion")
|
||||||
public Result<Void> deleteVersion(@Parameter(description = "消息 ID") @RequestParam String id) {
|
public Result<Void> deleteVersion(@Parameter(description = "消息 ID") @RequestParam String id) {
|
||||||
boolean deleted = scriptMessageService.deleteVersion(id);
|
boolean deleted = scriptMessageService.deleteVersion(id);
|
||||||
if (!deleted) {
|
if (!deleted) {
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.emotion.controller;
|
||||||
|
|
||||||
|
import com.emotion.dto.request.ScriptChatStreamRequest;
|
||||||
|
import com.emotion.service.ScriptChatService;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剧本对话流式控制器
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/chat")
|
||||||
|
@Tag(name = "剧本对话", description = "剧本改写、续写、聊天的统一流式接口")
|
||||||
|
public class ScriptChatController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScriptChatService scriptChatService;
|
||||||
|
|
||||||
|
@Operation(summary = "流式对话", description = "统一的剧本改写/续写/聊天流式接口。")
|
||||||
|
@PostMapping(value = "/stream", produces = "text/event-stream")
|
||||||
|
public SseEmitter stream(@Valid @RequestBody ScriptChatStreamRequest request) {
|
||||||
|
return scriptChatService.streamChat(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user