package org.jeecg.modules.adweb.gpt.service;

import org.jeecg.modules.adweb.gpt.vo.ChatHistoryVO;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

/**
 * AI助手聊天Service
 *
 * @author chenrui
 * @date 2024/1/26 20:08
 */
public interface ChatService {

    /** 创建SSE */
    SseEmitter createChat();

    /** 关闭SSE */
    void closeChat();

    /**
     * 客户端发送消息到服务端
     *
     * @param topicId
     * @param message
     * @author chenrui
     * @date 2024/1/26 20:01
     */
    void sendMessage(String topicId, String message);

    /**
     * 保存聊天记录
     *
     * @param chatHistoryVO
     * @return
     * @author chenrui
     * @date 2024/2/22 13:37
     */
    void saveHistory(ChatHistoryVO chatHistoryVO);

    /**
     * 查询聊天记录
     *
     * @return
     * @author chenrui
     * @date 2024/2/22 13:59
     */
    ChatHistoryVO getHistoryByTopic();
}
