[update] 停用基础模型校验应用

This commit is contained in:
Liuyang 2025-01-20 15:28:46 +08:00
parent 7d3af03f3e
commit 7d637ee57c
3 changed files with 21 additions and 14 deletions

View File

@ -91,4 +91,12 @@ public interface ApplicationService {
* @return 应用
*/
Map<Long, String> getApplicationByKnowledgeId (Long knowledgeId);
/**
* 根据 基础模型id 获取 应用
*
* @param baseModelId 基础模型id
* @return 应用
*/
Map<Long, String> getApplicationByBaseModelId (Long baseModelId);
}

View File

@ -301,7 +301,7 @@ public class ApplicationServiceImpl implements ApplicationService {
* @param condition 条件使用 BiFunction 接收 LambdaQueryWrapper 和参数并设置条件
* @param keyMapper ApplicationDO 对象映射为 Map 的键
* @param valueMapper ApplicationDO 对象映射为 Map 的值
* @param params 查询参数数组
* @param params 查询参数数组
* @return 应用的 Map 集合
*/
private Map<Long, String> getApplicationMap (BiFunction<LambdaQueryWrapper<ApplicationDO>, Object[], LambdaQueryWrapper<ApplicationDO>> condition,
@ -323,9 +323,8 @@ public class ApplicationServiceImpl implements ApplicationService {
if (CollectionUtils.isEmpty(applications)) {
return Collections.emptyMap();
}
List<Object> paramsList = Arrays.asList(params);
log.info("params: {}",paramsList );
log.info("params: {}", Arrays.asList(params));
return applications.stream().collect(Collectors.toMap(keyMapper, valueMapper));
}
@ -339,9 +338,9 @@ public class ApplicationServiceImpl implements ApplicationService {
@Override
public Map<Long, String> getApplicationByLabelId (Long labelId) {
return getApplicationMap((wrapper, params) -> {
Long id = (Long)params[0];
Long id = (Long) params[0];
return wrapper.select(ApplicationDO::getId, ApplicationDO::getAppName).eq(ApplicationDO::getAppLabel, id);
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[] {labelId});
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[]{labelId});
}
@ -355,9 +354,9 @@ public class ApplicationServiceImpl implements ApplicationService {
@Override
public Map<Long, String> validatePromptTemplateUsesInApp (Long templateId) {
return getApplicationMap((wrapper, params) -> {
Long id = (Long)params[0];
Long id = (Long) params[0];
return wrapper.select(ApplicationDO::getId, ApplicationDO::getAppName).eq(ApplicationDO::getPromptId, id);
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[] {templateId});
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[]{templateId});
}
@ -370,9 +369,9 @@ public class ApplicationServiceImpl implements ApplicationService {
@Override
public Map<Long, String> getApplicationByKnowledgeId (Long knowledgeId) {
return getApplicationMap((wrapper, params) -> {
Long id = (Long)params[0];
Long id = (Long) params[0];
return wrapper.select(ApplicationDO::getId, ApplicationDO::getAppName).eq(ApplicationDO::getModelServiceId, id);
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[] {knowledgeId});
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[]{knowledgeId});
}
/**
@ -389,17 +388,17 @@ public class ApplicationServiceImpl implements ApplicationService {
/**
* 根据 模型id 和模型类型 获取 应用
*
* @param modelId 模型id
* @param modelId 模型id
* @param appModelType 应用模型类型 1:预制模型 2:我的模型
* @return 应用
*/
public Map<Long, String> getApplicationByBaseModelIdAndType (Long modelId, Integer appModelType) {
return getApplicationMap((wrapper, params) -> {
Long id = (Long)params[0];
Integer type = (Integer)params[1];
Long id = (Long) params[0];
Integer type = (Integer) params[1];
return wrapper.select(ApplicationDO::getId, ApplicationDO::getAppName)
.eq(ApplicationDO::getAppModel, id)
.eq(ApplicationDO::getAppModelType, type);
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[] {modelId, appModelType});
}, ApplicationDO::getId, ApplicationDO::getAppName, new Object[]{modelId, appModelType});
}
}

View File

@ -114,7 +114,7 @@ public class BaseModelServiceImpl implements BaseModelService {
@Override
public void unActive (BaseModelSaveReqVO updateReqVO) {
// 校验使用
// validateModelUse(updateReqVO.getId());
validateModelUse(updateReqVO.getId());
updateReqVO.setIsActive(false);
updateBaseModel(updateReqVO);