Package com.bytedesk.ai.model
Class LlmModelRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<LlmModelEntity,LlmModelRequest,LlmModelResponse>
com.bytedesk.ai.model.LlmModelRestService
@Service
@Description("LLM Model Service - Large Language Model management and configuration service")
public class LlmModelRestService
extends BaseRestService<LlmModelEntity,LlmModelRequest,LlmModelResponse>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AuthServiceprivate final LlmModelRepositoryprivate final org.modelmapper.ModelMapperprivate final UidUtils -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToResponse(LlmModelEntity entity) create(LlmModelRequest request) createFromModelJson(String providerUid, String providerName, LlmModelJsonLoader.ModelJson modelJson, String level, String orgUid) protected org.springframework.data.jpa.domain.Specification<LlmModelEntity>createSpecification(LlmModelRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现voiddelete(LlmModelRequest entity) voiddeleteByUid(String uid) protected LlmModelEntitydoSave(LlmModelEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<LlmModelEntity>executePageQuery(org.springframework.data.jpa.domain.Specification<LlmModelEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByNameAndProviderUid(String name, String providerUid) findByProviderNameAndOrgUid(String providerName, String orgUid) findByProviderUid(String providerUid) handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, LlmModelEntity entity) save(LlmModelEntity entity) 保存实体,带重试机制update(LlmModelRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByOrg, queryByUid, queryByUser, recover, setUserUidToRequest
-
Field Details
-
llmModelRepository
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
uidUtils
-
authService
-
-
Constructor Details
-
LlmModelRestService
public LlmModelRestService()
-
-
Method Details
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<LlmModelEntity> createSpecification(LlmModelRequest request) Description copied from class:BaseRestService创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecificationin classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<LlmModelEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<LlmModelEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQueryin classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
findByUid
- Specified by:
findByUidin classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
findByProviderUid
-
findByProviderNameAndOrgUid
-
existsByNameAndProviderUid
-
create
- Specified by:
createin classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
createFromModelJson
public LlmModelResponse createFromModelJson(String providerUid, String providerName, LlmModelJsonLoader.ModelJson modelJson, String level, String orgUid) -
update
- Specified by:
updatein classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
save
Description copied from class:BaseRestService保存实体,带重试机制- Overrides:
savein classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
doSave
Description copied from class:BaseRestService子类实现具体的保存逻辑- Specified by:
doSavein classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
handleOptimisticLockingFailureException
public LlmModelEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, LlmModelEntity entity) - Specified by:
handleOptimisticLockingFailureExceptionin classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
deleteByUid
- Specified by:
deleteByUidin classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
delete
- Specified by:
deletein classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-
convertToResponse
- Specified by:
convertToResponsein classBaseRestService<LlmModelEntity,LlmModelRequest, LlmModelResponse>
-