package cn.iocoder.yudao.module.llm.service.http;


import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
import cn.iocoder.yudao.module.llm.framework.backend.config.LLMBackendProperties;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

/**
 * 模型对话相关接口
 */
@Service
public class DialogueHttpService {

    @Resource
    private LLMBackendProperties llmBackendProperties;

    /**
     * 登录 POST
     */
    public String login(Map<String, String> headers, String body){
        String login = llmBackendProperties.getLogin();
        String res = HttpUtils.post(login, headers, body);
        return res;
    }

    /**
     * 大模型列表 GET
     */
    public String modelsList(Map<String, String> headers){
        String modelsList = llmBackendProperties.getModelsList();
        String res = HttpUtils.get(modelsList, headers);
        return res;
    }

    /**
     * 基础模型列表 GET
     */
    public String baseModelList(Map<String, String> headers){
        String baseModelList = llmBackendProperties.getBaseModelList();
        String res = HttpUtils.get(baseModelList, headers);
        return res;
    }

    /**
     * 模型对话 POST
     */
    public String modelCompletions(Map<String, String> headers, String body){
        String finetuningCreate = llmBackendProperties.getModelCompletions();
        String res = HttpUtils.post(finetuningCreate, headers, body);
        return res;
    }
}
