Package com.bytedesk.ai.robot
Class RobotRestService
java.lang.Object
com.bytedesk.core.base.BaseRestService<T,TRequest,TResponse>
com.bytedesk.core.base.BaseRestServiceWithExport<RobotEntity,RobotRequest,RobotResponse,RobotExcel>
com.bytedesk.ai.robot.RobotRestService
@Service
@Description("Robot Management Service - AI robot and chatbot management service")
public class RobotRestService
extends BaseRestServiceWithExport<RobotEntity,RobotRequest,RobotResponse,RobotExcel>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CategoryRestServiceprivate final FaqRestServiceprivate final LlmProviderRestServiceprivate final org.modelmapper.ModelMapperprivate final RobotJsonLoaderprivate final RobotRepositoryprivate final ThreadRestServiceprivate final UidUtilsFields inherited from class com.bytedesk.core.base.BaseRestService
authService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertExcelToRobot(RobotExcel excel, String kbType, String fileUid, String kbUid, String orgUid) convertToExcel(RobotEntity entity) 转换为Excel对象 子类必须实现此方法convertToResponse(RobotEntity entity) create(RobotRequest request) createDefaultPromptRobot(String orgUid, String robotUid) createDefaultRobot(String orgUid, String uid) createLlmThread(ThreadRequest request) createPromptRobot(RobotRequest request) protected org.springframework.data.jpa.domain.Specification<RobotEntity>createSpecification(RobotRequest request) 创建Specification对象,子类必须实现 用于queryByOrg的通用实现voiddelete(RobotRequest request) voiddeleteByUid(String uid) protected RobotEntitydoSave(RobotEntity entity) 子类实现具体的保存逻辑protected org.springframework.data.domain.Page<RobotEntity>executePageQuery(org.springframework.data.jpa.domain.Specification<RobotEntity> spec, org.springframework.data.domain.Pageable pageable) 执行分页查询,子类必须实现 用于queryByOrg的通用实现existsByUid(String uid) findByNameAndOrgUidAndDeletedFalse(String name, String orgUid) handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, RobotEntity entity) voidinitDefaultRobot(String orgUid, String uid) voidinitRobotJson(String level, String orgUid) queryByUid(RobotRequest request) 通用的queryByUid实现voidsave(List<RobotEntity> entities) private voidsetRobotSettings(RobotEntity robot, RobotRequest request) Sets common settings for both create and update operationsupdate(RobotRequest request) updateAvatar(RobotRequest request) updateKbUid(RobotRequest request) updateLlmThread(ThreadRequest request) updatePromptRobot(RobotRequest request) Methods inherited from class com.bytedesk.core.base.BaseRestServiceWithExport
queryByOrgEntityMethods inherited from class com.bytedesk.core.base.BaseRestService
deleteByOrgUid, findByOrgUid, getUidFromRequest, queryByOrg, queryByUser, recover, save, setUserUidToRequest
-
Field Details
-
robotRepository
-
faqRestService
-
modelMapper
private final org.modelmapper.ModelMapper modelMapper -
uidUtils
-
threadRestService
-
robotJsonLoader
-
categoryRestService
-
llmProviderRestService
-
-
Constructor Details
-
RobotRestService
public RobotRestService()
-
-
Method Details
-
createSpecification
protected org.springframework.data.jpa.domain.Specification<RobotEntity> createSpecification(RobotRequest request) Description copied from class:BaseRestService创建Specification对象,子类必须实现 用于queryByOrg的通用实现- Specified by:
createSpecificationin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
executePageQuery
protected org.springframework.data.domain.Page<RobotEntity> executePageQuery(org.springframework.data.jpa.domain.Specification<RobotEntity> spec, org.springframework.data.domain.Pageable pageable) Description copied from class:BaseRestService执行分页查询,子类必须实现 用于queryByOrg的通用实现- Specified by:
executePageQueryin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
findByUid
@Cacheable(value="robot", key="#uid", unless="#result == null") public Optional<RobotEntity> findByUid(String uid) - Specified by:
findByUidin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
findByNameAndOrgUidAndDeletedFalse
@Cacheable(value="robot", key="#name + \'_\' + #orgUid", unless="#result == null") public Optional<RobotEntity> findByNameAndOrgUidAndDeletedFalse(String name, String orgUid) -
existsByUid
-
queryByUid
@Cacheable(value="robot", key="#name + \'_\' + #uid", unless="#result == null") public RobotResponse queryByUid(RobotRequest request) Description copied from class:BaseRestService通用的queryByUid实现- Overrides:
queryByUidin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
create
- Specified by:
createin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
createLlmThread
-
updateLlmThread
-
update
- Specified by:
updatein classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
setRobotSettings
Sets common settings for both create and update operations- Parameters:
robot- The robot entity to updaterequest- The request containing settings
-
updateAvatar
-
doSave
Description copied from class:BaseRestService子类实现具体的保存逻辑- Specified by:
doSavein classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
save
-
handleOptimisticLockingFailureException
public RobotEntity handleOptimisticLockingFailureException(org.springframework.orm.ObjectOptimisticLockingFailureException e, RobotEntity entity) - Specified by:
handleOptimisticLockingFailureExceptionin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
deleteByUid
- Specified by:
deleteByUidin classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
delete
- Specified by:
deletein classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
convertToResponse
- Specified by:
convertToResponsein classBaseRestService<RobotEntity,RobotRequest, RobotResponse>
-
initDefaultRobot
-
createDefaultRobot
-
createDefaultPromptRobot
-
initRobotJson
-
createPromptRobot
-
updatePromptRobot
-
updateKbUid
-
convertToExcel
Description copied from class:BaseRestServiceWithExport转换为Excel对象 子类必须实现此方法- Specified by:
convertToExcelin classBaseRestServiceWithExport<RobotEntity,RobotRequest, RobotResponse, RobotExcel>
-
convertExcelToRobot
public RobotEntity convertExcelToRobot(RobotExcel excel, String kbType, String fileUid, String kbUid, String orgUid)
-