feat(llm): 增加模型删除功能并优化模型禁用逻辑

- 在 LLMBackendProperties 中添加 deleteModel 配置项
- 在 BaseModelServiceImpl 中实现模型禁用时调用删除接口- 更新 application-local.yaml,添加模型删除相关配置
This commit is contained in:
sunxiqing 2025-03-05 18:52:38 +08:00
parent b5329b5323
commit 6006f3050d
3 changed files with 14 additions and 2 deletions

View File

@ -116,6 +116,8 @@ public class LLMBackendProperties {
private String deployModel;
private String deleteModel;
/**
* 知识库向量嵌入
*/

View File

@ -166,9 +166,17 @@ public class BaseModelServiceImpl implements BaseModelService {
public void unActive (BaseModelSaveReqVO updateReqVO) {
// 校验使用
validateModelUse(updateReqVO.getId());
try {
BaseModelDO baseModelDO = baseModelMapper.selectById(updateReqVO.getId());
Long deploy_id = baseModelDO.getModelId();
String resStr = HttpUtils.post(llmBackendProperties.getDeleteModel(), null, JSON.toJSONString(deploy_id));
// 禁用模型
updateReqVO.setIsActive(0);
updateBaseModel(updateReqVO);
}catch (Exception e){
log.error("禁用基础模型状态时发生异常: {}", e.getMessage(), e);
}
updateReqVO.setIsActive(0);
updateBaseModel(updateReqVO);
}
@Override

View File

@ -332,6 +332,8 @@ llm:
base_model_status: http://36.103.199.248:5123/llm/deploy/list
# 模型部署 POST
deploy_model: http://36.103.199.248:5123/llm/deploy
# 模型删除
delete_model: http://36.103.199.248:5123/llm/deploy/stop
#################### 30000: 大模型对话相关API。 ###################
#### 大模型对话