package com.easyproject.web.controller.chatAI;

import com.easyproject.system.service.chatAI.IChatAIService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

import javax.annotation.Resource;

/**
 * 方法说明: 聊天验证
 * @param 
 * @return 
 * @author java-101
 * @date 2025-03-12 23:18:21
 */
@RestController
@RequestMapping("/chat/checkChat")
public class ChatAIController {
    @Resource
    private IChatAIService chatAIService;

    /**
     * 方法说明: 发起消息-通过流式返回-coze平台
     * @param message 用户发送的消息内容
     * @param conversationId 会话ID
     * @return
     * @author java-101
     * @date 2025-03-12 23:22:33
     */
    @GetMapping(value = "/chatStream", produces = "text/event-stream;charset=UTF-8")
    public Flux<String> chatStream(@RequestParam String message,@RequestParam String conversationId) {
        return chatAIService.chatStream(message,conversationId);
    }
}
