diff --git a/adi-common/src/main/java/com/moyz/adi/common/helper/ImageModelContext.java b/adi-common/src/main/java/com/moyz/adi/common/helper/ImageModelContext.java index d4c3108..f27c00c 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/helper/ImageModelContext.java +++ b/adi-common/src/main/java/com/moyz/adi/common/helper/ImageModelContext.java @@ -37,11 +37,14 @@ public class ImageModelContext { } public static void addImageModelService(AbstractImageModelService modelService) { + AiModel aiModel = modelService.getAiModel(); ImageModelInfo imageModelInfo = new ImageModelInfo(); + imageModelInfo.setModelId(aiModel.getId()); imageModelInfo.setModelService(modelService); - imageModelInfo.setModelName(modelService.getAiModel().getName()); + imageModelInfo.setModelName(aiModel.getName()); + imageModelInfo.setModelPlatform(aiModel.getPlatform()); imageModelInfo.setEnable(modelService.isEnabled()); - NAME_TO_MODEL.put(modelService.getAiModel().getName(), imageModelInfo); + NAME_TO_MODEL.put(aiModel.getName(), imageModelInfo); } public AbstractImageModelService getModelService() { diff --git a/adi-common/src/main/java/com/moyz/adi/common/helper/LLMContext.java b/adi-common/src/main/java/com/moyz/adi/common/helper/LLMContext.java index f0168d7..0ad250d 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/helper/LLMContext.java +++ b/adi-common/src/main/java/com/moyz/adi/common/helper/LLMContext.java @@ -2,13 +2,9 @@ package com.moyz.adi.common.helper; import com.moyz.adi.common.entity.AiModel; import com.moyz.adi.common.interfaces.AbstractLLMService; -import com.moyz.adi.common.util.JsonUtil; -import com.moyz.adi.common.util.LocalCache; -import com.moyz.adi.common.vo.CommonAiPlatformSetting; import com.moyz.adi.common.vo.LLMModelInfo; import lombok.extern.slf4j.Slf4j; -import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; @@ -36,8 +32,11 @@ public class LLMContext { } public static void addLLMService(AbstractLLMService llmService) { + AiModel aiModel = llmService.getAiModel(); LLMModelInfo llmModelInfo = new LLMModelInfo(); - llmModelInfo.setModelName(llmService.getAiModel().getName()); + llmModelInfo.setModelId(aiModel.getId()); + llmModelInfo.setModelName(aiModel.getName()); + llmModelInfo.setModelPlatform(aiModel.getPlatform()); llmModelInfo.setEnable(llmService.isEnabled()); llmModelInfo.setLlmService(llmService); NAME_TO_MODEL.put(llmService.getAiModel().getName(), llmModelInfo); @@ -46,10 +45,4 @@ public class LLMContext { public AbstractLLMService getLLMService() { return llmService; } - - public static String[] getSupportModels(String settingName) { - String st = LocalCache.CONFIGS.get(settingName); - CommonAiPlatformSetting setting = JsonUtil.fromJson(st, CommonAiPlatformSetting.class); - return setting.getModels(); - } } diff --git a/adi-common/src/main/java/com/moyz/adi/common/vo/ModelInfo.java b/adi-common/src/main/java/com/moyz/adi/common/vo/ModelInfo.java index cce403d..a3b5957 100644 --- a/adi-common/src/main/java/com/moyz/adi/common/vo/ModelInfo.java +++ b/adi-common/src/main/java/com/moyz/adi/common/vo/ModelInfo.java @@ -4,6 +4,8 @@ import lombok.Data; @Data public class ModelInfo { + private Long modelId; private String modelName; private Boolean enable; + private String modelPlatform; }