package tech.easyflow.ai.service;

import com.mybatisflex.core.service.IService;
import tech.easyflow.ai.entity.Model;
import tech.easyflow.ai.service.capability.ModelCapabilityResolution;

import java.math.BigInteger;
import java.util.List;
import java.util.Map;

/**
 *  服务层。
 *
 * @author michael
 * @since 2024-08-23
 */
public interface ModelService extends IService<Model> {

    boolean addAiLlm(Model entity);

    Map<String, Object> verifyModelConfig(Model llm);

    /**
     * 根据供应商和模型 ID 自动解析模型能力。
     *
     * @param providerId 供应商 ID
     * @param modelName 模型 ID
     * @return 模型能力识别结果
     */
    ModelCapabilityResolution resolveModelCapabilities(BigInteger providerId, String modelName);

    Map<String, Map<String, List<Model>>> getList(Model entity);

    void removeByEntity(Model entity);

    Model getModelInstance(BigInteger modelId);

    Model getModelInstanceByInvokeCode(String invokeCode);

    void validateForSaveOrUpdate(Model entity, boolean isSave);

    List<Model> listInvokeModels();

    List<Model> listSelectableModels(Model entity, Boolean asTree, String sortKey, String sortType);

    Model updateInvokeConfig(BigInteger id, String invokeCode, Boolean publishEnabled);

    List<Model> batchUpdateInvokePublishStatus(List<BigInteger> ids, Boolean publishEnabled);
}
