| | |
| | | package cc.mrbird.febs.yinhe.service.impl; |
| | | |
| | | import cc.mrbird.febs.ai.res.product.ApiProductVo; |
| | | import cc.mrbird.febs.ai.strategy.LlmStrategyFactory; |
| | | import cc.mrbird.febs.ai.strategy.enumerates.LlmStrategyEnum; |
| | | import cc.mrbird.febs.ai.utils.UUID; |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.AppContants; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.RedisUtils; |
| | | import cc.mrbird.febs.common.utils.YHLoginUserUtil; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | |
| | | import com.alibaba.dashscope.common.Role; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | private final YhAiMemberMapper yhAiMemberMapper; |
| | | private final YHAiCompanyMapper yhAiCompanyMapper; |
| | | private final YHAiBannerMapper yhAiBannerMapper; |
| | | private final YHAiLogoMapper yhAiLogoMapper; |
| | | |
| | | private final YHAiAgentCategoryMapper yhAiAgentCategoryMapper; |
| | | private final YHAiAgentMapper yhAiAgentMapper; |
| | |
| | | LambdaQueryWrapper<YHAiAgentCategory> query = Wrappers.lambdaQuery(YHAiAgentCategory.class); |
| | | query.eq(YHAiAgentCategory::getCompanyId,companyId); |
| | | query.eq(YHAiAgentCategory::getState,1); |
| | | if (ObjectUtil.isNotEmpty(dto.getId())){ |
| | | query.eq(YHAiAgentCategory::getId,dto.getId()); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(dto.getHotState())){ |
| | | query.eq(YHAiAgentCategory::getHotState,dto.getHotState()); |
| | | } |
| | |
| | | @Override |
| | | public FebsResponse agentInfo(YHAgentInitDto dto) { |
| | | |
| | | String companyId = YHLoginUserUtil.getLoginUser().getCompanyId(); |
| | | String memberUuid = YHLoginUserUtil.getLoginUser().getMemberUuid(); |
| | | YHAgentInitVo yhAgentInitVo = new YHAgentInitVo(); |
| | | |
| | | String id = dto.getId(); |
| | |
| | | |
| | | @Override |
| | | public FebsResponse agentSysList(YHSysAgentDto dto) { |
| | | ArrayList<YHSysAgentVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<YHSysAgent> query = Wrappers.lambdaQuery(YHSysAgent.class); |
| | | query.eq(YHSysAgent::getState,1); |
| | | if (ObjectUtil.isNotEmpty(dto.getAgentCategoryId())){ |
| | | query.eq(YHSysAgent::getAgentCategoryId,dto.getAgentCategoryId()); |
| | | } |
| | | query.orderByDesc(YHSysAgent::getCreateTime); |
| | | |
| | | List<YHSysAgent> list = yhSysAgentMapper.selectList(query); |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | |
| | | for (YHSysAgent entity : list) { |
| | | YHSysAgentVo vo = new YHSysAgentVo(); |
| | | vo.setId(entity.getId()); |
| | | vo.setName(entity.getName()); |
| | | vo.setDescription(entity.getDescription()); |
| | | vo.setIconImg(entity.getIconImg()); |
| | | vos.add(vo); |
| | | } |
| | | } |
| | | return new FebsResponse().success().data(vos); |
| | | // 创建分页对象,传入当前页和每页大小 |
| | | Page<YHSysAgentVo> page = new Page<>(dto.getPageNow(), dto.getPageSize()); |
| | | Page<YHSysAgentVo> pageListByQuery = yhSysAgentMapper.getPageListByQuery(page, dto); |
| | | return new FebsResponse().success().data(pageListByQuery); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | @Override |
| | | public FebsResponse logout() { |
| | | String memberUuid = LoginUserUtil.getLoginUser().getMemberUuid(); |
| | | String memberUuid = YHLoginUserUtil.getLoginUser().getMemberUuid(); |
| | | |
| | | String redisKey = AppContants.XCX_LOGIN_PREFIX + memberUuid; |
| | | String existToken = redisUtils.getString(redisKey); |
| | |
| | | |
| | | @Override |
| | | public FebsResponse initSend(YHSendInitDto dto) { |
| | | String memberUuid = LoginUserUtil.getLoginUser().getMemberUuid(); |
| | | String memberUuid = YHLoginUserUtil.getLoginUser().getMemberUuid(); |
| | | |
| | | YHSendInitVo vo = new YHSendInitVo(); |
| | | |
| | |
| | | } |
| | | return messages; |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse bannerList() { |
| | | List<YHBannerVo> vos = new ArrayList<>(); |
| | | List<YHAiBanner> list = yhAiBannerMapper.selectList( |
| | | Wrappers.lambdaQuery(YHAiBanner.class) |
| | | .eq(YHAiBanner::getState, 1) |
| | | .isNull(YHAiBanner::getCompanyId) |
| | | .orderByDesc(YHAiBanner::getSort) |
| | | ); |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | for (YHAiBanner aiBanner : list){ |
| | | YHBannerVo vo = new YHBannerVo(); |
| | | vo.setName(aiBanner.getName()); |
| | | vo.setImageUrl(aiBanner.getImageUrl()); |
| | | vo.setSort(aiBanner.getSort()); |
| | | vos.add(vo); |
| | | } |
| | | } |
| | | return new FebsResponse().data(vos); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse logoInfo() { |
| | | YHLogoVo yhLogoVo = new YHLogoVo(); |
| | | |
| | | List<YHAiLogo> yhAiLogos = yhAiLogoMapper.selectList( |
| | | Wrappers.lambdaQuery(YHAiLogo.class) |
| | | .eq(YHAiLogo::getState, 1) |
| | | .isNull(YHAiLogo::getCompanyId) |
| | | ); |
| | | if (CollUtil.isNotEmpty(yhAiLogos)){ |
| | | YHAiLogo yhAiLogo = yhAiLogos.get(0); |
| | | yhLogoVo.setName(yhAiLogo.getName()); |
| | | yhLogoVo.setImageUrl(yhAiLogo.getImageUrl()); |
| | | yhLogoVo.setDesription(yhAiLogo.getDesription()); |
| | | } |
| | | |
| | | return new FebsResponse().data(yhLogoVo); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse loginBannerList() { |
| | | String companyId = YHLoginUserUtil.getLoginUser().getCompanyId(); |
| | | List<YHBannerVo> vos = new ArrayList<>(); |
| | | List<YHAiBanner> list = yhAiBannerMapper.selectList( |
| | | Wrappers.lambdaQuery(YHAiBanner.class) |
| | | .eq(YHAiBanner::getState, 1) |
| | | .eq(YHAiBanner::getCompanyId, companyId) |
| | | .isNull(YHAiBanner::getCompanyId) |
| | | .orderByDesc(YHAiBanner::getSort) |
| | | ); |
| | | if (CollUtil.isNotEmpty(list)){ |
| | | for (YHAiBanner aiBanner : list){ |
| | | YHBannerVo vo = new YHBannerVo(); |
| | | vo.setName(aiBanner.getName()); |
| | | vo.setImageUrl(aiBanner.getImageUrl()); |
| | | vo.setSort(aiBanner.getSort()); |
| | | vos.add(vo); |
| | | } |
| | | } |
| | | return new FebsResponse().data(vos); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse loginLogoInfo() { |
| | | String companyId = YHLoginUserUtil.getLoginUser().getCompanyId(); |
| | | YHLogoVo yhLogoVo = new YHLogoVo(); |
| | | |
| | | List<YHAiLogo> yhAiLogos = yhAiLogoMapper.selectList( |
| | | Wrappers.lambdaQuery(YHAiLogo.class) |
| | | .eq(YHAiLogo::getState, 1) |
| | | .eq(YHAiLogo::getCompanyId, companyId) |
| | | .isNull(YHAiLogo::getCompanyId) |
| | | ); |
| | | if (CollUtil.isNotEmpty(yhAiLogos)){ |
| | | YHAiLogo yhAiLogo = yhAiLogos.get(0); |
| | | yhLogoVo.setName(yhAiLogo.getName()); |
| | | yhLogoVo.setImageUrl(yhAiLogo.getImageUrl()); |
| | | yhLogoVo.setDesription(yhAiLogo.getDesription()); |
| | | } |
| | | |
| | | return new FebsResponse().data(yhLogoVo); |
| | | } |
| | | } |