package com.webchat.service.ai;

import com.webchat.domain.vo.llm.ChatCompletionMessage;
import com.webchat.domain.vo.llm.ChatCompletionResponse;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import java.util.List;

/**
 * @author 程序员王七七 https://www.coderutil.com 网站作者
 * @date 2024/10/29 22:47
 *
 * 抽象大模型对话服务
 */
public abstract class AbstractLLMChatService {

    /**
     * 同步对话
     *
     * @param messageList
     * @return
     * @throws Exception
     */
    protected abstract ChatCompletionResponse chat(List<ChatCompletionMessage> messageList) throws Exception;

    /**
     * 流式对话
     *
     * @param emitter
     * @param messageList
     * @return
     * @throws Exception
     */
    protected abstract void chat(SseEmitter emitter, List<ChatCompletionMessage> messageList) throws Exception;
}
