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 AuthService
private final LlmModelRepository
private final org.modelmapper.ModelMapper
private 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的通用实现void
delete
(LlmModelRequest entity) void
deleteByUid
(String uid) protected LlmModelEntity
doSave
(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:
createSpecification
in 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:
executePageQuery
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
findByUid
- Specified by:
findByUid
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
findByProviderUid
-
findByProviderNameAndOrgUid
-
existsByNameAndProviderUid
-
create
- Specified by:
create
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
createFromModelJson
public LlmModelResponse createFromModelJson(String providerUid, String providerName, LlmModelJsonLoader.ModelJson modelJson, String level, String orgUid) -
update
- Specified by:
update
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
save
Description copied from class:BaseRestService
保存实体,带重试机制- Overrides:
save
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
doSave
Description copied from class:BaseRestService
子类实现具体的保存逻辑- Specified by:
doSave
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
handleOptimisticLockingFailureException
public LlmModelEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, LlmModelEntity entity) - Specified by:
handleOptimisticLockingFailureException
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
deleteByUid
- Specified by:
deleteByUid
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
delete
- Specified by:
delete
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-
convertToResponse
- Specified by:
convertToResponse
in classBaseRestService<LlmModelEntity,
LlmModelRequest, LlmModelResponse>
-