基座模型
This commit is contained in:
parent
8bfac5bfdf
commit
f9c1405323
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.llm.controller.admin.basemodel;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -53,6 +54,24 @@ public class BaseModelController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/active")
|
||||
@Operation(summary = "启动")
|
||||
@PreAuthorize("@ss.hasPermission('llm:base-model:update')")
|
||||
public CommonResult<Boolean> active(@Valid @RequestBody BaseModelSaveReqVO updateReqVO) {
|
||||
updateReqVO.setIsActive(true);
|
||||
baseModelService.updateBaseModel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/unactive")
|
||||
@Operation(summary = "禁用")
|
||||
@PreAuthorize("@ss.hasPermission('llm:base-model:update')")
|
||||
public CommonResult<Boolean> unactive(@Valid @RequestBody BaseModelSaveReqVO updateReqVO) {
|
||||
updateReqVO.setIsActive(false);
|
||||
baseModelService.updateBaseModel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除基座模型")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@ -71,6 +90,16 @@ public class BaseModelController {
|
||||
return success(BeanUtils.toBean(baseModel, BaseModelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/getParamModel")
|
||||
@Operation(summary = "获取参数模板")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('llm:base-model:query')")
|
||||
public CommonResult<JSONObject> getParamModel(@RequestParam("id") Integer id) {
|
||||
BaseModelDO baseModel = baseModelService.getBaseModel(id);
|
||||
//todo 获取参数模板api
|
||||
return success(new JSONObject());
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得基座模型分页")
|
||||
@PreAuthorize("@ss.hasPermission('llm:base-model:query')")
|
||||
@ -79,6 +108,14 @@ public class BaseModelController {
|
||||
return success(BeanUtils.toBean(pageResult, BaseModelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得基座模型列表,下拉菜单")
|
||||
@PreAuthorize("@ss.hasPermission('llm:base-model:query')")
|
||||
public CommonResult<List<BaseModelRespVO>> getBaseModelList() {
|
||||
List<BaseModelDO> pageResult = baseModelService.getBaseModelList();
|
||||
return success(BeanUtils.toBean(pageResult, BaseModelRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出基座模型 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('llm:base-model:export')")
|
||||
@ -92,4 +129,4 @@ public class BaseModelController {
|
||||
BeanUtils.toBean(list, BaseModelRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -40,4 +40,13 @@ public class BaseModelPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@Schema(description = "api地址")
|
||||
private String apiUrl;
|
||||
|
||||
@Schema(description = "api秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "代理")
|
||||
private String proxy;
|
||||
|
||||
}
|
||||
|
@ -48,4 +48,14 @@ public class BaseModelRespVO {
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "api地址")
|
||||
private String apiUrl;
|
||||
|
||||
@Schema(description = "api秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "代理")
|
||||
private String proxy;
|
||||
|
||||
}
|
||||
|
@ -39,4 +39,13 @@ public class BaseModelSaveReqVO {
|
||||
@Schema(description = "备注")
|
||||
private String notes;
|
||||
|
||||
}
|
||||
@Schema(description = "api地址")
|
||||
private String apiUrl;
|
||||
|
||||
@Schema(description = "api秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "代理")
|
||||
private String proxy;
|
||||
|
||||
}
|
||||
|
@ -55,5 +55,17 @@ public class BaseModelDO extends BaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String notes;
|
||||
/**
|
||||
* api地址
|
||||
*/
|
||||
private String apiUrl;
|
||||
/**
|
||||
* api秘钥
|
||||
*/
|
||||
private String apiKey;
|
||||
/**
|
||||
* 代理
|
||||
*/
|
||||
private String proxy;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -52,4 +52,6 @@ public interface BaseModelService {
|
||||
*/
|
||||
PageResult<BaseModelDO> getBaseModelPage(BaseModelPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
List<BaseModelDO> getBaseModelList();
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.llm.service.basemodel;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@ -71,4 +72,12 @@ public class BaseModelServiceImpl implements BaseModelService {
|
||||
return baseModelMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public List<BaseModelDO> getBaseModelList() {
|
||||
LambdaQueryWrapper<BaseModelDO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BaseModelDO::getIsActive,0);
|
||||
List<BaseModelDO> baseModelDOS = baseModelMapper.selectList(queryWrapper);
|
||||
return baseModelDOS;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user