package org.hzhub.service.chat.impl.provider;

import dev.langchain4j.community.model.zhipu.ZhipuAiStreamingChatModel;
import dev.langchain4j.model.chat.StreamingChatModel;
import lombok.extern.slf4j.Slf4j;
import org.hzhub.common.chat.domain.dto.request.ChatRequest;
import org.hzhub.common.chat.domain.vo.chat.ChatModelVo;
import org.hzhub.enums.ChatModeType;
import org.hzhub.service.chat.AbstractChatService;
import org.springframework.stereotype.Service;


/**
 * 智谱AI服务调用
 *
 * @author zengxb
 * @date 2026/02/26
 */
@Service
@Slf4j
public class ZhiPuChatServiceImpl implements AbstractChatService {

    @Override
    public StreamingChatModel buildStreamingChatModel(ChatModelVo chatModelVo, ChatRequest chatRequest) {
        return ZhipuAiStreamingChatModel.builder()
            .apiKey(chatModelVo.getApiKey())
            .model(chatModelVo.getModelName())
            .build();
    }

    @Override
    public String getProviderName() {
        return ChatModeType.ZHI_PU.getCode();
    }
}
