├── .gitignore
├── .mvn
└── wrapper
│ ├── maven-wrapper.jar
│ └── maven-wrapper.properties
├── LICENSE
├── README.md
├── beehive-base
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── hncboy
│ └── beehive
│ └── base
│ ├── annotation
│ └── ApiAdminRestController.java
│ ├── cache
│ └── SysParamCache.java
│ ├── config
│ ├── JacksonConfiguration.java
│ ├── MyBatisMetaObjectConfig.java
│ ├── MybatisPlusConfiguration.java
│ ├── ProxyConfig.java
│ ├── RedisConfig.java
│ ├── SaTokenConfig.java
│ └── WebMvcConfiguration.java
│ ├── constant
│ ├── ApplicationConstant.java
│ ├── AuthConstant.java
│ └── PublicConstant.java
│ ├── domain
│ ├── bo
│ │ └── JwtUserInfoBO.java
│ ├── entity
│ │ ├── CellConfigDO.java
│ │ ├── CellConfigPermissionDO.java
│ │ ├── CellDO.java
│ │ ├── CellPermissionDO.java
│ │ ├── EmailVerifyCodeDO.java
│ │ ├── FrontUserBaseDO.java
│ │ ├── FrontUserExtraBindingDO.java
│ │ ├── FrontUserExtraEmailDO.java
│ │ ├── OpenAiApiKeyDO.java
│ │ ├── RoomBingDO.java
│ │ ├── RoomBingMsgDO.java
│ │ ├── RoomConfigParamDO.java
│ │ ├── RoomDO.java
│ │ ├── RoomMidjourneyMsgDO.java
│ │ ├── RoomOpenAiChatMsgDO.java
│ │ ├── RoomOpenAiChatWebMsgDO.java
│ │ ├── RoomOpenAiImageMsgDO.java
│ │ ├── RoomWxqfChatMsgDO.java
│ │ ├── SensitiveWordDO.java
│ │ ├── SysEmailSendLogDO.java
│ │ ├── SysFrontUserLoginLogDO.java
│ │ └── SysParamDO.java
│ ├── package-info.java
│ └── query
│ │ ├── CursorQuery.java
│ │ ├── PageQuery.java
│ │ └── RoomMsgCursorQuery.java
│ ├── enums
│ ├── CellCodeEnum.java
│ ├── CellConfigPermissionTypeEnum.java
│ ├── CellPermissionTypeEnum.java
│ ├── CellStatusEnum.java
│ ├── EmailBizTypeEnum.java
│ ├── EnableDisableStatusEnum.java
│ ├── FrontUserRegisterTypeEnum.java
│ ├── FrontUserStatusEnum.java
│ ├── MessageStatusEnum.java
│ ├── MessageTypeEnum.java
│ ├── MidjourneyMsgActionEnum.java
│ ├── MidjourneyMsgStatusEnum.java
│ ├── OpenAiApiKeyStatusEnum.java
│ ├── OpenAiApiKeyUseSceneEnum.java
│ ├── RoomOpenAiChatMsgStatusEnum.java
│ ├── RoomWxqfChatMsgStatusEnum.java
│ ├── SysParamKeyEnum.java
│ └── UserExtraBindingTypeEnum.java
│ ├── exception
│ ├── AuthException.java
│ ├── RestExceptionTranslator.java
│ └── ServiceException.java
│ ├── handler
│ ├── SensitiveWordHandler.java
│ ├── mp
│ │ ├── BeehiveBaseMapper.java
│ │ ├── BeehiveServiceImpl.java
│ │ └── IBeehiveService.java
│ ├── response
│ │ ├── IResultCode.java
│ │ ├── R.java
│ │ └── ResultCode.java
│ └── serializer
│ │ ├── DateFormatterSerializer.java
│ │ ├── FilePathPrefixSerializer.java
│ │ └── LongToStringSerializer.java
│ ├── mapper
│ ├── CellConfigMapper.java
│ ├── CellConfigPermissionMapper.java
│ ├── CellMapper.java
│ ├── CellPermissionMapper.java
│ ├── EmailVerifyCodeMapper.java
│ ├── FrontUserBaseMapper.java
│ ├── FrontUserExtraBindingMapper.java
│ ├── FrontUserExtraEmailMapper.java
│ ├── OpenAiApiKeyMapper.java
│ ├── RoomBingMapper.java
│ ├── RoomBingMsgMapper.java
│ ├── RoomConfigParamMapper.java
│ ├── RoomMapper.java
│ ├── RoomMidjourneyMsgMapper.java
│ ├── RoomOpenAiChatMsgMapper.java
│ ├── RoomOpenAiChatWebMsgMapper.java
│ ├── RoomOpenAiImageMsgMapper.java
│ ├── RoomWxqfChatMsgMapper.java
│ ├── SensitiveWordMapper.java
│ ├── SysEmailSendLogMapper.java
│ ├── SysFrontUserLoginLogMapper.java
│ └── SysParamMapper.java
│ ├── resource
│ ├── aip
│ │ ├── AipContentResult.java
│ │ ├── BaiduAipConfig.java
│ │ ├── BaiduAipHandler.java
│ │ ├── BaiduAipProperties.java
│ │ └── BaiduAipUtil.java
│ ├── email
│ │ ├── EmailConfig.java
│ │ ├── EmailRegisterLoginConfig.java
│ │ └── EmailUtil.java
│ └── package-info.java
│ └── util
│ ├── FileUtil.java
│ ├── ForestRequestUtil.java
│ ├── FrontUserUtil.java
│ ├── ObjectMapperUtil.java
│ ├── OkHttpClientUtil.java
│ ├── PageUtil.java
│ ├── PictureUtil.java
│ ├── RedisUtil.java
│ ├── ResponseBodyEmitterUtil.java
│ ├── SimpleCaptchaUtil.java
│ ├── StpAdminUtil.java
│ ├── ThrowExceptionUtil.java
│ └── WebUtil.java
├── beehive-bootstrap
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── com
│ │ └── hncboy
│ │ └── beehive
│ │ └── BeehiveApplication.java
│ └── resources
│ ├── application-dev.yaml
│ ├── application.yaml
│ ├── banner.txt
│ └── db
│ └── schema-mysql.sql
├── beehive-cell
├── beehive-cell-bing
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── hncboy
│ │ │ └── beehive
│ │ │ └── cell
│ │ │ └── bing
│ │ │ ├── constant
│ │ │ └── NewBingConstant.java
│ │ │ ├── controller
│ │ │ └── RoomBingController.java
│ │ │ ├── domain
│ │ │ ├── bo
│ │ │ │ ├── BingApiCreateConversationResultBO.java
│ │ │ │ ├── BingApiSendMessageResultBO.java
│ │ │ │ ├── BingApiSendThrottlingResultBO.java
│ │ │ │ ├── BingApiSendType1ResultBO.java
│ │ │ │ ├── BingApiSendType2ResultBO.java
│ │ │ │ ├── BingApiSendTypeResultBO.java
│ │ │ │ └── BingRoomBO.java
│ │ │ ├── request
│ │ │ │ └── RoomBingMsgSendRequest.java
│ │ │ └── vo
│ │ │ │ ├── RoomBingMsgVO.java
│ │ │ │ └── RoomBingStreamMsgVO.java
│ │ │ ├── enums
│ │ │ ├── BingCellConfigCodeEnum.java
│ │ │ └── BingModeEnum.java
│ │ │ ├── handler
│ │ │ ├── BingApiResponseTypeMessageHandler.java
│ │ │ ├── BingCellConfigStrategy.java
│ │ │ ├── BingRoomHandler.java
│ │ │ └── converter
│ │ │ │ └── RoomBingMsgConverter.java
│ │ │ └── service
│ │ │ ├── RoomBingMsgService.java
│ │ │ ├── RoomBingService.java
│ │ │ └── impl
│ │ │ ├── RoomBingMsgServiceImpl.java
│ │ │ └── RoomBingServiceImpl.java
│ │ └── resources
│ │ └── bing
│ │ ├── options_balance.json
│ │ ├── options_creative.json
│ │ ├── options_precise.json
│ │ ├── original_send.txt
│ │ └── send.json
├── beehive-cell-core
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── hncboy
│ │ └── beehive
│ │ └── cell
│ │ └── core
│ │ ├── annotation
│ │ ├── CellConfigCheck.java
│ │ └── CellConfigCheckAspect.java
│ │ ├── cache
│ │ ├── CellCache.java
│ │ ├── CellConfigCache.java
│ │ ├── RoomCache.java
│ │ └── RoomConfigParamCache.java
│ │ ├── constant
│ │ ├── CellConstant.java
│ │ └── CellPermissionConstant.java
│ │ ├── controller
│ │ ├── CellConfigController.java
│ │ ├── CellController.java
│ │ ├── RoomConfigParamController.java
│ │ └── RoomController.java
│ │ ├── domain
│ │ ├── bo
│ │ │ ├── CellConfigPermissionBO.java
│ │ │ └── RoomConfigParamBO.java
│ │ ├── query
│ │ │ └── RoomPageQuery.java
│ │ ├── request
│ │ │ ├── RoomConfigParamEditRequest.java
│ │ │ ├── RoomConfigParamRequest.java
│ │ │ ├── RoomCreateRequest.java
│ │ │ ├── RoomInfoEditRequest.java
│ │ │ └── RoomInfoRequest.java
│ │ └── vo
│ │ │ ├── CellConfigVO.java
│ │ │ ├── CellImageVO.java
│ │ │ ├── CellVO.java
│ │ │ ├── RoomConfigParamVO.java
│ │ │ └── RoomListVO.java
│ │ ├── hander
│ │ ├── CellConfigHandler.java
│ │ ├── CellConfigPermissionHandler.java
│ │ ├── CellHandler.java
│ │ ├── CellPermissionHandler.java
│ │ ├── RoomConfigParamHandler.java
│ │ ├── RoomHandler.java
│ │ ├── converter
│ │ │ ├── CellConfigConverter.java
│ │ │ ├── CellConverter.java
│ │ │ ├── RoomConfigParamConverter.java
│ │ │ └── RoomConverter.java
│ │ └── strategy
│ │ │ ├── AbstractCellConfigStrategy.java
│ │ │ ├── CellConfigFactory.java
│ │ │ ├── CellConfigStrategy.java
│ │ │ ├── DataWrapper.java
│ │ │ └── ICellConfigCodeEnum.java
│ │ └── service
│ │ ├── CellConfigPermissionService.java
│ │ ├── CellConfigService.java
│ │ ├── CellPermissionService.java
│ │ ├── CellService.java
│ │ ├── RoomConfigParamService.java
│ │ ├── RoomService.java
│ │ └── impl
│ │ ├── CellConfigPermissionServiceImpl.java
│ │ ├── CellConfigServiceImpl.java
│ │ ├── CellPermissionServiceImpl.java
│ │ ├── CellServiceImpl.java
│ │ ├── RoomConfigParamServiceImpl.java
│ │ └── RoomServiceImpl.java
├── beehive-cell-midjourney
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── hncboy
│ │ │ └── beehive
│ │ │ └── cell
│ │ │ └── midjourney
│ │ │ ├── constant
│ │ │ └── MidjourneyConstant.java
│ │ │ ├── controller
│ │ │ ├── AdminRoomMidjourneyController.java
│ │ │ └── RoomMidjourneyController.java
│ │ │ ├── domain
│ │ │ ├── bo
│ │ │ │ └── MidjourneyDiscordMessageBO.java
│ │ │ ├── request
│ │ │ │ ├── MjConvertRequest.java
│ │ │ │ ├── MjDescribeRequest.java
│ │ │ │ └── MjImagineRequest.java
│ │ │ └── vo
│ │ │ │ └── RoomMidjourneyMsgVO.java
│ │ │ ├── handler
│ │ │ ├── MidjourneyRoomMsgHandler.java
│ │ │ ├── MidjourneyTaskQueueHandler.java
│ │ │ ├── cell
│ │ │ │ ├── MidjourneyCellConfigCodeEnum.java
│ │ │ │ ├── MidjourneyCellConfigStrategy.java
│ │ │ │ └── MidjourneyProperties.java
│ │ │ ├── converter
│ │ │ │ └── RoomMidjourneyMsgConverter.java
│ │ │ ├── listener
│ │ │ │ ├── AbstractDiscordMessageHandler.java
│ │ │ │ ├── DescribeDiscordMessageHandler.java
│ │ │ │ ├── DiscordMessageListener.java
│ │ │ │ ├── DiscordStarter.java
│ │ │ │ ├── ImagineDiscordMessageHandler.java
│ │ │ │ └── UpscaleAndVariationDiscordMessageHandler.java
│ │ │ └── scheduler
│ │ │ │ └── MidjourneyScheduler.java
│ │ │ ├── service
│ │ │ ├── AdminRoomMidjourneyMsgService.java
│ │ │ ├── DiscordSendService.java
│ │ │ ├── DiscordService.java
│ │ │ ├── RoomMidjourneyMsgService.java
│ │ │ └── impl
│ │ │ │ ├── AdminRoomMidjourneyMsgServiceImpl.java
│ │ │ │ ├── DiscordServiceImpl.java
│ │ │ │ └── RoomMidjourneyMsgServiceImpl.java
│ │ │ └── util
│ │ │ ├── MjDiscordMessageUtil.java
│ │ │ └── MjRoomMessageUtil.java
│ │ └── resources
│ │ └── midjourney
│ │ ├── describe.json
│ │ ├── imagine.json
│ │ ├── upscale.json
│ │ └── variation.json
├── beehive-cell-openai
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── hncboy
│ │ └── beehive
│ │ └── cell
│ │ └── openai
│ │ ├── controller
│ │ ├── RoomOpenAiChatController.java
│ │ ├── RoomOpenAiChatWebController.java
│ │ └── RoomOpenAiImageController.java
│ │ ├── domain
│ │ ├── request
│ │ │ ├── RoomOpenAiChatSendRequest.java
│ │ │ └── RoomOpenAiImageSendRequest.java
│ │ └── vo
│ │ │ ├── RoomOpenAiChatMsgVO.java
│ │ │ └── RoomOpenAiImageMsgVO.java
│ │ ├── enums
│ │ ├── OpenAiApiKeyStrategyEnum.java
│ │ ├── OpenAiChatApiModelEnum.java
│ │ ├── OpenAiChatCellConfigCodeEnum.java
│ │ ├── OpenAiChatWebCellConfigCodeEnum.java
│ │ ├── OpenAiChatWebModeEnum.java
│ │ └── OpenAiImageCellConfigCodeEnum.java
│ │ ├── handler
│ │ ├── cell
│ │ │ ├── OpenAiChat3CellConfigStrategy.java
│ │ │ ├── OpenAiChat4CellConfigStrategy.java
│ │ │ ├── OpenAiChatWeb3CellConfigStrategy.java
│ │ │ ├── OpenAiChatWeb4CellConfigStrategy.java
│ │ │ └── OpenAiImageCellConfigStrategy.java
│ │ ├── converter
│ │ │ ├── RoomOpenAiChatMsgConverter.java
│ │ │ ├── RoomOpenAiChatWebMsgConverter.java
│ │ │ └── RoomOpenAiImageMsgConverter.java
│ │ └── scheduler
│ │ │ └── OpenAiApiKeyScheduler.java
│ │ ├── module
│ │ ├── chat
│ │ │ ├── accesstoken
│ │ │ │ ├── ChatWebConversationRequest.java
│ │ │ │ └── ChatWebConversationResponse.java
│ │ │ ├── apikey
│ │ │ │ ├── ChatBaiduAipErrorNode.java
│ │ │ │ ├── ChatCompletionBuildUtil.java
│ │ │ │ ├── ChatErrorNode.java
│ │ │ │ ├── ChatLocalSensitiveWordErrorNode.java
│ │ │ │ └── ChatTokenLimitErrorNode.java
│ │ │ ├── emitter
│ │ │ │ ├── RoomOpenAiChatApiResponseEmitter.java
│ │ │ │ ├── RoomOpenAiChatResponseEmitter.java
│ │ │ │ ├── RoomOpenAiChatResponseEmitterDispatcher.java
│ │ │ │ └── RoomOpenAiChatWebResponseEmitter.java
│ │ │ ├── listener
│ │ │ │ ├── AbstractStreamListener.java
│ │ │ │ ├── ConsoleStreamListener.java
│ │ │ │ ├── ParsedEventSourceListener.java
│ │ │ │ └── ResponseBodyEmitterStreamListener.java
│ │ │ ├── parser
│ │ │ │ ├── AccessTokenChatErrorCodeEnum.java
│ │ │ │ ├── AccessTokenChatResponseParser.java
│ │ │ │ ├── ChatCompletionErrorCodeEnum.java
│ │ │ │ ├── ChatCompletionResponseParser.java
│ │ │ │ └── ResponseParser.java
│ │ │ └── storage
│ │ │ │ ├── AbstractDatabaseDataStorage.java
│ │ │ │ ├── AccessTokenDatabaseDataStorage.java
│ │ │ │ ├── ApiKeyDatabaseDataStorage.java
│ │ │ │ ├── DataStorage.java
│ │ │ │ └── RoomOpenAiChatMessageStorage.java
│ │ ├── key
│ │ │ ├── OpenAiApiKeyBalanceStrategy.java
│ │ │ ├── OpenAiApiKeyFactory.java
│ │ │ ├── OpenAiApiKeyHandler.java
│ │ │ ├── OpenAiApiKeyPollingStrategy.java
│ │ │ ├── OpenAiApiKeyRandomStrategy.java
│ │ │ ├── OpenAiApiKeyStrategy.java
│ │ │ └── OpenAiApiKeyWeightStrategy.java
│ │ └── package-info.java
│ │ └── service
│ │ ├── OpenAiApiKeyService.java
│ │ ├── RoomOpenAiChatMsgService.java
│ │ ├── RoomOpenAiChatWebMsgService.java
│ │ ├── RoomOpenAiImageMsgService.java
│ │ └── impl
│ │ ├── OpenAiApiKeyServiceImpl.java
│ │ ├── RoomOpenAiChatMsgServiceImpl.java
│ │ ├── RoomOpenAiChatWebMsgServiceImpl.java
│ │ └── RoomOpenAiImageMsgServiceImpl.java
├── beehive-cell-starter
│ └── pom.xml
├── beehive-cell-wxqf
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── java
│ │ └── com
│ │ └── hncboy
│ │ └── beehive
│ │ └── cell
│ │ └── wxqf
│ │ ├── controller
│ │ └── RoomWxqfChatController.java
│ │ ├── domain
│ │ ├── request
│ │ │ └── RoomWxqfChatSendRequest.java
│ │ └── vo
│ │ │ └── RoomWxqfChatMsgVO.java
│ │ ├── enums
│ │ ├── WxqfChatBloomz7bCellConfigCodeEnum.java
│ │ ├── WxqfChatErnieBotCellConfigCodeEnum.java
│ │ ├── WxqfChatErnieBotTurboCellConfigCodeEnum.java
│ │ └── WxqfChatModelEnum.java
│ │ ├── handler
│ │ ├── cell
│ │ │ ├── WxqfChatBloomz7bCellConfigStrategy.java
│ │ │ ├── WxqfChatErnieBotCellConfigStrategy.java
│ │ │ └── WxqfChatErnieBotTurboCellConfigStrategy.java
│ │ └── converter
│ │ │ └── RoomWxqfChatMsgConverter.java
│ │ ├── module
│ │ ├── chat
│ │ │ ├── api
│ │ │ │ ├── WxqfChatApiCommonRequest.java
│ │ │ │ ├── WxqfChatApiCommonResponse.java
│ │ │ │ └── WxqfChatErnieBotApiRequest.java
│ │ │ ├── emitter
│ │ │ │ ├── AbstractWxqfChatResponseEmitter.java
│ │ │ │ ├── WxqfChatBloomz7bResponseEmitter.java
│ │ │ │ ├── WxqfChatErnieBotResponseEmitter.java
│ │ │ │ ├── WxqfChatErnieBotTurboResponseEmitter.java
│ │ │ │ └── WxqfChatResponseEmitterDispatcher.java
│ │ │ ├── listener
│ │ │ │ ├── AbstractStreamListener.java
│ │ │ │ ├── ConsoleStreamListener.java
│ │ │ │ ├── ParsedEventSourceListener.java
│ │ │ │ └── ResponseBodyEmitterStreamListener.java
│ │ │ ├── parser
│ │ │ │ ├── ChatCommonResponseParser.java
│ │ │ │ └── ResponseParser.java
│ │ │ └── storage
│ │ │ │ ├── AbstractDatabaseDataStorage.java
│ │ │ │ ├── ChatCommonDatabaseDataStorage.java
│ │ │ │ ├── DataStorage.java
│ │ │ │ └── RoomWxqfChatMessageStorage.java
│ │ └── package-info.java
│ │ └── service
│ │ ├── RoomWxqfChatMsgService.java
│ │ └── impl
│ │ └── RoomWxqfChatMsgServiceImpl.java
└── pom.xml
├── beehive-web
├── pom.xml
└── src
│ └── main
│ └── java
│ └── com
│ └── hncboy
│ └── beehive
│ └── web
│ ├── cache
│ └── FrontUserCache.java
│ ├── controller
│ ├── FrontUserController.java
│ ├── SensitiveWordController.java
│ ├── SysParamController.java
│ └── SysUserController.java
│ ├── domain
│ ├── bo
│ │ └── FrontUserBO.java
│ ├── query
│ │ ├── SensitiveWordPageQuery.java
│ │ └── SysParamPageQuery.java
│ ├── request
│ │ ├── LoginFrontUserByEmailRequest.java
│ │ ├── RegisterFrontUserForEmailRequest.java
│ │ ├── SensitiveWordRequest.java
│ │ ├── SysParamRequest.java
│ │ └── SysUserLoginRequest.java
│ └── vo
│ │ ├── LoginInfoVO.java
│ │ ├── RegisterCaptchaVO.java
│ │ ├── SensitiveWordVO.java
│ │ ├── SysParamVO.java
│ │ └── UserInfoVO.java
│ ├── handler
│ ├── converter
│ │ ├── SensitiveWordConverter.java
│ │ └── SysParamConverter.java
│ └── validation
│ │ ├── FrontUserRegisterAvailable.java
│ │ └── FrontUserRegisterAvailableValidator.java
│ └── service
│ ├── EmailService.java
│ ├── EmailVerifyCodeService.java
│ ├── FrontUserBaseService.java
│ ├── FrontUserExtraBindingService.java
│ ├── FrontUserExtraEmailService.java
│ ├── FrontUserService.java
│ ├── SensitiveWordService.java
│ ├── SysEmailSendLogService.java
│ ├── SysFrontUserLoginLogService.java
│ ├── SysParamService.java
│ ├── SysUserService.java
│ ├── impl
│ ├── EmailServiceImpl.java
│ ├── EmailVerifyCodeServiceImpl.java
│ ├── FrontUserBaseServiceImpl.java
│ ├── FrontUserExtraBindingServiceImpl.java
│ ├── FrontUserExtraEmailServiceImpl.java
│ ├── FrontUserServiceImpl.java
│ ├── SensitiveWordServiceImpl.java
│ ├── SysEmailSendLogServiceImpl.java
│ ├── SysFrontUserLoginLogServiceImpl.java
│ ├── SysParamServiceImpl.java
│ └── SysUserServiceImpl.java
│ └── strategy
│ ├── package-info.java
│ └── user
│ ├── AbstractRegisterTypeStrategy.java
│ └── EmailAbstractRegisterStrategy.java
├── docs
└── pics
│ ├── cell_list_01.png
│ ├── cell_midjourney_describe_01.png
│ ├── cell_midjourney_describe_02.png
│ ├── cell_midjourney_imagine_01.png
│ ├── cell_midjourney_imagine_02.png
│ ├── cell_midjourney_upscale_01.png
│ ├── cell_midjourney_variation_01.png
│ ├── cell_openai_gpt_01.png
│ ├── cell_openai_image_01.png
│ ├── login_with_not_permit_email_suffix.png
│ ├── register_login.png
│ ├── system_not_permit_register.png
│ └── wechat.png
├── mvnw
├── mvnw.cmd
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | HELP.md
2 | target/
3 | !.mvn/wrapper/maven-wrapper.jar
4 | !**/src/main/**/target/
5 | !**/src/test/**/target/
6 |
7 | ### STS ###
8 | .apt_generated
9 | .classpath
10 | .factorypath
11 | .project
12 | .settings
13 | .springBeans
14 | .sts4-cache
15 |
16 | ### IntelliJ IDEA ###
17 | .idea
18 | *.iws
19 | *.iml
20 | *.ipr
21 |
22 | ### NetBeans ###
23 | /nbproject/private/
24 | /nbbuild/
25 | /dist/
26 | /nbdist/
27 | /.nb-gradle/
28 | build/
29 | !**/src/main/**/build/
30 | !**/src/test/**/build/
31 |
32 | ### VS Code ###
33 | .vscode/
34 |
35 | ### pom flatten ###
36 | **/.flattened-pom.xml
37 | /beehive-bootstrap/src/main/resources/application-local.yaml
38 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # https://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip
18 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar
19 |
--------------------------------------------------------------------------------
/beehive-base/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.hncboy
7 | ai-beehive
8 | ${revision}
9 |
10 | beehive-base
11 |
12 |
13 | 4.16.16
14 |
15 |
16 |
17 |
18 |
19 | com.baidu.aip
20 | java-sdk
21 | ${baidu-api-sdk.version}
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/annotation/ApiAdminRestController.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.annotation;
2 |
3 | import org.springframework.core.annotation.AliasFor;
4 | import org.springframework.web.bind.annotation.RequestMapping;
5 | import org.springframework.web.bind.annotation.RestController;
6 |
7 | import java.lang.annotation.Documented;
8 | import java.lang.annotation.ElementType;
9 | import java.lang.annotation.Retention;
10 | import java.lang.annotation.RetentionPolicy;
11 | import java.lang.annotation.Target;
12 |
13 | /**
14 | * @author hncboy
15 | * @date 2023-3-27
16 | * 管理端接口路径前端
17 | */
18 | @Target(ElementType.TYPE)
19 | @Retention(RetentionPolicy.RUNTIME)
20 | @Documented
21 | @RestController
22 | @RequestMapping
23 | public @interface ApiAdminRestController {
24 |
25 | /**
26 | * Alias for {@link RequestMapping#name}.
27 | */
28 | @AliasFor(annotation = RequestMapping.class)
29 | String name() default "";
30 |
31 | /**
32 | * Alias for {@link RequestMapping#value}.
33 | */
34 | @AliasFor(annotation = RequestMapping.class)
35 | String[] value() default {};
36 |
37 | /**
38 | * Alias for {@link RequestMapping#path}.
39 | */
40 | @AliasFor(annotation = RequestMapping.class)
41 | String[] path() default {};
42 | }
43 |
44 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/config/JacksonConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.config;
2 |
3 | import com.hncboy.beehive.base.handler.serializer.DateFormatterSerializer;
4 | import com.hncboy.beehive.base.handler.serializer.LongToStringSerializer;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
8 |
9 | import java.util.Date;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023-4-1
14 | * Jackson 配置
15 | */
16 | @Configuration
17 | public class JacksonConfiguration {
18 |
19 | @Bean
20 | public Jackson2ObjectMapperBuilder jacksonBuilder() {
21 | Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
22 | // 返回 Long 转 String
23 | builder.serializerByType(Long.class, new LongToStringSerializer());
24 | // 返回 Date 格式化
25 | builder.serializerByType(Date.class, new DateFormatterSerializer());
26 | return builder;
27 | }
28 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/config/MybatisPlusConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.config;
2 |
3 | import com.baomidou.mybatisplus.annotation.DbType;
4 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
5 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.context.annotation.Configuration;
8 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023-4-1
13 | * MyBatisPlus 配置
14 | */
15 | @Configuration
16 | public class MybatisPlusConfiguration implements WebMvcConfigurer {
17 |
18 | @Bean
19 | public MybatisPlusInterceptor mybatisPlusInterceptor() {
20 | MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
21 | // 分页拦截器
22 | interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
23 | return interceptor;
24 | }
25 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/config/ProxyConfig.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.config;
2 |
3 | import com.hncboy.beehive.base.exception.ServiceException;
4 | import lombok.Data;
5 | import org.springframework.beans.factory.InitializingBean;
6 | import org.springframework.boot.context.properties.ConfigurationProperties;
7 | import org.springframework.stereotype.Component;
8 |
9 | import java.net.InetSocketAddress;
10 | import java.net.Proxy;
11 |
12 |
13 | /**
14 | * @author hncboy
15 | * @date 2023/5/31
16 | * 代理配置
17 | */
18 | @Data
19 | @Component
20 | @ConfigurationProperties(prefix = "proxy")
21 | public class ProxyConfig implements InitializingBean {
22 |
23 | /**
24 | * 代理是否启用
25 | */
26 | private Boolean enabled;
27 |
28 | /**
29 | * HTTP 代理主机
30 | */
31 | private String httpHost;
32 |
33 | /**
34 | * HTTP 代理端口
35 | */
36 | private Integer httpPort;
37 |
38 | /**
39 | * 获取代理
40 | */
41 | public Proxy getProxy() {
42 | // 国内需要代理
43 | Proxy proxy = Proxy.NO_PROXY;
44 | if (enabled) {
45 | proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(httpHost, httpPort));
46 | }
47 | return proxy;
48 | }
49 |
50 | @Override
51 | public void afterPropertiesSet() {
52 | if (enabled) {
53 | if (httpHost == null || httpPort == null) {
54 | throw new ServiceException("代理配置不正确");
55 | }
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/config/WebMvcConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.config;
2 |
3 | import com.hncboy.beehive.base.annotation.ApiAdminRestController;
4 | import com.hncboy.beehive.base.constant.ApplicationConstant;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
7 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023-3-27
12 | * WebMvc 配置
13 | */
14 | @Configuration
15 | public class WebMvcConfiguration implements WebMvcConfigurer {
16 |
17 | @Override
18 | public void configurePathMatch(PathMatchConfigurer configurer) {
19 | configurer.addPathPrefix(ApplicationConstant.ADMIN_PATH_PREFIX, c -> c.isAnnotationPresent(ApiAdminRestController.class));
20 | }
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/constant/ApplicationConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023-3-27
6 | * 应用相关常量
7 | */
8 | public interface ApplicationConstant {
9 |
10 | /**
11 | * ADMIN 路径前缀
12 | */
13 | String ADMIN_PATH_PREFIX = "admin";
14 |
15 | /**
16 | * 用户登录-JWT携带参数名称:注册类型 code
17 | */
18 | String FRONT_JWT_REGISTER_TYPE_CODE = "registerTypeCode";
19 |
20 | /**
21 | * 用户登录-JWT 携带参数名称:登录账号
22 | */
23 | String FRONT_JWT_USERNAME = "username";
24 |
25 | /**
26 | * 用户登录-JWT 携带参数名称:extraUserId
27 | */
28 | String FRONT_JWT_EXTRA_USER_ID = "extraUserId";
29 | }
30 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/constant/AuthConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/6/18
6 | * 授权相关常量
7 | */
8 | public class AuthConstant {
9 |
10 | /**
11 | * bearer
12 | */
13 | public static final String BEARER = "Bearer ";
14 | }
15 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/constant/PublicConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/5/11
6 | * 公共常量
7 | */
8 | public class PublicConstant {
9 |
10 | /**
11 | * 防止 Redis 缓存穿透的 value
12 | */
13 | public static final String REDIS_CACHE_MISS_VALUE = "ForbidCacheMiss";
14 | }
15 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/bo/JwtUserInfoBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.bo;
2 |
3 | import com.hncboy.beehive.base.enums.FrontUserRegisterTypeEnum;
4 | import lombok.Data;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023-4-16
9 | * JWT 用户信息业务参数
10 | */
11 | @Data
12 | public class JwtUserInfoBO {
13 |
14 | /**
15 | * 注册类型
16 | */
17 | private FrontUserRegisterTypeEnum registerType;
18 |
19 | /**
20 | * 登录账号
21 | */
22 | private String username;
23 |
24 | /**
25 | * 基础用户 id
26 | */
27 | private Integer userId;
28 |
29 | /**
30 | * 扩展用户 id
31 | */
32 | private Integer extraUserId;
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/CellDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.base.enums.CellStatusEnum;
5 | import com.baomidou.mybatisplus.annotation.FieldFill;
6 | import com.baomidou.mybatisplus.annotation.IdType;
7 | import com.baomidou.mybatisplus.annotation.TableField;
8 | import com.baomidou.mybatisplus.annotation.TableId;
9 | import com.baomidou.mybatisplus.annotation.TableName;
10 | import lombok.Data;
11 |
12 | import java.util.Date;
13 |
14 | /**
15 | * @author CoDeleven
16 | * @date 2023/5/25
17 | * cell 表实体类
18 | */
19 | @Data
20 | @TableName("bh_cell")
21 | public class CellDO {
22 |
23 | /**
24 | * 主键
25 | */
26 | @TableId(type = IdType.AUTO)
27 | private Integer id;
28 |
29 | /**
30 | * 名称
31 | */
32 | private String name;
33 |
34 | /**
35 | * 封面
36 | */
37 | private String imageUrl;
38 |
39 | /**
40 | * 唯一编码
41 | */
42 | private CellCodeEnum code;
43 |
44 | /**
45 | * 排序,值大的排前面
46 | */
47 | private Integer sort;
48 |
49 | /**
50 | * 状态
51 | */
52 | private CellStatusEnum status;
53 |
54 | /**
55 | * 介绍
56 | */
57 | private String introduce;
58 |
59 | /**
60 | * 创建时间
61 | */
62 | @TableField(fill = FieldFill.INSERT)
63 | private Date createTime;
64 |
65 | /**
66 | * 更新时间
67 | */
68 | @TableField(fill = FieldFill.INSERT_UPDATE)
69 | private Date updateTime;
70 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/CellPermissionDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.hncboy.beehive.base.enums.CellPermissionTypeEnum;
4 | import com.baomidou.mybatisplus.annotation.FieldFill;
5 | import com.baomidou.mybatisplus.annotation.IdType;
6 | import com.baomidou.mybatisplus.annotation.TableField;
7 | import com.baomidou.mybatisplus.annotation.TableId;
8 | import com.baomidou.mybatisplus.annotation.TableName;
9 | import lombok.Data;
10 |
11 | import java.util.Date;
12 |
13 | /**
14 | * @author hncboy
15 | * @date 2023/6/1
16 | * cell 权限表实体类
17 | * 对于 cell 来说必须拥有权限
18 | */
19 | @Data
20 | @TableName("bh_cell_permission")
21 | public class CellPermissionDO {
22 |
23 | /**
24 | * 主键
25 | */
26 | @TableId(type = IdType.ASSIGN_ID)
27 | private Integer id;
28 |
29 | /**
30 | * 用户 id
31 | */
32 | private Integer userId;
33 |
34 | /**
35 | * cell code
36 | */
37 | private String cellCode;
38 |
39 | /**
40 | * 权限类型
41 | */
42 | private CellPermissionTypeEnum type;
43 |
44 | /**
45 | * 创建时间
46 | */
47 | @TableField(fill = FieldFill.INSERT)
48 | private Date createTime;
49 |
50 | /**
51 | * 更新时间
52 | */
53 | @TableField(fill = FieldFill.INSERT_UPDATE)
54 | private Date updateTime;
55 | }
56 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/FrontUserExtraBindingDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 | import com.hncboy.beehive.base.enums.UserExtraBindingTypeEnum;
9 | import lombok.Data;
10 |
11 | import java.util.Date;
12 |
13 | /**
14 | * 前端用户绑定表实体类
15 | * 记录了 基础用户 和 登录方式 的绑定关系
16 | *
17 | * @author CoDeleven
18 | */
19 | @TableName("bh_front_user_extra_binding")
20 | @Data
21 | public class FrontUserExtraBindingDO {
22 |
23 | /**
24 | * 主键
25 | */
26 | @TableId(type = IdType.AUTO)
27 | private Integer id;
28 |
29 | /**
30 | * 绑定类型
31 | */
32 | private UserExtraBindingTypeEnum bindingType;
33 |
34 | /**
35 | * 额外信息表的用户ID
36 | */
37 | private Integer extraInfoId;
38 |
39 | /**
40 | * 基础用户表的ID
41 | */
42 | private Integer baseUserId;
43 |
44 | /**
45 | * 创建时间
46 | */
47 | @TableField(fill = FieldFill.INSERT)
48 | private Date createTime;
49 |
50 | /**
51 | * 更新时间
52 | */
53 | @TableField(fill = FieldFill.INSERT_UPDATE)
54 | private Date updateTime;
55 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/FrontUserExtraEmailDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 | import lombok.AllArgsConstructor;
9 | import lombok.Builder;
10 | import lombok.Data;
11 | import lombok.NoArgsConstructor;
12 |
13 | import java.util.Date;
14 |
15 | /**
16 | * 前端用户邮箱扩展表实体类
17 | *
18 | * @author CoDeleven
19 | */
20 | @NoArgsConstructor
21 | @AllArgsConstructor
22 | @Builder
23 | @TableName("bh_front_user_extra_email")
24 | @Data
25 | public class FrontUserExtraEmailDO {
26 |
27 | /**
28 | * 主键
29 | */
30 | @TableId(type = IdType.AUTO)
31 | private Integer id;
32 |
33 | /**
34 | * 邮箱账号
35 | */
36 | private String username;
37 |
38 | /**
39 | * 加密后的密码
40 | */
41 | private String password;
42 |
43 | /**
44 | * 加密盐
45 | */
46 | private String salt;
47 |
48 | /**
49 | * 是否验证过,false 否 true 是
50 | */
51 | private Boolean verified;
52 |
53 | /**
54 | * 创建时间
55 | */
56 | @TableField(fill = FieldFill.INSERT)
57 | private Date createTime;
58 |
59 | /**
60 | * 更新时间
61 | */
62 | @TableField(fill = FieldFill.INSERT_UPDATE)
63 | private Date updateTime;
64 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/RoomConfigParamDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableLogic;
8 | import com.baomidou.mybatisplus.annotation.TableName;
9 | import lombok.Data;
10 |
11 | import java.util.Date;
12 |
13 | /**
14 | * @author CoDeleven
15 | * @date 2023/5/25
16 | * 房间配置项参数表实体类
17 | */
18 | @Data
19 | @TableName("bh_room_config_param")
20 | public class RoomConfigParamDO {
21 |
22 | /**
23 | * 主键
24 | */
25 | @TableId(type = IdType.ASSIGN_ID)
26 | private Long id;
27 |
28 | /**
29 | * 用户 ID
30 | */
31 | private Integer userId;
32 |
33 | /**
34 | * 房间 ID
35 | */
36 | private Long roomId;
37 |
38 | /**
39 | * 配置项 code
40 | */
41 | private String cellConfigCode;
42 |
43 | /**
44 | * 配置项值
45 | */
46 | private String value;
47 |
48 | /**
49 | * 用户用默认值就会删除之前配置的值
50 | * 是否删除 0 否 NULL 是
51 | */
52 | @TableLogic(value = "0", delval = "NULL")
53 | private Boolean isDeleted;
54 |
55 | /**
56 | * 创建时间
57 | */
58 | @TableField(fill = FieldFill.INSERT)
59 | private Date createTime;
60 |
61 | /**
62 | * 更新时间
63 | */
64 | @TableField(fill = FieldFill.INSERT_UPDATE)
65 | private Date updateTime;
66 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/SensitiveWordDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableLogic;
8 | import com.baomidou.mybatisplus.annotation.TableName;
9 | import com.hncboy.beehive.base.enums.EnableDisableStatusEnum;
10 | import lombok.Data;
11 |
12 | import java.util.Date;
13 |
14 | /**
15 | * @author hncboy
16 | * @date 2023-3-28
17 | * 敏感词表实体类
18 | */
19 | @Data
20 | @TableName("bh_sensitive_word")
21 | public class SensitiveWordDO {
22 |
23 | /**
24 | * 主键
25 | */
26 | @TableId(type = IdType.AUTO)
27 | private Integer id;
28 |
29 | /**
30 | * 敏感词内容
31 | */
32 | private String word;
33 |
34 | /**
35 | * 状态 1 启用 2 停用
36 | */
37 | private EnableDisableStatusEnum status;
38 |
39 | /**
40 | * 是否删除 0 否 NULL 是
41 | */
42 | @TableLogic(value = "0", delval = "NULL")
43 | private Integer isDeleted;
44 |
45 | /**
46 | * 创建时间
47 | */
48 | @TableField(fill = FieldFill.INSERT)
49 | private Date createTime;
50 |
51 | /**
52 | * 更新时间
53 | */
54 | @TableField(fill = FieldFill.INSERT_UPDATE)
55 | private Date updateTime;
56 | }
57 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/SysFrontUserLoginLogDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 | import com.hncboy.beehive.base.enums.FrontUserRegisterTypeEnum;
9 | import lombok.Data;
10 |
11 | import java.util.Date;
12 |
13 | /**
14 | * 前端用户登录日志表实体类
15 | *
16 | * @author CoDeleven
17 | */
18 | @TableName("bh_sys_front_user_login_log")
19 | @Data
20 | public class SysFrontUserLoginLogDO {
21 |
22 | /**
23 | * 主键
24 | */
25 | @TableId(type = IdType.AUTO)
26 | private Integer id;
27 |
28 | /**
29 | * 登录的基础用户ID
30 | */
31 | private Integer baseUserId;
32 |
33 | /**
34 | * 登录方式(注册方式),邮箱登录,手机登录等等
35 | */
36 | private FrontUserRegisterTypeEnum loginType;
37 |
38 | /**
39 | * 登录信息ID与login_type有关联,邮箱登录时关联front_user_extra_email
40 | */
41 | private Integer loginExtraInfoId;
42 |
43 | /**
44 | * 登录的IP地址
45 | */
46 | private String loginIp;
47 |
48 | /**
49 | * 登录状态,1登录成功,0登录失败
50 | */
51 | private Boolean loginStatus;
52 |
53 | /**
54 | * 登录后返回的消息
55 | */
56 | private String message;
57 |
58 | /**
59 | * 创建时间
60 | */
61 | @TableField(fill = FieldFill.INSERT)
62 | private Date createTime;
63 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/entity/SysParamDO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.entity;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.IdType;
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableId;
7 | import com.baomidou.mybatisplus.annotation.TableLogic;
8 | import com.baomidou.mybatisplus.annotation.TableName;
9 | import lombok.Data;
10 |
11 | import java.util.Date;
12 |
13 | /**
14 | * @author hncboy
15 | * @date 2023/5/10
16 | * 系统参数表实体类
17 | */
18 | @Data
19 | @TableName("bh_sys_param")
20 | public class SysParamDO {
21 |
22 | /**
23 | * 主键
24 | */
25 | @TableId(type = IdType.AUTO)
26 | private Integer id;
27 |
28 | /**
29 | * 名称
30 | */
31 | private String name;
32 |
33 | /**
34 | * key
35 | */
36 | private String paramKey;
37 |
38 | /**
39 | * value
40 | */
41 | private String paramValue;
42 |
43 | /**
44 | * 备注
45 | */
46 | private String remark;
47 |
48 | /**
49 | * 是否删除 0 否 NULL 是
50 | */
51 | @TableLogic(value = "0", delval = "NULL")
52 | private Integer isDeleted;
53 |
54 | /**
55 | * 创建时间
56 | */
57 | @TableField(fill = FieldFill.INSERT)
58 | private Date createTime;
59 |
60 | /**
61 | * 更新时间
62 | */
63 | @TableField(fill = FieldFill.INSERT_UPDATE)
64 | private Date updateTime;
65 | }
66 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/package-info.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain;
2 | /*
3 | * bo 业务对象
4 | * entity 数据库实体类
5 | * request 前端请求参数
6 | * query 前端查询参数
7 | * vo 后端返回给前端的参数
8 | */
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/query/CursorQuery.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.query;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.Valid;
5 | import jakarta.validation.constraints.Max;
6 | import jakarta.validation.constraints.Min;
7 | import jakarta.validation.constraints.NotNull;
8 | import lombok.Data;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/18
13 | * 游标查询参数
14 | */
15 | @Data
16 | @Valid
17 | public class CursorQuery {
18 |
19 | @Max(value = 100, message = "条数最大为 100")
20 | @Min(value = 1, message = "条数最小为 1")
21 | @Schema(title = "条数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
22 | @NotNull(message = "条数不能为空")
23 | private Integer size;
24 |
25 | /**
26 | * 第一次查询的话不需要 cursor
27 | */
28 | @Schema(title = "是否使用游标 true 是 false 否", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
29 | @NotNull(message = "是否使用游标")
30 | private Boolean isUseCursor;
31 |
32 | @Schema(title = "一般是主键", requiredMode = Schema.RequiredMode.REQUIRED)
33 | @NotNull(message = "游标不能为空")
34 | private String cursor;
35 |
36 | @Schema(title = "是否升序", requiredMode = Schema.RequiredMode.REQUIRED)
37 | @NotNull(message = "是否升序不能为空")
38 | private Boolean isAsc;
39 | }
40 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/query/PageQuery.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.query;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.Valid;
5 | import jakarta.validation.constraints.NotNull;
6 | import lombok.Data;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023-3-27
11 | * 分页参数
12 | */
13 | @Data
14 | @Valid
15 | public class PageQuery {
16 |
17 | @Schema(title = "第几页", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
18 | @NotNull(message = "第几页不能为空")
19 | private Integer pageSize;
20 |
21 | @Schema(title = "每页多少条", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
22 | @NotNull(message = "每页条数不能为空")
23 | private Integer pageNum;
24 | }
25 |
26 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/domain/query/RoomMsgCursorQuery.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.domain.query;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import lombok.Data;
6 | import lombok.EqualsAndHashCode;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/26
11 | * 房间消息通用查询参数
12 | */
13 | @Data
14 | @EqualsAndHashCode(callSuper = false)
15 | @Schema(title = "房间消息通用查询参数")
16 | public class RoomMsgCursorQuery extends CursorQuery {
17 |
18 | @NotNull(message = "房间 id 不能为空")
19 | @Schema(title = "房间 id", requiredMode = Schema.RequiredMode.REQUIRED)
20 | private Long roomId;
21 | }
22 |
23 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/CellConfigPermissionTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/2
10 | * Cell 配置项权限类型枚举
11 | */
12 | @AllArgsConstructor
13 | public enum CellConfigPermissionTypeEnum {
14 |
15 | /**
16 | * 可以使用默认值
17 | */
18 | CAN_USER_DEFAULT_VALUE(1);
19 |
20 | @Getter
21 | @EnumValue
22 | private final Integer code;
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/CellPermissionTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/1
10 | * Cell 权限类型枚举
11 | */
12 | @AllArgsConstructor
13 | public enum CellPermissionTypeEnum {
14 |
15 | /**
16 | * 浏览
17 | */
18 | BROWSE(1),
19 |
20 | /**
21 | * 使用
22 | */
23 | USE(2);
24 |
25 | @Getter
26 | @EnumValue
27 | private final Integer code;
28 | }
29 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/CellStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/29
11 | * cell 状态枚举
12 | */
13 | @AllArgsConstructor
14 | public enum CellStatusEnum {
15 |
16 | /**
17 | * 隐藏
18 | */
19 | HIDDEN("hidden"),
20 |
21 | /**
22 | * 开发中
23 | */
24 | CODING("coding"),
25 |
26 | /**
27 | * 修复中
28 | */
29 | FIXING("fixing"),
30 |
31 | /**
32 | * 已发布
33 | */
34 | PUBLISHED("published"),
35 |
36 | /**
37 | * 已关闭
38 | */
39 | CLOSED("closed"),
40 |
41 | /**
42 | * 待开发
43 | */
44 | WAIT_CODING("wait_coding");
45 |
46 | @Getter
47 | @EnumValue
48 | @JsonValue
49 | private final String desc;
50 | }
51 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/EmailBizTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * 邮箱业务用途枚举
9 | *
10 | * @author CoDeleven
11 | */
12 | @AllArgsConstructor
13 | public enum EmailBizTypeEnum {
14 |
15 | /**
16 | * 用户注册验证码认证
17 | */
18 | REGISTER_VERIFY(10, "注册认证"),
19 |
20 | /**
21 | * 用户找回密码验证码认证
22 | */
23 | RETRIEVE_PASSWORD(11, "找回密码认证");
24 |
25 | @Getter
26 | @EnumValue
27 | private final Integer code;
28 |
29 | @Getter
30 | private final String desc;
31 | }
32 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/FrontUserStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/6/27
11 | * 前端用户状态枚举
12 | */
13 | @AllArgsConstructor
14 | public enum FrontUserStatusEnum {
15 |
16 | /**
17 | * 正常状态
18 | */
19 | NORMAL("normal"),
20 |
21 | /**
22 | * 禁止访问
23 | */
24 | BLOCK("block"),
25 |
26 | /**
27 | * 待审核
28 | * 可以配置注册时是否需要审核
29 | */
30 | WAIT_CHECK("wait_check");
31 |
32 | @JsonValue
33 | @EnumValue
34 | @Getter
35 | private final String code;
36 | }
37 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/MessageStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/3
10 | * 消息状态枚举
11 | */
12 | @AllArgsConstructor
13 | public enum MessageStatusEnum {
14 |
15 | /**
16 | * 初始化
17 | */
18 | INIT(0),
19 |
20 | /**
21 | * 成功
22 | */
23 | SUCCESS(1),
24 |
25 | /**
26 | * 失败
27 | */
28 | FAILURE(2);
29 |
30 | @Getter
31 | @EnumValue
32 | private final Integer code;
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/MessageTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import com.fasterxml.jackson.annotation.JsonValue;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Getter;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023-3-26
11 | * 消息类型枚举
12 | */
13 | @AllArgsConstructor
14 | public enum MessageTypeEnum {
15 |
16 | /**
17 | * 问题
18 | */
19 | QUESTION(1, "question"),
20 |
21 | /**
22 | * 回答
23 | */
24 | ANSWER(2, "answer");
25 |
26 | @Getter
27 | @EnumValue
28 | private final Integer code;
29 |
30 | @Getter
31 | @JsonValue
32 | private final String message;
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/MidjourneyMsgActionEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/5/19
10 | * Midjourney 动作枚举
11 | */
12 | @AllArgsConstructor
13 | public enum MidjourneyMsgActionEnum {
14 |
15 | /**
16 | * 生成图片
17 | */
18 | IMAGINE("imagine"),
19 |
20 | /**
21 | * 选中放大
22 | */
23 | UPSCALE("upscale"),
24 |
25 | /**
26 | * 选中其中的一张图,生成四张相似的
27 | */
28 | VARIATION("variation"),
29 |
30 | /**
31 | * 图转 prompt
32 | */
33 | DESCRIBE("describe");
34 |
35 | @Getter
36 | @EnumValue
37 | private final String action;
38 | }
39 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/MidjourneyMsgStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/5/18
10 | * Midjourney 消息状态枚举
11 | * 中间状态:表示状态可能变更
12 | * 结束状态:状态不会变更
13 | */
14 | @AllArgsConstructor
15 | public enum MidjourneyMsgStatusEnum {
16 |
17 | /**
18 | * (最终状态)系统排队上限
19 | */
20 | SYS_MAX_QUEUE(1),
21 |
22 | /**
23 | * (中间状态)系统排队中
24 | */
25 | SYS_QUEUING(2),
26 |
27 | /**
28 | * (最终状态)系统成功
29 | */
30 | SYS_SUCCESS(3),
31 |
32 | /**
33 | * (最终状态)系统失败
34 | */
35 | SYS_FAILURE(4),
36 |
37 | /**
38 | * (最终状态)系统等待 MJ 接收消息失败
39 | */
40 | SYS_WAIT_MJ_RECEIVED_FAILURE(5),
41 |
42 | /**
43 | * (最终状态)系统发送 MJ 请求失败
44 | */
45 | SYS_SEND_MJ_REQUEST_FAILURE(6),
46 |
47 | /**
48 | * (最终状态)系统完成 MJ 执行中任务失败
49 | */
50 | SYS_FINISH_MJ_IN_PROGRESS_FAILURE(7),
51 |
52 | /* 下面为进入 MJ 后的参数 */
53 |
54 | /**
55 | * (中间状态)等待 MJ 接收消息
56 | */
57 | MJ_WAIT_RECEIVED(20),
58 |
59 | /**
60 | * (中间状态)MJ 执行中
61 | */
62 | MJ_IN_PROGRESS(21),
63 |
64 | /**
65 | * (最终状态)MJ 失败
66 | */
67 | MJ_FAILURE(22),
68 |
69 | /**
70 | * (最终状态)MJ 成功
71 | */
72 | MJ_SUCCESS(23);
73 |
74 | @Getter
75 | @EnumValue
76 | private final Integer code;
77 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/OpenAiApiKeyStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/30
10 | * OpenAi ApiKey 状态枚举
11 | */
12 | @AllArgsConstructor
13 | public enum OpenAiApiKeyStatusEnum {
14 |
15 | /**
16 | * 启用
17 | */
18 | ENABLE("enable"),
19 |
20 | /**
21 | * 禁用
22 | * 一般表示暂时不想使用,但是作为启用也是可以访问的
23 | */
24 | DISABLE("disable"),
25 |
26 | /**
27 | * 失效
28 | * 一般表示账号封禁、余额不足等
29 | */
30 | INVALID("invalid");
31 |
32 | @EnumValue
33 | @Getter
34 | private final String code;
35 | }
36 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/OpenAiApiKeyUseSceneEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/30
10 | * OpenAi ApiKey 使用场景枚举
11 | */
12 | @AllArgsConstructor
13 | public enum OpenAiApiKeyUseSceneEnum {
14 |
15 | /**
16 | * GPT 3.5
17 | */
18 | GPT_3_5("GPT3.5"),
19 |
20 | /**
21 | * GPT 4
22 | */
23 | GPT_4("GPT4"),
24 |
25 | /**
26 | * 绘图
27 | */
28 | IMAGE("IMAGE");
29 |
30 | @EnumValue
31 | @Getter
32 | private final String code;
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/RoomOpenAiChatMsgStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023-3-25
10 | * OpenAi 对话房间消息状态枚举
11 | */
12 | @AllArgsConstructor
13 | public enum RoomOpenAiChatMsgStatusEnum {
14 |
15 | /**
16 | * 针对问题
17 | * 初始化,未发送
18 | * 因为发送和接收的速度很快,所以这种初始状态基本上不会有,除非异常情况
19 | */
20 | INIT(0),
21 |
22 | /**
23 | * 针对问题和回答
24 | * 因为是流式回答,所以有部分成功
25 | */
26 | PART_SUCCESS(1),
27 |
28 | /**
29 | * 针对问题和回答
30 | * 消息全部接收完毕
31 | */
32 | COMPLETE_SUCCESS(2),
33 |
34 | /**
35 | * 针对问题和回答
36 | * 消息发送失败
37 | */
38 | ERROR(3),
39 |
40 | /**
41 | * 发送问题
42 | * 问题 Token 超过指定模型上限
43 | */
44 | EXCEPTION_TOKEN_EXCEED_LIMIT(4),
45 |
46 | /**
47 | * 发送问题
48 | * 内容审核不通过
49 | */
50 | CONTENT_CHECK_FAILURE(5);
51 |
52 | @Getter
53 | @EnumValue
54 | private final Integer code;
55 | }
56 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/RoomWxqfChatMsgStatusEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/7/24
10 | * 文心千帆对话房间消息状态枚举
11 | */
12 | @AllArgsConstructor
13 | public enum RoomWxqfChatMsgStatusEnum {
14 |
15 | /**
16 | * 针对问题
17 | * 初始化,未发送
18 | * 因为发送和接收的速度很快,所以这种初始状态基本上不会有,除非异常情况
19 | */
20 | INIT(0),
21 |
22 | /**
23 | * 针对问题和回答
24 | * 因为是流式回答,所以有部分成功
25 | */
26 | PART_SUCCESS(1),
27 |
28 | /**
29 | * 针对问题和回答
30 | * 消息全部接收完毕
31 | */
32 | COMPLETE_SUCCESS(2),
33 |
34 | /**
35 | * 针对问题和回答
36 | * 消息发送失败
37 | */
38 | ERROR(3),
39 |
40 | /**
41 | * 发送问题
42 | * 问题 Token 超过指定模型上限
43 | */
44 | EXCEPTION_TOKEN_EXCEED_LIMIT(4);
45 |
46 | @Getter
47 | @EnumValue
48 | private final Integer code;
49 | }
50 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/SysParamKeyEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/11
9 | * 系统参数 key 枚举
10 | */
11 | @AllArgsConstructor
12 | public enum SysParamKeyEnum {
13 |
14 | /**
15 | * 百度 AI 配置
16 | */
17 | BAIDU_AIP("baidu-aip"),
18 |
19 | /**
20 | * 邮箱配置
21 | */
22 | EMAIL_CONFIG("email-config"),
23 |
24 | /**
25 | * 邮箱注册登录配置
26 | */
27 | EMAIL_REGISTER_LOGIN_CONFIG("email-registerLoginConfig");
28 |
29 | /**
30 | * paramKey
31 | */
32 | @Getter
33 | private final String paramKey;
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/enums/UserExtraBindingTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.enums;
2 |
3 | import com.baomidou.mybatisplus.annotation.EnumValue;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Getter;
6 |
7 | /**
8 | * 用户绑定类型枚举
9 | * 扩展手机号、微信等
10 | *
11 | * @author CoDeleven
12 | */
13 | @AllArgsConstructor
14 | @Getter
15 | public enum UserExtraBindingTypeEnum {
16 |
17 | /**
18 | * 邮箱
19 | */
20 | BIND_EMAIL("email", "邮箱绑定");
21 |
22 | @EnumValue
23 | private final String code;
24 |
25 | private final String desc;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/exception/AuthException.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.exception;
2 |
3 | import com.hncboy.beehive.base.handler.response.IResultCode;
4 | import com.hncboy.beehive.base.handler.response.ResultCode;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023-3-23
10 | * 鉴权异常
11 | */
12 | public class AuthException extends RuntimeException {
13 |
14 | @Getter
15 | private final IResultCode resultCode;
16 |
17 | public AuthException(String message) {
18 | super(message);
19 | this.resultCode = ResultCode.UN_AUTHORIZED;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/exception/ServiceException.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.exception;
2 |
3 | import com.hncboy.beehive.base.handler.response.IResultCode;
4 | import com.hncboy.beehive.base.handler.response.ResultCode;
5 | import lombok.Getter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023-3-23
10 | * 业务异常
11 | */
12 | public class ServiceException extends RuntimeException {
13 |
14 | @Getter
15 | private final IResultCode resultCode;
16 |
17 | public ServiceException(String message) {
18 | super(message);
19 | this.resultCode = ResultCode.FAILURE;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/mp/BeehiveServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.mp;
2 |
3 | import com.hncboy.beehive.base.domain.query.CursorQuery;
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/28
13 | * 自定义 ServiceImpl
14 | */
15 | public class BeehiveServiceImpl, T> extends ServiceImpl implements IBeehiveService {
16 |
17 | @Override
18 | public List cursorList(CursorQuery cursorQuery, SFunction columnFunction, LambdaQueryWrapper queryWrapper) {
19 | return baseMapper.cursorList(cursorQuery, columnFunction, queryWrapper);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/mp/IBeehiveService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.mp;
2 |
3 | import com.hncboy.beehive.base.domain.query.CursorQuery;
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 | import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
6 | import com.baomidou.mybatisplus.extension.service.IService;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/28
13 | * 自定义 IService
14 | */
15 | public interface IBeehiveService extends IService {
16 |
17 | /**
18 | * 游标查询方法
19 | *
20 | * @param cursorQuery 游标查询对象
21 | * @param columnFunction 用于获取游标的字段
22 | * @param queryWrapper 查询条件
23 | * @return 查询结果列表
24 | */
25 | List cursorList(CursorQuery cursorQuery, SFunction columnFunction, LambdaQueryWrapper queryWrapper);
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/response/IResultCode.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.response;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023-3-23
6 | * 结果状态码接口
7 | */
8 | public interface IResultCode {
9 |
10 | /**
11 | * 获取消息
12 | *
13 | * @return 消息
14 | */
15 | String getMessage();
16 |
17 | /**
18 | * 获取状态码
19 | *
20 | * @return 状态码
21 | */
22 | int getCode();
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/response/ResultCode.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.response;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 |
6 | import jakarta.servlet.http.HttpServletResponse;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023-3-23
11 | * 结果状态码
12 | */
13 | @Getter
14 | @AllArgsConstructor
15 | public enum ResultCode implements IResultCode {
16 |
17 | /**
18 | * 操作成功
19 | */
20 | SUCCESS(HttpServletResponse.SC_OK, "操作成功"),
21 |
22 | /**
23 | * 业务异常
24 | */
25 | FAILURE(HttpServletResponse.SC_BAD_REQUEST, "业务异常"),
26 |
27 | /**
28 | * 请求未授权
29 | */
30 | UN_AUTHORIZED(HttpServletResponse.SC_UNAUTHORIZED, "请求未授权"),
31 |
32 | /**
33 | * 服务器异常
34 | */
35 | INTERNAL_SERVER_ERROR(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "服务器异常");
36 |
37 | /**
38 | * 状态码
39 | */
40 | private final int code;
41 |
42 | /**
43 | * 信息
44 | */
45 | private final String message;
46 | }
47 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/serializer/DateFormatterSerializer.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.serializer;
2 |
3 | import cn.hutool.core.date.DateUtil;
4 | import com.fasterxml.jackson.core.JsonGenerator;
5 | import com.fasterxml.jackson.databind.JsonSerializer;
6 | import com.fasterxml.jackson.databind.SerializerProvider;
7 |
8 | import java.io.IOException;
9 | import java.util.Date;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023-4-1
14 | * 日期格式化序列化
15 | */
16 | public class DateFormatterSerializer extends JsonSerializer {
17 |
18 | @Override
19 | public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
20 | jsonGenerator.writeString(DateUtil.formatDateTime(date));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/serializer/FilePathPrefixSerializer.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.serializer;
2 |
3 | import com.hncboy.beehive.base.util.FileUtil;
4 | import cn.hutool.core.util.StrUtil;
5 | import com.fasterxml.jackson.core.JsonGenerator;
6 | import com.fasterxml.jackson.databind.JsonSerializer;
7 | import com.fasterxml.jackson.databind.SerializerProvider;
8 |
9 | import java.io.IOException;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/6/26
14 | * 文件路径前缀序列化
15 | */
16 | public class FilePathPrefixSerializer extends JsonSerializer {
17 |
18 | @Override
19 | public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
20 | if (StrUtil.isBlank(s)) {
21 | return;
22 | }
23 | jsonGenerator.writeString(FileUtil.getFilePathVisitPrefix().concat(s));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/handler/serializer/LongToStringSerializer.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.handler.serializer;
2 |
3 | import com.fasterxml.jackson.core.JsonGenerator;
4 | import com.fasterxml.jackson.databind.JsonSerializer;
5 | import com.fasterxml.jackson.databind.SerializerProvider;
6 |
7 | import java.io.IOException;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023-4-1
12 | * Long 转 String
13 | */
14 | public class LongToStringSerializer extends JsonSerializer {
15 |
16 | @Override
17 | public void serialize(Long value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
18 | gen.writeString(String.valueOf(value));
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/CellConfigMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellConfigDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author CoDeleven
8 | * @date 2023/5/25
9 | * cell 配置项数据访问层
10 | */
11 | public interface CellConfigMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/CellConfigPermissionMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellConfigPermissionDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/1
9 | * cell 配置项权限数据访问层
10 | */
11 | public interface CellConfigPermissionMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/CellMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author CoDeleven
8 | * @date 2023/5/25
9 | * cell 数据访问层
10 | */
11 | public interface CellMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/CellPermissionMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellPermissionDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/1
9 | * cell 权限数据访问层
10 | */
11 | public interface CellPermissionMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/EmailVerifyCodeMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.EmailVerifyCodeDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * 邮箱验证码核销记录数据访问层
8 | *
9 | * @author CoDeleven
10 | */
11 | public interface EmailVerifyCodeMapper extends BaseMapper {
12 |
13 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/FrontUserBaseMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.FrontUserBaseDO;
5 |
6 | /**
7 | * 前端基础用户数据访问层
8 | *
9 | * @author CoDeleven
10 | * @date 2023.4.8
11 | */
12 | public interface FrontUserBaseMapper extends BaseMapper {
13 | }
14 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/FrontUserExtraBindingMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.FrontUserExtraBindingDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author codeleven
8 | * 前端用户绑定数据访问层
9 | */
10 | public interface FrontUserExtraBindingMapper extends BaseMapper {
11 |
12 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/FrontUserExtraEmailMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.FrontUserExtraEmailDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author CoDeleven
8 | * 前端用户邮箱登录数据访问层
9 | */
10 | public interface FrontUserExtraEmailMapper extends BaseMapper {
11 |
12 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/OpenAiApiKeyMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.OpenAiApiKeyDO;
4 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/30
9 | * OpenAi ApkKey 数据访问层
10 | */
11 | public interface OpenAiApiKeyMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomBingMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomBingDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/26
9 | * NewBing 房间数据访问层
10 | */
11 | public interface RoomBingMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomBingMsgMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.RoomBingMsgDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/26
9 | * NewBing 房间消息数据访问层
10 | */
11 | public interface RoomBingMsgMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomConfigParamMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomConfigParamDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author CoDeleven
8 | * @date 2023/5/25
9 | * 房间配置项参数数据访问层
10 | */
11 | public interface RoomConfigParamMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/29
9 | * 房间数据访问层
10 | */
11 | public interface RoomMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomMidjourneyMsgMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.RoomMidjourneyMsgDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/18
9 | * Midjourney 房间消息数据访问层
10 | */
11 | public interface RoomMidjourneyMsgMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomOpenAiChatMsgMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatMsgDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/31
9 | * OpenAi 对话房间消息数据访问层
10 | */
11 | public interface RoomOpenAiChatMsgMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomOpenAiChatWebMsgMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatWebMsgDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/1
9 | * OpenAi 对话 Web 房间消息数据访问层
10 | */
11 | public interface RoomOpenAiChatWebMsgMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomOpenAiImageMsgMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiImageMsgDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/3
9 | * OpenAi 图像房间消息数据访问层
10 | */
11 | public interface RoomOpenAiImageMsgMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/RoomWxqfChatMsgMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomWxqfChatMsgDO;
4 | import com.hncboy.beehive.base.handler.mp.BeehiveBaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/7/24
9 | * 文心千帆对话房间消息数据访问层
10 | */
11 | public interface RoomWxqfChatMsgMapper extends BeehiveBaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/SensitiveWordMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 | import com.hncboy.beehive.base.domain.entity.SensitiveWordDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023-3-28
9 | * 敏感词数据库访问层
10 | */
11 | public interface SensitiveWordMapper extends BaseMapper {
12 |
13 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/SysEmailSendLogMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.SysEmailSendLogDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * 邮箱发送日志数据访问层
8 | *
9 | * @author CoDeleven
10 | */
11 | public interface SysEmailSendLogMapper extends BaseMapper {
12 |
13 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/SysFrontUserLoginLogMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.SysFrontUserLoginLogDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * 前端用户登录日志数据访问层
8 | *
9 | * @author CoDeleven
10 | */
11 | public interface SysFrontUserLoginLogMapper extends BaseMapper {
12 |
13 | }
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/mapper/SysParamMapper.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.mapper;
2 |
3 | import com.hncboy.beehive.base.domain.entity.SysParamDO;
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/10
9 | * 系统参数数据访问层
10 | */
11 | public interface SysParamMapper extends BaseMapper {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/resource/aip/AipContentResult.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.resource.aip;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/6/6
8 | * 百度内容审核结果,返回值看文档
9 | * https://cloud.baidu.com/doc/ANTIPORN/s/Nk3h6xbb2
10 | */
11 | @Data
12 | public class AipContentResult {
13 |
14 | //... 省略其他字段
15 |
16 | /**
17 | * 审核结果类型 1.合规,2.不合规,3.疑似,4.审核失败
18 | */
19 | private Integer conclusionType;
20 |
21 | /**
22 | * 内层错误提示信息,底层服务失败才返回,成功不返回
23 | */
24 | private String errorMsg;
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/resource/aip/BaiduAipConfig.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.resource.aip;
2 |
3 | import com.baidu.aip.contentcensor.AipContentCensor;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/6/26
11 | * 百度 AI 配置
12 | */
13 | @Slf4j
14 | @Configuration
15 | public class BaiduAipConfig {
16 |
17 | @Bean
18 | public AipContentCensor aipContentCensor() {
19 | BaiduAipProperties baiduAipProperties = BaiduAipUtil.getBaiduAipProperties();
20 | log.info("百度 AI 配置初始化:{}", baiduAipProperties);
21 | // 项目启动时初始化,如果要修改配置,需要重启项目
22 | return new AipContentCensor(baiduAipProperties.getAppId(), baiduAipProperties.getAppKey(), baiduAipProperties.getSecretKey());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/resource/aip/BaiduAipProperties.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.resource.aip;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/6/6
8 | * @see 控制台。
9 | * 百度 AI 配置参数
10 | */
11 | @Data
12 | public class BaiduAipProperties {
13 |
14 | /**
15 | * 是否启用
16 | */
17 | private Boolean enabled;
18 |
19 | /**
20 | * appId
21 | */
22 | private String appId;
23 |
24 | /**
25 | * appKey
26 | */
27 | private String appKey;
28 |
29 | /**
30 | * secretKey
31 | */
32 | private String secretKey;
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/resource/aip/BaiduAipUtil.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.resource.aip;
2 |
3 | import com.hncboy.beehive.base.util.ObjectMapperUtil;
4 | import com.hncboy.beehive.base.cache.SysParamCache;
5 | import com.hncboy.beehive.base.enums.SysParamKeyEnum;
6 | import lombok.experimental.UtilityClass;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/6/26
11 | * 百度 AIP 工具类
12 | */
13 | @UtilityClass
14 | public class BaiduAipUtil {
15 |
16 | /**
17 | * 获取 BaiduAipProperties
18 | *
19 | * @return BaiduAipProperties
20 | */
21 | public BaiduAipProperties getBaiduAipProperties() {
22 | String baiduAipConfigStr = SysParamCache.get(SysParamKeyEnum.BAIDU_AIP);
23 | return ObjectMapperUtil.fromJson(baiduAipConfigStr, BaiduAipProperties.class);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/resource/email/EmailConfig.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.resource.email;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * 邮箱参数配置
7 | *
8 | * @author CoDeleven
9 | */
10 | @Data
11 | public class EmailConfig {
12 |
13 | /**
14 | * SMTP 服务器域名
15 | */
16 | private String host;
17 |
18 | /**
19 | * 邮箱服务器端口
20 | */
21 | private Integer port;
22 |
23 | /**
24 | * 发件邮箱地址
25 | */
26 | private String from;
27 |
28 | /**
29 | * 发件人名称
30 | */
31 | private String user;
32 |
33 | /**
34 | * 授权码
35 | */
36 | private String pass;
37 |
38 | /**
39 | * 是否需要授权
40 | */
41 | private Boolean auth;
42 |
43 | /**
44 | * 是否启用 SSL
45 | */
46 | private Boolean sslEnable;
47 |
48 | /**
49 | * 是否启用 STARTTTLS
50 | */
51 | private Boolean startttlsEnable;
52 | }
53 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/resource/package-info.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.resource;
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/util/ForestRequestUtil.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.util;
2 |
3 | import com.hncboy.beehive.base.config.ProxyConfig;
4 | import cn.hutool.extra.spring.SpringUtil;
5 | import com.dtflys.forest.http.ForestProxy;
6 | import com.dtflys.forest.http.ForestRequest;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/24
11 | * ForestRequestUtil
12 | */
13 | public class ForestRequestUtil {
14 |
15 | /**
16 | * 构建代理
17 | *
18 | * @param forestRequest 请求
19 | */
20 | public static void buildProxy(ForestRequest> forestRequest) {
21 | ProxyConfig proxyConfig = SpringUtil.getBean(ProxyConfig.class);
22 | if (!proxyConfig.getEnabled()) {
23 | return;
24 | }
25 | forestRequest.proxy(new ForestProxy(proxyConfig.getHttpHost(), proxyConfig.getHttpPort()));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/util/PageUtil.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.util;
2 |
3 | import cn.hutool.core.bean.BeanUtil;
4 | import com.baomidou.mybatisplus.core.metadata.IPage;
5 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 | import lombok.experimental.UtilityClass;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023-3-27
13 | * 分页工具
14 | */
15 | @UtilityClass
16 | public class PageUtil {
17 |
18 | /**
19 | * IPage 转 Page
20 | *
21 | * @param page IPage
22 | * @param target 需要 copy 转换的类型
23 | * @param 泛型
24 | * @return PageResult
25 | */
26 | public static Page toPage(IPage> page, Class target) {
27 | return toPage(page, BeanUtil.copyToList(page.getRecords(), target));
28 | }
29 |
30 | /**
31 | * IPage 转 Page
32 | *
33 | * @param page IPage
34 | * @param records 转换过的 List 模型
35 | * @param 泛型
36 | * @return PageResult
37 | */
38 | public static Page toPage(IPage> page, List records) {
39 | Page pageResult = new Page<>();
40 | pageResult.setCurrent(page.getCurrent());
41 | pageResult.setSize(page.getSize());
42 | pageResult.setPages(page.getPages());
43 | pageResult.setTotal(page.getTotal());
44 | pageResult.setRecords(records);
45 | return pageResult;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/util/ResponseBodyEmitterUtil.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.util;
2 |
3 | import com.hncboy.beehive.base.handler.response.R;
4 | import com.hncboy.beehive.base.exception.ServiceException;
5 | import cn.hutool.core.util.StrUtil;
6 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/31
11 | * ResponseBodyEmitter 工具类
12 | */
13 | public class ResponseBodyEmitterUtil {
14 |
15 | /**
16 | * 发送 emitter 消息
17 | *
18 | * @param emitter 响应流
19 | * @param object 消息
20 | */
21 | public static void send(ResponseBodyEmitter emitter, Object object) {
22 | try {
23 | String content;
24 | if (object instanceof R) {
25 | content = ObjectMapperUtil.toJson(object);
26 | } else {
27 | content = ObjectMapperUtil.toJson(R.data(object));
28 | }
29 | // 消息末尾加上换行符
30 | emitter.send(content + "\n");
31 | } catch (Exception e) {
32 | throw new ServiceException(StrUtil.format("消息发送异常,异常信息:{}", e.getMessage()));
33 | }
34 | }
35 |
36 | /**
37 | * 发送 emitter 消息并且结束
38 | *
39 | * @param emitter 响应流
40 | * @param object 消息
41 | */
42 | public static void sendWithComplete(ResponseBodyEmitter emitter, Object object) {
43 | try {
44 | send(emitter, object);
45 | } finally {
46 | emitter.complete();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/util/StpAdminUtil.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.util;
2 |
3 | import cn.dev33.satoken.stp.StpLogic;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023-4-16
8 | * 填写注释
9 | */
10 | public class StpAdminUtil {
11 |
12 | /**
13 | * 账号类型标识
14 | */
15 | public static final String TYPE = "admin";
16 |
17 | /**
18 | * 底层的 StpLogic 对象
19 | */
20 | public static StpLogic stpLogic = new StpLogic(TYPE);
21 |
22 | /**
23 | * 检验当前会话是否已经登录,如未登录,则抛出异常
24 | */
25 | public static void checkLogin() {
26 | stpLogic.checkLogin();
27 | }
28 |
29 | // ------------------- 登录相关操作 -------------------
30 |
31 | // --- 登录
32 |
33 | /**
34 | * 会话登录
35 | * @param id 账号id,建议的类型:(long | int | String)
36 | */
37 | public static void login(Object id) {
38 | stpLogic.login(id);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/beehive-base/src/main/java/com/hncboy/beehive/base/util/ThrowExceptionUtil.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.base.util;
2 |
3 | import com.hncboy.beehive.base.exception.ServiceException;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023-3-28
8 | * 异常抛出工具类
9 | */
10 | public class ThrowExceptionUtil {
11 |
12 | /**
13 | * 如果参数为 true 抛出异常
14 | *
15 | * @param result true/false
16 | * @return ThrowExceptionFunction
17 | **/
18 | public static ThrowExceptionFunction isTrue(boolean result) {
19 | return (errorMessage) -> {
20 | if (result) {
21 | throw new ServiceException(errorMessage);
22 | }
23 | };
24 | }
25 |
26 | /**
27 | * 如果参数为 false 抛出异常
28 | *
29 | * @param result true/false
30 | * @return ThrowExceptionFunction
31 | **/
32 | public static ThrowExceptionFunction isFalse(boolean result) {
33 | return (errorMessage) -> {
34 | if (!result) {
35 | throw new ServiceException(errorMessage);
36 | }
37 | };
38 | }
39 |
40 | @FunctionalInterface
41 | public interface ThrowExceptionFunction {
42 |
43 | /**
44 | * 抛出异常信息
45 | *
46 | * @param message 异常信息
47 | **/
48 | void throwMessage(String message);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/beehive-bootstrap/src/main/java/com/hncboy/beehive/BeehiveApplication.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
7 | import org.springframework.scheduling.annotation.EnableScheduling;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023-3-22
12 | * BeehiveApplication
13 | */
14 | @EnableScheduling
15 | @MapperScan(value = {"com.hncboy.beehive.**.mapper"})
16 | @SpringBootApplication(nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class)
17 | public class BeehiveApplication {
18 |
19 | public static void main(String[] args) {
20 | SpringApplication.run(BeehiveApplication.class, args);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/beehive-bootstrap/src/main/resources/application.yaml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 3006
3 | spring:
4 | profiles:
5 | active: dev
--------------------------------------------------------------------------------
/beehive-bootstrap/src/main/resources/banner.txt:
--------------------------------------------------------------------------------
1 | _ _ _ _
2 | __ _(_) | |__ ___ ___| |__ (_)_ _____
3 | / _` | |_____| '_ \ / _ \/ _ \ '_ \| \ \ / / _ \
4 | | (_| | |_____| |_) | __/ __/ | | | |\ V / __/
5 | \__,_|_| |_.__/ \___|\___|_| |_|_| \_/ \___|
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.hncboy
6 | beehive-cell
7 | ${revision}
8 |
9 | beehive-cell-bing
10 |
11 |
12 |
13 | com.hncboy
14 | beehive-cell-core
15 | ${project.version}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/constant/NewBingConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/6/18
6 | * NewBing 常量
7 | */
8 | public class NewBingConstant {
9 |
10 | /**
11 | * 响应成功
12 | */
13 | public static final String RESPONSE_SUCCESS = "Success";
14 | }
15 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/bo/BingApiCreateConversationResultBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.bo;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/5/26
8 | * Bing Api 创建对话结果
9 | * {
10 | * conversationId: "51D|BingProd|D67BA9D1053F878DE6493F8F20188A931149EF52732504108294ECC6A9D582C4",
11 | * clientId: "985154382934072",
12 | * conversationSignature: "RGq5JeRrPzjZw+W26Mv2jkdPSRhg0erNZ4SVkDvfUYg=",
13 | * result: {
14 | * value: "Success",
15 | * message: null
16 | * }
17 | * }
18 | */
19 | @Data
20 | public class BingApiCreateConversationResultBO {
21 |
22 | private String conversationId;
23 | private String clientId;
24 | private String conversationSignature;
25 | private Result result;
26 |
27 | @Data
28 | public static class Result {
29 | private String value;
30 | private String message;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/bo/BingApiSendMessageResultBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.bo;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.Date;
6 | import java.util.List;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/26
11 | * BingApi 发送消息响应参数
12 | */
13 | @Data
14 | public class BingApiSendMessageResultBO {
15 |
16 | /**
17 | * 消息内容
18 | */
19 | private String text;
20 |
21 | /**
22 | * user 或 bot
23 | */
24 | private String author;
25 |
26 | /**
27 | * 消息创建时间
28 | */
29 | private Date createdAt;
30 |
31 | /**
32 | * en-us
33 | */
34 | private String regin;
35 |
36 | /**
37 | * 建议
38 | */
39 | private List suggestedResponses;
40 |
41 | /**
42 | * bot 回复的详细信息
43 | */
44 | private List sourceAttributions;
45 |
46 | @Data
47 | public static class SuggestedResponse {
48 |
49 | /**
50 | * 消息内容
51 | */
52 | private String text;
53 | }
54 |
55 | @Data
56 | public static class SourceAttribution {
57 |
58 | /**
59 | * 更多的链接
60 | */
61 | private String seeMoreUrl;
62 |
63 | /**
64 | * 展示的名称
65 | */
66 | private String providerDisplayName;
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/bo/BingApiSendThrottlingResultBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.bo;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/5/26
8 | * BingApi 节流响应参数
9 | */
10 | @Data
11 | public class BingApiSendThrottlingResultBO {
12 |
13 | /**
14 | * 用户最大提问次数
15 | * TODO 有时候是 5,有时候是 10,20,但是一般都是 5,官方的 20 要怎么复现?
16 | */
17 | private Integer maxNumUserMessagesInConversation;
18 |
19 | /**
20 | * 用户当前提问次数
21 | */
22 | private Integer numUserMessagesInConversation;
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/bo/BingApiSendType1ResultBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.bo;
2 |
3 | import lombok.Data;
4 |
5 | import java.util.List;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/5/26
10 | * BingApi type=1 参数
11 | * 情况 1 消息不考虑,情况 2 就是流式消息了
12 | * 情况 1:{"type":1,"target":"update","arguments":[{"requestId":"949c29a8-d9f0-4828-865f-8133e34f9519","throttling":{"maxNumUserMessagesInConversation":5,"numUserMessagesInConversation":1}}]}
13 | * 情况 2:{"type":1,"target":"update","arguments":[{"messages":[{"text":"你","author":"bot","createdAt":"2023-05-26T12:38:17.9978221+00:00","timestamp":"2023-05-26T12:38:17.9978221+00:00","messageId":"5d91d7e3-bddd-4dfa-9ee6-d6c54a9ac81c","offense":"Unknown","adaptiveCards":[{"type":"AdaptiveCard","version":"1.0","body":[{"type":"TextBlock","text":"你","wrap":true}]}],"sourceAttributions":[],"feedback":{"tag":null,"updatedOn":null,"type":"None"},"contentOrigin":"DeepLeo","privacy":null}],"requestId":"dce0660c-660e-4068-bd53-da57cb9f441f"}]}*/
14 | @Data
15 | public class BingApiSendType1ResultBO {
16 |
17 | // 省略其他参数
18 |
19 | private Integer type;
20 | private List arguments;
21 |
22 | @Data
23 | public static class Argument {
24 | private List messages;
25 | private BingApiSendThrottlingResultBO throttling;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/bo/BingApiSendTypeResultBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.bo;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/5/26
8 | * BingApi 发送消息响应参数
9 | */
10 | @Data
11 | public class BingApiSendTypeResultBO {
12 |
13 | private Integer type;
14 | }
15 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/bo/BingRoomBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.bo;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomBingDO;
4 | import lombok.Data;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/28
9 | * Bing 房间业务信息
10 | */
11 | @Data
12 | public class BingRoomBO {
13 |
14 | /**
15 | * 房间实体信息
16 | */
17 | private RoomBingDO roomBingDO;
18 |
19 | /**
20 | * 是否是新话题
21 | */
22 | private Boolean isNewTopic;
23 |
24 | /**
25 | * 刷新房间原因
26 | */
27 | private String refreshRoomReason;
28 | }
29 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/request/RoomBingMsgSendRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import jakarta.validation.constraints.Size;
6 | import lombok.Data;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/26
11 | * Bing 房间消息发送参数
12 | */
13 | @Data
14 | @Schema(title = "Bing 房间消息发送参数")
15 | public class RoomBingMsgSendRequest {
16 |
17 | @NotNull(message = "房间 id 不能为空")
18 | @Schema(title = "房间 id")
19 | private Long roomId;
20 |
21 | @Size(min = 1, max = 5000, message = "消息内容长度必须在 1-5000 之间")
22 | @NotNull(message = "消息内容不能为空")
23 | @Schema(title = "消息内容")
24 | private String content;
25 |
26 | /**
27 | * 换模式会自动开启新话题
28 | */
29 | @NotNull(message = "是否开启新话题不能为空")
30 | @Schema(title = "是否开启新话题")
31 | private Boolean isNewTopic;
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/vo/RoomBingMsgVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.MessageTypeEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 |
7 | import java.util.Date;
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/26
13 | * Bing 房间消息展示参数
14 | */
15 | @Data
16 | @Schema(title = "Bing 房间消息展示参数")
17 | public class RoomBingMsgVO {
18 |
19 | @Schema(title = "主键")
20 | private Long id;
21 |
22 | @Schema(title = "消息内容")
23 | private String content;
24 |
25 | @Schema(title = "最大提问次数")
26 | private Integer maxNumUserMessagesInConversation;
27 |
28 | @Schema(title = "累计提问次数")
29 | private Integer numUserMessagesInConversation;
30 |
31 | @Schema(title = "建议")
32 | private List suggestResponses;
33 |
34 | @Schema(title = "消息类型")
35 | private MessageTypeEnum type;
36 |
37 | @Schema(title = "创建时间")
38 | private Date createTime;
39 | }
40 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/domain/vo/RoomBingStreamMsgVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.domain.vo;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/5/26
14 | * Bing 房间流式消息
15 | */
16 | @Builder
17 | @NoArgsConstructor
18 | @AllArgsConstructor
19 | @Data
20 | @Schema(title = "Bing 房间流式消息")
21 | public class RoomBingStreamMsgVO {
22 |
23 | @Schema(title = "内容")
24 | private String content;
25 |
26 | @Schema(title = "最大提问次数")
27 | private Integer maxNumUserMessagesInConversation;
28 |
29 | @Schema(title = "累计提问次数")
30 | private Integer numUserMessagesInConversation;
31 |
32 | @Schema(title = "建议")
33 | private List suggests;
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/enums/BingModeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.enums;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 |
6 | import java.util.Map;
7 | import java.util.function.Function;
8 | import java.util.stream.Collectors;
9 | import java.util.stream.Stream;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/5/30
14 | * NewBing 模式枚举
15 | */
16 | @AllArgsConstructor
17 | public enum BingModeEnum {
18 |
19 | /**
20 | * 均衡模式
21 | */
22 | BALANCE("balance", 200),
23 |
24 | /**
25 | * 准确模式
26 | */
27 | PRECISE("precise", 4000),
28 |
29 | /**
30 | * 创造模式
31 | */
32 | CREATIVE("creative", 4000);
33 |
34 | @Getter
35 | private final String name;
36 |
37 | /**
38 | * 限制的字数
39 | */
40 | @Getter
41 | private final Integer limitWords;
42 |
43 | /**
44 | * name 作为 key,封装为 Map
45 | */
46 | public static final Map NAME_MAP = Stream
47 | .of(BingModeEnum.values())
48 | .collect(Collectors.toMap(BingModeEnum::getName, Function.identity()));
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/handler/BingCellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.handler;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.bing.enums.BingCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/29
12 | * NewBing cell 配置项策略
13 | */
14 | @Component
15 | public class BingCellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.NEW_BING;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return BingCellConfigCodeEnum.class;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/service/RoomBingMsgService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomBingMsgDO;
4 | import com.hncboy.beehive.base.domain.query.RoomMsgCursorQuery;
5 | import com.hncboy.beehive.base.handler.mp.IBeehiveService;
6 | import com.hncboy.beehive.cell.bing.domain.request.RoomBingMsgSendRequest;
7 | import com.hncboy.beehive.cell.bing.domain.vo.RoomBingMsgVO;
8 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author hncboy
14 | * @date 2023/5/26
15 | * NewBing 房间消息业务接口
16 | */
17 | public interface RoomBingMsgService extends IBeehiveService {
18 |
19 | /**
20 | * 查询消息列表
21 | *
22 | * @param cursorQuery 请求参数
23 | * @return 消息列表
24 | */
25 | List list(RoomMsgCursorQuery cursorQuery);
26 |
27 | /**
28 | * 发送消息
29 | *
30 | * @param sendRequest 请求参数
31 | * @return 响应参数
32 | */
33 | ResponseBodyEmitter send(RoomBingMsgSendRequest sendRequest);
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/java/com/hncboy/beehive/cell/bing/service/RoomBingService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.bing.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomBingDO;
4 | import com.hncboy.beehive.cell.bing.domain.bo.BingRoomBO;
5 | import com.hncboy.beehive.cell.bing.domain.request.RoomBingMsgSendRequest;
6 | import com.baomidou.mybatisplus.extension.service.IService;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/26
11 | * NewBing 房间业务接口
12 | */
13 | public interface RoomBingService extends IService {
14 |
15 | /**
16 | * 获取房间信息
17 | *
18 | * @param roomId 房间 id
19 | * @param sendRequest 发送消息请求
20 | * @return 房间业务信息
21 | */
22 | BingRoomBO getRoom(Long roomId, RoomBingMsgSendRequest sendRequest);
23 |
24 | /**
25 | * 刷新房间业务信息
26 | *
27 | * @param bingRoomBO 房间业务信息
28 | * @return 房间业务信息
29 | */
30 | BingRoomBO refreshRoom(BingRoomBO bingRoomBO);
31 | }
32 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/resources/bing/options_balance.json:
--------------------------------------------------------------------------------
1 | [
2 | "nlu_direct_response_filter",
3 | "deepleo",
4 | "disable_emoji_spoken_text",
5 | "responsible_ai_policy_235",
6 | "enablemm",
7 | "galileo",
8 | "oaimxcnk512",
9 | "rweasgv2",
10 | "dv3sugg",
11 | "autosave",
12 | "saharagenconv5"
13 | ]
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/resources/bing/options_creative.json:
--------------------------------------------------------------------------------
1 | [
2 | "nlu_direct_response_filter",
3 | "deepleo",
4 | "disable_emoji_spoken_text",
5 | "responsible_ai_policy_235",
6 | "enablemm",
7 | "h3imaginative",
8 | "oaimxcnk512",
9 | "rweasgv2",
10 | "dv3sugg",
11 | "autosave",
12 | "gencontentv3"
13 | ]
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/resources/bing/options_precise.json:
--------------------------------------------------------------------------------
1 | [
2 | "nlu_direct_response_filter",
3 | "deepleo",
4 | "disable_emoji_spoken_text",
5 | "responsible_ai_policy_235",
6 | "enablemm",
7 | "h3precise",
8 | "oaimxcnk512",
9 | "rweasgv2",
10 | "dv3sugg",
11 | "autosave",
12 | "clgalileo",
13 | "gencontentv3"
14 | ],
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-bing/src/main/resources/bing/send.json:
--------------------------------------------------------------------------------
1 | {
2 | "arguments": [
3 | {
4 | "source": "cib",
5 | "optionsSets": "$optionsSets",
6 | "isStartOfSession": "$isStartOfSession",
7 | "message": {
8 | "author": "user",
9 | "inputMethod": "Keyboard",
10 | "text": "$prompt",
11 | "messageType": "Chat"
12 | },
13 | "conversationId": "$conversationId",
14 | "conversationSignature": "$conversationSignature",
15 | "participant": {
16 | "id": "$clientId"
17 | }
18 | }
19 | ],
20 | "invocationId": "1",
21 | "target": "chat",
22 | "type": 4
23 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.hncboy
6 | beehive-cell
7 | ${revision}
8 |
9 | beehive-cell-core
10 |
11 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/annotation/CellConfigCheck.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.annotation;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/10
12 | * Cell 配置项校验
13 | */
14 | @Target({ElementType.METHOD})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Documented
17 | public @interface CellConfigCheck {
18 |
19 | /**
20 | * 房间 id
21 | */
22 | String roomId() default "";
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/cache/CellCache.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.cache;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellDO;
4 | import com.hncboy.beehive.base.enums.CellCodeEnum;
5 | import com.hncboy.beehive.cell.core.service.CellService;
6 | import cn.hutool.extra.spring.SpringUtil;
7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/14
12 | * Cell 相关缓存
13 | */
14 | public class CellCache {
15 |
16 | /**
17 | * 获取 cell 缓存
18 | * TODO 缓存补充
19 | *
20 | * @param cellCodeEnum cell 编码
21 | * @return cell 缓存
22 | */
23 | public static CellDO getCell(CellCodeEnum cellCodeEnum) {
24 | return SpringUtil.getBean(CellService.class)
25 | .getOne(new LambdaQueryWrapper().eq(CellDO::getCode, cellCodeEnum));
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/cache/CellConfigCache.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.cache;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellConfigDO;
4 | import com.hncboy.beehive.base.enums.CellCodeEnum;
5 | import com.hncboy.beehive.cell.core.service.CellConfigService;
6 | import cn.hutool.extra.spring.SpringUtil;
7 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/6/7
14 | * Cell 配置项缓存
15 | */
16 | public class CellConfigCache {
17 |
18 | /**
19 | * 获取 cell 配置项列表
20 | *
21 | * @param cellCodeEnum cell 配置项编码
22 | * @return cell 配置项列表
23 | */
24 | public static List listCellConfig(CellCodeEnum cellCodeEnum) {
25 | // TODO 缓存
26 | return SpringUtil.getBean(CellConfigService.class)
27 | .list(new LambdaQueryWrapper().eq(CellConfigDO::getCellCode, cellCodeEnum));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/cache/RoomCache.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.cache;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomDO;
4 | import com.hncboy.beehive.cell.core.service.RoomService;
5 | import cn.hutool.extra.spring.SpringUtil;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/8
10 | * 房间相关缓存
11 | */
12 | public class RoomCache {
13 |
14 | /**
15 | * 获取房间信息
16 | * TODO 缓存
17 | *
18 | * @param roomId 房间 id
19 | * @return 房间信息
20 | */
21 | public static RoomDO getRoom(Long roomId) {
22 | RoomService roomService = SpringUtil.getBean(RoomService.class);
23 | return roomService.getById(roomId);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/cache/RoomConfigParamCache.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.cache;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomConfigParamDO;
4 | import com.hncboy.beehive.cell.core.service.RoomConfigParamService;
5 | import cn.hutool.extra.spring.SpringUtil;
6 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/6/8
13 | * 填写注释
14 | */
15 | public class RoomConfigParamCache {
16 |
17 | /**
18 | * 获取房间配置项参数
19 | * TODO 缓存
20 | *
21 | * @param roomId 房间 id
22 | * @return 房间配置项
23 | */
24 | public static List getRoomConfigParam(Long roomId) {
25 | RoomConfigParamService roomConfigParamService = SpringUtil.getBean(RoomConfigParamService.class);
26 | return roomConfigParamService.list(new LambdaQueryWrapper()
27 | .eq(RoomConfigParamDO::getRoomId, roomId));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/constant/CellConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/6/2
6 | * Cell 常量
7 | */
8 | public class CellConstant {
9 | }
10 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/constant/CellPermissionConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/6/2
6 | * Cell 权限常量
7 | */
8 | public class CellPermissionConstant {
9 |
10 | /**
11 | * 代表任意 cell code
12 | */
13 | public static final String ANY_CELL_CODE = "0";
14 |
15 | /**
16 | * 代表任意 cell config code
17 | */
18 | public static final String ANY_CELL_CONFIG_CODE = "0";
19 |
20 | /**
21 | * 代表任意用户 id
22 | */
23 | public static final Integer ANY_USER_ID = 0;
24 | }
25 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/controller/CellConfigController.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.controller;
2 |
3 | import com.hncboy.beehive.base.handler.response.R;
4 | import com.hncboy.beehive.cell.core.domain.vo.CellConfigVO;
5 | import com.hncboy.beehive.cell.core.service.CellConfigService;
6 | import io.swagger.v3.oas.annotations.Operation;
7 | import io.swagger.v3.oas.annotations.tags.Tag;
8 | import lombok.AllArgsConstructor;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestMapping;
11 | import org.springframework.web.bind.annotation.RequestParam;
12 | import org.springframework.web.bind.annotation.RestController;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * @author hncboy
18 | * @date 2023/5/29
19 | * Cell 配置项控制器
20 | */
21 | @AllArgsConstructor
22 | @Tag(name = "Cell 配置项相关接口")
23 | @RequestMapping("/cell_config")
24 | @RestController
25 | public class CellConfigController {
26 |
27 | private final CellConfigService cellConfigService;
28 |
29 | @Operation(summary = "cell 配置项列表")
30 | @GetMapping("/list")
31 | public R> listCellConfig(@RequestParam String cellCode) {
32 | return R.data(cellConfigService.listCellConfig(cellCode));
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/controller/CellController.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.controller;
2 |
3 | import com.hncboy.beehive.base.handler.response.R;
4 | import com.hncboy.beehive.cell.core.domain.vo.CellImageVO;
5 | import com.hncboy.beehive.cell.core.domain.vo.CellVO;
6 | import com.hncboy.beehive.cell.core.service.CellService;
7 | import io.swagger.v3.oas.annotations.Operation;
8 | import io.swagger.v3.oas.annotations.tags.Tag;
9 | import lombok.AllArgsConstructor;
10 | import org.springframework.web.bind.annotation.GetMapping;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.RestController;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * @author hncboy
18 | * @date 2023/5/29
19 | * Cell 控制器
20 | */
21 | @AllArgsConstructor
22 | @Tag(name = "Cell 相关接口")
23 | @RequestMapping("/cell")
24 | @RestController
25 | public class CellController {
26 |
27 | private final CellService cellService;
28 |
29 | @Operation(summary = "cell 列表")
30 | @GetMapping("/list")
31 | public R> listCell() {
32 | return R.data(cellService.listCell());
33 | }
34 |
35 | @Operation(summary = "cell 封面列表")
36 | @GetMapping("/list_image")
37 | public R> listCellImage() {
38 | return R.data(cellService.listCellImage());
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/bo/RoomConfigParamBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.bo;
2 |
3 | import lombok.Data;
4 | import lombok.EqualsAndHashCode;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/7
9 | * 房间配置项参数业务对象
10 | */
11 | @Data
12 | @EqualsAndHashCode(callSuper = false)
13 | public class RoomConfigParamBO extends CellConfigPermissionBO {
14 |
15 | /**
16 | * 最终的值
17 | */
18 | private String value;
19 |
20 | /**
21 | * 用户是否使用默认值,false 否 true 是
22 | */
23 | private Boolean isUseDefaultValue;
24 | }
25 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/query/RoomPageQuery.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.query;
2 |
3 | import com.hncboy.beehive.base.domain.query.PageQuery;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import jakarta.validation.constraints.Size;
6 | import lombok.Data;
7 | import lombok.EqualsAndHashCode;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/29
12 | * 房间分页查询
13 | */
14 | @Data
15 | @EqualsAndHashCode(callSuper = false)
16 | @Schema(title = "房间分页查询")
17 | public class RoomPageQuery extends PageQuery {
18 |
19 | @Schema(title = "名称")
20 | @Size(max = 10, message = "房间名称不能超过 10 个字")
21 | private String name;
22 | }
23 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/request/RoomConfigParamEditRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import lombok.Data;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/3
12 | * 房间配置参数编辑请求参数
13 | */
14 | @Data
15 | @Schema(title = "房间配置参数编辑请求参数")
16 | public class RoomConfigParamEditRequest {
17 |
18 | @NotNull(message = "房间 id 不能为空")
19 | @Schema(title = "房间 id")
20 | private Long roomId;
21 |
22 | @NotNull(message = "房间配置参数列表不能为空")
23 | @Schema(title = "房间配置参数列表")
24 | private List roomConfigParams;
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/request/RoomConfigParamRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import lombok.Data;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/5/29
10 | * 房间配置参数请求参数
11 | */
12 | @Data
13 | @Schema(title = "房间配置参数请求参数")
14 | public class RoomConfigParamRequest {
15 |
16 | @NotNull(message = "配置项 code 不能为空")
17 | @Schema(title = "配置项 code")
18 | private String cellConfigCode;
19 |
20 | @Schema(title = "配置项值,可以为空")
21 | private String value;
22 |
23 | @NotNull(message = "是否使用默认值不能为空")
24 | @Schema(title = "是否使用默认值")
25 | private Boolean isUseDefaultValue;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/request/RoomCreateRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.request;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import jakarta.validation.constraints.NotNull;
6 | import lombok.Data;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/29
13 | * 房间创建请求参数
14 | */
15 | @Data
16 | @Schema(title = "房间创建请求参数")
17 | public class RoomCreateRequest {
18 |
19 | @NotNull(message = "cell code 不能为空")
20 | @Schema(title = "cell code")
21 | private CellCodeEnum cellCode;
22 |
23 | @NotNull(message = "房间信息不能为空")
24 | @Schema(title = "房间信息")
25 | private RoomInfoRequest roomInfo;
26 |
27 | @NotNull(message = "房间配置参数列表不能为空")
28 | @Schema(title = "房间配置参数列表")
29 | private List roomConfigParams;
30 | }
31 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/request/RoomInfoEditRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import lombok.Data;
6 | import lombok.EqualsAndHashCode;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/29
11 | * 编辑房间请求参数
12 | */
13 | @Data
14 | @EqualsAndHashCode(callSuper = false)
15 | @Schema(title = "编辑房间信息请求参数")
16 | public class RoomInfoEditRequest extends RoomInfoRequest {
17 |
18 | @NotNull(message = "房间 id 不能为空")
19 | @Schema(title = "房间 id")
20 | private Long roomId;
21 | }
22 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/request/RoomInfoRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.Valid;
5 | import jakarta.validation.constraints.NotNull;
6 | import jakarta.validation.constraints.Size;
7 | import lombok.Data;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/29
12 | * 房间信息请求参数
13 | */
14 | @Data
15 | @Schema(title = "房间信息请求参数")
16 | @Valid
17 | public class RoomInfoRequest {
18 |
19 | @Size(min = 1, max = 20, message = "房间名称不能超过 20 个字")
20 | @NotNull(message = "房间名称不能为空")
21 | @Schema(title = "房间名称")
22 | private String name;
23 |
24 | @Schema(title = "房间配色")
25 | private String color;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/vo/CellConfigVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.vo;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.Data;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/29
9 | * Cell 配置项展示对象
10 | */
11 | @Data
12 | @Schema(title = "Cell 配置项展示对象")
13 | public class CellConfigVO {
14 |
15 | @Schema(title = "名称")
16 | private String name;
17 |
18 | @Schema(title = "配置项编码")
19 | private String cellConfigCode;
20 |
21 | @Schema(title = "默认值")
22 | private String defaultValue;
23 |
24 | @Schema(title = "示例值")
25 | private String exampleValue;
26 |
27 | @Schema(title = "是否必填,false 否 true 是")
28 | private Boolean isRequired;
29 |
30 | @Schema(title = "是否有默认值,false 否 true 是")
31 | private Boolean isHaveDefaultValue;
32 |
33 | @Schema(title = "用户是否可见默认值,false 否 true 是")
34 | private Boolean isUserValueVisible;
35 |
36 | @Schema(title = "用户是否可修改,false 否 true 是")
37 | private Boolean isUserModifiable;
38 |
39 | @Schema(title = "用户创建房间后是否可修改,false 否 true 是")
40 | private Boolean isUserLiveModifiable;
41 |
42 | @Schema(title = "介绍")
43 | private String introduce;
44 |
45 | @Schema(title = "前端组件类型")
46 | private String frontComponentType;
47 |
48 | @Schema(title = "前端組件内容")
49 | private String frontComponentContent;
50 | }
51 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/vo/CellImageVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/18
10 | * Cell 封面展示对象
11 | */
12 | @Data
13 | @Schema(title = "Cell 封面展示对象")
14 | public class CellImageVO {
15 |
16 | @Schema(title = "封面")
17 | private String imageUrl;
18 |
19 | @Schema(title = "编码")
20 | private CellCodeEnum code;
21 | }
22 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/vo/CellVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.base.enums.CellStatusEnum;
5 | import io.swagger.v3.oas.annotations.media.Schema;
6 | import lombok.Data;
7 |
8 | import java.util.Date;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/29
13 | * Cell 展示对象
14 | */
15 | @Data
16 | @Schema(title = "Cell 展示对象")
17 | public class CellVO {
18 |
19 | @Schema(title = "主键")
20 | private Integer id;
21 |
22 | @Schema(title = "名称")
23 | private String name;
24 |
25 | @Schema(title = "封面")
26 | private String imageUrl;
27 |
28 | @Schema(title = "唯一编码")
29 | private CellCodeEnum code;
30 |
31 | @Schema(title = "状态")
32 | private CellStatusEnum status;
33 |
34 | @Schema(title = "是否能使用,false 否 true 是")
35 | private Boolean isCanUse;
36 |
37 | @Schema(title = "排序,值大的排前面")
38 | private Integer sort;
39 |
40 | @Schema(title = "介绍")
41 | private String introduce;
42 |
43 | @Schema(title = "创建时间")
44 | private Date createTime;
45 | }
46 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/vo/RoomConfigParamVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.vo;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.Data;
5 | import lombok.EqualsAndHashCode;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/6/3
10 | * 房间配置参数展示对象
11 | */
12 | @Data
13 | @EqualsAndHashCode(callSuper = false)
14 | @Schema(title = "房间配置参数展示对象")
15 | public class RoomConfigParamVO extends CellConfigVO {
16 |
17 | @Schema(title = "用户使用的值:默认值或用户自己填的值")
18 | private String value;
19 |
20 | @Schema(title = "用户是否使用默认值,false 否 true 是")
21 | private Boolean isUseDefaultValue;
22 | }
23 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/domain/vo/RoomListVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/29
12 | * 房间列表展示对象
13 | */
14 | @Data
15 | @Schema(title = "房间列表展示对象")
16 | public class RoomListVO {
17 |
18 | @Schema(title = "房间 id")
19 | private Long roomId;
20 |
21 | @Schema(title = "颜色,十六进制")
22 | private String color;
23 |
24 | @Schema(title = "名称")
25 | private String name;
26 |
27 | @Schema(title = "是否固定 false 否 true 是")
28 | private Boolean isPinned;
29 |
30 | @Schema(title = "cell code")
31 | private CellCodeEnum cellCode;
32 |
33 | @Schema(title = "创建时间")
34 | private Date createTime;
35 | }
36 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/hander/converter/CellConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.hander.converter;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellDO;
4 | import com.hncboy.beehive.cell.core.domain.vo.CellImageVO;
5 | import com.hncboy.beehive.cell.core.domain.vo.CellVO;
6 | import org.mapstruct.Mapper;
7 | import org.mapstruct.factory.Mappers;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author Codeleven
13 | * @date 2023/5/25
14 | * Cell 相关转换
15 | */
16 | @Mapper
17 | public interface CellConverter {
18 |
19 | CellConverter INSTANCE = Mappers.getMapper(CellConverter.class);
20 |
21 | /**
22 | * CellDO 转 CellVO
23 | *
24 | * @param cellDO CellDO
25 | * @return CellVO
26 | */
27 | CellVO entityToVO(CellDO cellDO);
28 |
29 | /**
30 | * List 转 List
31 | *
32 | * @param cellDOList List
33 | * @return List
34 | */
35 | List entityToImageVO(List cellDOList);
36 | }
37 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/hander/converter/RoomConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.hander.converter;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomDO;
4 | import com.hncboy.beehive.cell.core.domain.vo.RoomListVO;
5 | import org.mapstruct.AfterMapping;
6 | import org.mapstruct.Mapper;
7 | import org.mapstruct.MappingTarget;
8 | import org.mapstruct.factory.Mappers;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author hncboy
14 | * @date 2023/5/29
15 | * 房间相关转换
16 | */
17 | @Mapper
18 | public interface RoomConverter {
19 |
20 | RoomConverter INSTANCE = Mappers.getMapper(RoomConverter.class);
21 |
22 | /**
23 | * List 转 List
24 | *
25 | * @param roomDOList List
26 | * @return List
27 | */
28 | List entityToListVO(List roomDOList);
29 |
30 | /**
31 | * RoomDO 转 RoomListVO
32 | *
33 | * @param roomDO RoomDO
34 | * @return RoomListVO
35 | */
36 | RoomListVO entityToListVO(RoomDO roomDO);
37 |
38 | /**
39 | * entityToListVO 后置处理
40 | *
41 | * @param roomDO RoomDO
42 | * @param roomListVO RoomListVO
43 | */
44 | @AfterMapping
45 | default void afterEntityToListVO(RoomDO roomDO, @MappingTarget RoomListVO roomListVO) {
46 | roomListVO.setRoomId(roomDO.getId());
47 | roomListVO.setIsPinned(roomDO.getPinTime() > 0);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/hander/strategy/ICellConfigCodeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.hander.strategy;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.domain.bo.RoomConfigParamBO;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/29
11 | * Cell 配置参数枚举接口
12 | */
13 | public interface ICellConfigCodeEnum {
14 |
15 | /**
16 | * 获取配置参数 code
17 | *
18 | * @return 配置参数 code
19 | */
20 | String getCode();
21 |
22 | /**
23 | * 校验单个配置项参数值
24 | *
25 | * @param dataWrapper 配置参数值
26 | */
27 | default void singleValidate(DataWrapper dataWrapper) {
28 |
29 | }
30 |
31 | /**
32 | * 复合校验
33 | * 需要结合其他配置项参数值进行校验
34 | *
35 | * @param roomConfigParamMap 房间配置项参数业务对象 Map
36 | * @param cellCode cellCode
37 | */
38 | default void compositeValidate(Map roomConfigParamMap, CellCodeEnum cellCode) {
39 |
40 | }
41 |
42 | /**
43 | * 复合校验自己的参数
44 | *
45 | * @param roomConfigParamMap 房间配置项参数业务对象 Map
46 | * @param cellCode cellCode
47 | */
48 | default void compositeValidateSelf(Map roomConfigParamMap, CellCodeEnum cellCode) {
49 |
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/CellConfigPermissionService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellConfigPermissionDO;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/1
9 | * cell 配置项权限业务接口
10 | */
11 | public interface CellConfigPermissionService extends IService {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/CellConfigService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellConfigDO;
4 | import com.hncboy.beehive.cell.core.domain.vo.CellConfigVO;
5 | import com.baomidou.mybatisplus.extension.service.IService;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/29
12 | * Cell 配置项业务接口
13 | */
14 | public interface CellConfigService extends IService {
15 |
16 | /**
17 | * cell 配置项列表
18 | *
19 | * @param cellCode cellCode
20 | * @return 列表
21 | */
22 | List listCellConfig(String cellCode);
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/CellPermissionService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellPermissionDO;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/1
9 | * cell 权限业务接口
10 | */
11 | public interface CellPermissionService extends IService {
12 | }
13 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/CellService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellDO;
4 | import com.hncboy.beehive.cell.core.domain.vo.CellImageVO;
5 | import com.hncboy.beehive.cell.core.domain.vo.CellVO;
6 | import com.baomidou.mybatisplus.extension.service.IService;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/29
13 | * Cell 业务接口
14 | */
15 | public interface CellService extends IService {
16 |
17 | /**
18 | * cell 列表
19 | *
20 | * @return cell 列表
21 | */
22 | List listCell();
23 |
24 | /**
25 | * cell 封面列表
26 | *
27 | * @return cell 封面列表
28 | */
29 | List listCellImage();
30 | }
31 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/RoomConfigParamService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomConfigParamDO;
4 | import com.hncboy.beehive.cell.core.domain.request.RoomConfigParamEditRequest;
5 | import com.hncboy.beehive.cell.core.domain.vo.RoomConfigParamVO;
6 | import com.baomidou.mybatisplus.extension.service.IService;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/29
13 | * 房间配置参数业务接口
14 | */
15 | public interface RoomConfigParamService extends IService {
16 |
17 | /**
18 | * 根据房间 id 查询房间配置参数
19 | *
20 | * @param roomId 房间 id
21 | * @return 房间配置项参数列表
22 | */
23 | List list(Long roomId);
24 |
25 | /**
26 | * 编辑房间配置参数
27 | *
28 | * @param request 房间配置参数编辑请求
29 | * @return 房间配置项参数列表
30 | */
31 | List edit(RoomConfigParamEditRequest request);
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/impl/CellConfigPermissionServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service.impl;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellConfigPermissionDO;
4 | import com.hncboy.beehive.base.mapper.CellConfigPermissionMapper;
5 | import com.hncboy.beehive.cell.core.service.CellConfigPermissionService;
6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/1
12 | * cell 配置项权限业务实现类
13 | */
14 | @Service
15 | public class CellConfigPermissionServiceImpl extends ServiceImpl implements CellConfigPermissionService {
16 | }
17 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-core/src/main/java/com/hncboy/beehive/cell/core/service/impl/CellPermissionServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.core.service.impl;
2 |
3 | import com.hncboy.beehive.base.domain.entity.CellPermissionDO;
4 | import com.hncboy.beehive.base.mapper.CellPermissionMapper;
5 | import com.hncboy.beehive.cell.core.service.CellPermissionService;
6 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/1
12 | * cell 权限业务实现类
13 | */
14 | @Service
15 | public class CellPermissionServiceImpl extends ServiceImpl implements CellPermissionService {
16 | }
17 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.hncboy
6 | beehive-cell
7 | ${revision}
8 |
9 | beehive-cell-midjourney
10 |
11 |
12 | 5.0.0-beta.9
13 |
14 |
15 |
16 |
17 |
18 | net.dv8tion
19 | JDA
20 | ${jda.version}
21 |
22 |
23 | club.minnced
24 | opus-java
25 |
26 |
27 |
28 |
29 | com.hncboy
30 | beehive-cell-core
31 | ${project.version}
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/constant/MidjourneyConstant.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.constant;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/6/18
6 | * Midjourney 常量
7 | */
8 | public class MidjourneyConstant {
9 |
10 | public static final String DISCORD_MESSAGE_UPDATE_STR = "消息变更";
11 | public static final String DISCORD_MESSAGE_RECEIVE_STR = "消息接收";
12 | public static final String DESCRIBE = "describe";
13 | public static final String IMAGINE = "imagine";
14 | public static final String WAITING_TO_START = "Waiting to start";
15 | public static final String IMAGE_JPEG = "image/jpeg";
16 | public static final String IMAGE_PNG = "image/png";
17 |
18 | /**
19 | * 压缩图文件前缀
20 | */
21 | public static final String COMPRESSED_FILE_PREFIX = "mj-compressed-";
22 |
23 | /**
24 | * 原图文件前缀
25 | */
26 | public static final String ORIGINAL_FILE_PREFIX = "mj-original-";
27 |
28 | /**
29 | * describe 原图文件前缀
30 | */
31 | public static final String DESCRIBE_ORIGINAL_FILE_PREFIX = "mj-original-describe-";
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/controller/AdminRoomMidjourneyController.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.controller;
2 |
3 | import com.hncboy.beehive.base.annotation.ApiAdminRestController;
4 | import com.hncboy.beehive.base.handler.response.R;
5 | import com.hncboy.beehive.cell.midjourney.service.AdminRoomMidjourneyMsgService;
6 | import io.swagger.v3.oas.annotations.Operation;
7 | import io.swagger.v3.oas.annotations.tags.Tag;
8 | import lombok.AllArgsConstructor;
9 | import org.springframework.web.bind.annotation.GetMapping;
10 | import org.springframework.web.bind.annotation.RequestParam;
11 |
12 | /**
13 | * @author hncboy
14 | * @date 2023/6/30
15 | * Midjourney 房间控制器
16 | */
17 | @AllArgsConstructor
18 | @Tag(name = "管理端-Midjourney 房间相关接口")
19 | @ApiAdminRestController("/room/midjourney")
20 | public class AdminRoomMidjourneyController {
21 |
22 | private final AdminRoomMidjourneyMsgService adminRoomMidjourneyMsgService;
23 |
24 | @Operation(summary = "标记异常消息")
25 | @GetMapping("/mark_error_message")
26 | public R markErrorMessage(@RequestParam Long msgId) {
27 | // 给一个接口直接更新状态,如果自己看到 discord 报错可以直接掉接口更新,不用等到定时任务执行
28 | adminRoomMidjourneyMsgService.markErrorMessage(msgId);
29 | return R.success("成功");
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/domain/bo/MidjourneyDiscordMessageBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.domain.bo;
2 |
3 | import com.hncboy.beehive.base.enums.MidjourneyMsgActionEnum;
4 | import lombok.Data;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/5/20
9 | * Midjourney Discord 消息业务对象
10 | */
11 | @Data
12 | public class MidjourneyDiscordMessageBO {
13 |
14 | /**
15 | * 消息指令动作
16 | */
17 | private MidjourneyMsgActionEnum action;
18 |
19 | /**
20 | * 消息内容
21 | */
22 | private String prompt;
23 |
24 | /**
25 | * 位置
26 | */
27 | private Integer index;
28 |
29 | /**
30 | * 消息状态
31 | */
32 | private String status;
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/domain/request/MjConvertRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.Max;
5 | import jakarta.validation.constraints.Min;
6 | import jakarta.validation.constraints.NotNull;
7 | import lombok.Data;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/18
12 | * Midjourney UV 转换请求参数
13 | */
14 | @Data
15 | @Schema(title = "Midjourney UV 转换请求参数")
16 | public class MjConvertRequest {
17 |
18 | @NotNull(message = "房间 id 不能为空")
19 | @Schema(title = "房间 id")
20 | private Long roomId;
21 |
22 | @NotNull(message = "消息 id 不能为空")
23 | @Schema(title = "消息 id")
24 | private Long msgId;
25 |
26 | @Min(value = 1, message = "下标最小为 1")
27 | @Max(value = 4, message = "下标最大为 4")
28 | @NotNull(message = "下标不能为空")
29 | @Schema(title = "下标")
30 | private Integer index;
31 | }
32 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/domain/request/MjDescribeRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import lombok.Data;
6 | import org.springframework.web.multipart.MultipartFile;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/18
11 | * Midjourney 描述请求
12 | */
13 | @Data
14 | @Schema(title = "Midjourney 描述请求")
15 | public class MjDescribeRequest {
16 |
17 | @NotNull(message = "房间 id 不能为空")
18 | @Schema(title = "房间 id")
19 | private Long roomId;
20 |
21 | @NotNull(message = "图片文件不能为空")
22 | @Schema(title = "图片文件")
23 | private MultipartFile file;
24 | }
25 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/domain/request/MjImagineRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotEmpty;
5 | import jakarta.validation.constraints.NotNull;
6 | import jakarta.validation.constraints.Size;
7 | import lombok.Data;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/18
12 | * Midjourney 创建图像参数
13 | */
14 | @Data
15 | @Schema(title = "Midjourney 创建图像参数")
16 | public class MjImagineRequest {
17 |
18 | @NotNull(message = "房间 id 不能为空")
19 | @Schema(title = "房间 id")
20 | private Long roomId;
21 |
22 | @Size(max = 1000, message = "提示语不能超过 1000 个字")
23 | @NotEmpty(message = "提示语不能为空")
24 | @Schema(title = "提示语")
25 | private String prompt;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/handler/cell/MidjourneyCellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/30
11 | * Midjourney cell 配置项策略
12 | */
13 | @Component
14 | public class MidjourneyCellConfigStrategy extends AbstractCellConfigStrategy {
15 |
16 | @Override
17 | public CellCodeEnum getCellCode() {
18 | return CellCodeEnum.MIDJOURNEY;
19 | }
20 |
21 | @Override
22 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
23 | return MidjourneyCellConfigCodeEnum.class;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/service/AdminRoomMidjourneyMsgService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.hncboy.beehive.base.domain.entity.RoomMidjourneyMsgDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/7/1
9 | * 管理端-Midjourney 房间消息业务接口
10 | */
11 | public interface AdminRoomMidjourneyMsgService extends IService {
12 |
13 | /**
14 | * 标记错误消息
15 | *
16 | * @param msgId 消息 id
17 | */
18 | void markErrorMessage(Long msgId);
19 | }
20 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/java/com/hncboy/beehive/cell/midjourney/service/DiscordSendService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.midjourney.service;
2 |
3 | import cn.hutool.core.lang.Pair;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/6/5
8 | * Discord 发送服务接口
9 | */
10 | @FunctionalInterface
11 | public interface DiscordSendService {
12 |
13 | /**
14 | * 发送请求
15 | * @return 调用结果
16 | */
17 | Pair sendRequest();
18 | }
19 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/resources/midjourney/describe.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": 2,
3 | "guild_id": "$guild_id",
4 | "channel_id": "$channel_id",
5 | "application_id": "936929561302675456",
6 | "session_id": "c43d67ae725950b207d63ca3c2cc72fa",
7 | "data": {
8 | "version": "1118961510123847774",
9 | "id": "1092492867185950852",
10 | "name": "describe",
11 | "type": 1,
12 | "options": [
13 | {
14 | "type": 11,
15 | "name": "image",
16 | "value": 0
17 | }
18 | ],
19 | "attachments": [
20 | {
21 | "id": "0",
22 | "filename": "$file_name",
23 | "uploaded_filename": "$final_file_name"
24 | }
25 | ],
26 | "application_command": {
27 | "id": "1092492867185950852",
28 | "application_id": "936929561302675456",
29 | "version": "1092492867185950853",
30 | "default_member_permissions": null,
31 | "type": 1,
32 | "nsfw": false,
33 | "name": "describe",
34 | "description": "Writes a prompt based on your image.",
35 | "dm_permission": true,
36 | "contexts": null,
37 | "options": [
38 | {
39 | "type": 11,
40 | "name": "image",
41 | "description": "The image to describe",
42 | "required": true
43 | }
44 | ]
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/resources/midjourney/imagine.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": 2,
3 | "guild_id": "$guild_id",
4 | "channel_id": "$channel_id",
5 | "application_id": "936929561302675456",
6 | "session_id": "03a82b463787c6f5c87d8e6739a5bb85",
7 | "data": {
8 | "version": "1118961510123847772",
9 | "id": "938956540159881230",
10 | "name": "imagine",
11 | "type": 1,
12 | "options": [
13 | {
14 | "type": 3,
15 | "name": "prompt",
16 | "value": "$prompt"
17 | }
18 | ]
19 | }
20 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/resources/midjourney/upscale.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": 3,
3 | "guild_id": "$guild_id",
4 | "channel_id": "$channel_id",
5 | "message_id": "$message_id",
6 | "application_id": "936929561302675456",
7 | "session_id": "03a82b463787c6f5c87d8e6739a5bb85",
8 | "message_flags": 0,
9 | "data": {
10 | "component_type": 2,
11 | "custom_id": "MJ::JOB::upsample::$index::$message_hash"
12 | }
13 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-midjourney/src/main/resources/midjourney/variation.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": 3,
3 | "guild_id": "$guild_id",
4 | "channel_id": "$channel_id",
5 | "message_id": "$message_id",
6 | "application_id": "936929561302675456",
7 | "session_id": "fe32c5005d572085d68a1ba725b99aaa",
8 | "message_flags": 0,
9 | "data": {
10 | "component_type": 2,
11 | "custom_id": "MJ::JOB::variation::$index::$message_hash"
12 | }
13 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.hncboy
6 | beehive-cell
7 | ${revision}
8 |
9 | beehive-cell-openai
10 |
11 |
12 |
13 | com.hncboy
14 | beehive-cell-core
15 | ${project.version}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/controller/RoomOpenAiChatWebController.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.controller;
2 |
3 | import com.hncboy.beehive.base.domain.query.RoomMsgCursorQuery;
4 | import com.hncboy.beehive.base.handler.response.R;
5 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
6 | import com.hncboy.beehive.cell.openai.service.RoomOpenAiChatWebMsgService;
7 | import io.swagger.v3.oas.annotations.Operation;
8 | import io.swagger.v3.oas.annotations.tags.Tag;
9 | import lombok.AllArgsConstructor;
10 | import org.springframework.validation.annotation.Validated;
11 | import org.springframework.web.bind.annotation.GetMapping;
12 | import org.springframework.web.bind.annotation.RequestMapping;
13 | import org.springframework.web.bind.annotation.RestController;
14 |
15 | import java.util.List;
16 |
17 | /**
18 | * @author hncboy
19 | * @date 2023/6/1
20 | * OpenAi 对话 Web 房间控制器
21 | */
22 | @AllArgsConstructor
23 | @Tag(name = "OpenAi 对话 Web 房间相关接口")
24 | @RequestMapping("/room/openai_chat_web")
25 | @RestController
26 | public class RoomOpenAiChatWebController {
27 |
28 | private final RoomOpenAiChatWebMsgService roomOpenAiChatWebMsgService;
29 |
30 | @Operation(summary = "消息列表")
31 | @GetMapping("/list")
32 | public R> list(@Validated RoomMsgCursorQuery cursorQuery) {
33 | return R.data(roomOpenAiChatWebMsgService.list(cursorQuery));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/domain/request/RoomOpenAiChatSendRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import jakarta.validation.constraints.Size;
6 | import lombok.Data;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/31
11 | * OpenAi 对话房间消息发送参数
12 | */
13 | @Data
14 | @Schema(title = "OpenAi 对话消息发送参数")
15 | public class RoomOpenAiChatSendRequest {
16 |
17 | @NotNull(message = "房间 id 不能为空")
18 | @Schema(title = "房间 id")
19 | private Long roomId;
20 |
21 | @Size(min = 1, max = 5000, message = "消息内容长度必须在 1-5000 之间")
22 | @NotNull(message = "消息内容不能为空")
23 | @Schema(title = "消息内容")
24 | private String content;
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/domain/request/RoomOpenAiImageSendRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import jakarta.validation.constraints.Size;
6 | import lombok.Data;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/6/3
11 | * OpenAi 图像房间消息发送参数
12 | */
13 | @Data
14 | @Schema(title = "OpenAi 图像房间消息发送参数")
15 | public class RoomOpenAiImageSendRequest {
16 |
17 | @NotNull(message = "房间 id 不能为空")
18 | @Schema(title = "房间 id")
19 | private Long roomId;
20 |
21 | @Size(min = 1, max = 1000, message = "咒语长度必须在 1-5000 之间")
22 | @NotNull(message = "咒语不能为空")
23 | @Schema(title = "咒语")
24 | private String prompt;
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/domain/vo/RoomOpenAiChatMsgVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.MessageTypeEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/31
12 | * OpenAi 对话房间消息展示参数
13 | */
14 | @Data
15 | @Schema(title = "OpenAi 对话房间消息展示参数")
16 | public class RoomOpenAiChatMsgVO {
17 |
18 | @Schema(title = "主键")
19 | private Long id;
20 |
21 | @Schema(title = "消息内容")
22 | private String content;
23 |
24 | @Schema(title = "消息类型")
25 | private MessageTypeEnum messageType;
26 |
27 | @Schema(title = "创建时间")
28 | private Date createTime;
29 | }
30 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/domain/vo/RoomOpenAiImageMsgVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.MessageStatusEnum;
4 | import com.hncboy.beehive.base.enums.MessageTypeEnum;
5 | import com.hncboy.beehive.base.handler.serializer.FilePathPrefixSerializer;
6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize;
7 | import io.swagger.v3.oas.annotations.media.Schema;
8 | import lombok.Data;
9 |
10 | import java.util.Date;
11 |
12 | /**
13 | * @author hncboy
14 | * @date 2023/6/3
15 | * OpenAi 图像房间消息展示参数
16 | */
17 | @Data
18 | @Schema(title = "OpenAi 图像房间消息展示参数")
19 | public class RoomOpenAiImageMsgVO {
20 |
21 | @Schema(title = "主键")
22 | private Long id;
23 |
24 | @Schema(title = "输入内容")
25 | private String prompt;
26 |
27 | @Schema(title = "尺寸大小")
28 | private String size;
29 |
30 | @Schema(title = "OpenAi 图像 url")
31 | private String openaiImageUrl;
32 |
33 | @JsonSerialize(using = FilePathPrefixSerializer.class)
34 | @Schema(title = "图像 url")
35 | private String imageUrl;
36 |
37 | @Schema(title = "消息类型")
38 | private MessageTypeEnum messageType;
39 |
40 | @Schema(title = "消息状态")
41 | private MessageStatusEnum status;
42 |
43 | @Schema(title = "创建时间")
44 | private Date createTime;
45 | }
46 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/enums/OpenAiApiKeyStrategyEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.enums;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 |
6 | import java.util.Map;
7 | import java.util.function.Function;
8 | import java.util.stream.Collectors;
9 | import java.util.stream.Stream;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/7/1
14 | * OpenAi ApiKey 策略枚举
15 | */
16 | @AllArgsConstructor
17 | public enum OpenAiApiKeyStrategyEnum {
18 |
19 | /**
20 | * 随机
21 | * 随机一个
22 | */
23 | RANDOM("random"),
24 |
25 | /**
26 | * 权重
27 | * 取权重最高的一个
28 | */
29 | WEIGHT("weight"),
30 |
31 | /**
32 | * 余额
33 | * 余额最高的一个
34 | */
35 | BALANCE("balance"),
36 |
37 | /**
38 | * 轮询
39 | * 按权重排序然后轮询
40 | */
41 | POLLING("polling");
42 |
43 | @Getter
44 | private final String code;
45 |
46 | /**
47 | * code 作为 key,封装为 Map
48 | */
49 | public static final Map CODE_MAP = Stream
50 | .of(OpenAiApiKeyStrategyEnum.values())
51 | .collect(Collectors.toMap(OpenAiApiKeyStrategyEnum::getCode, Function.identity()));
52 | }
53 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/enums/OpenAiChatWebModeEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.enums;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 |
6 | import java.util.Map;
7 | import java.util.function.Function;
8 | import java.util.stream.Collectors;
9 | import java.util.stream.Stream;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/5/31
14 | * 填写注释
15 | */
16 | @AllArgsConstructor
17 | public enum OpenAiChatWebModeEnum {
18 |
19 | /**
20 | * 对应官网 GPT 3.5 模型
21 | */
22 | DEFAULT_GPT_3_5("text-davinci-002-render-sha"),
23 |
24 | /**
25 | * 对应官网 GPT-4 Default
26 | * 目前限制 3 小时 25 条消息,超过限制报什么错还没测试
27 | * ChatGPT Plus
28 | */
29 | GPT_4("gpt-4");
30 |
31 | @Getter
32 | private final String name;
33 |
34 | /**
35 | * name 作为 key,封装为 Map
36 | */
37 | public static final Map NAME_MAP = Stream
38 | .of(OpenAiChatWebModeEnum.values())
39 | .collect(Collectors.toMap(OpenAiChatWebModeEnum::getName, Function.identity()));
40 | }
41 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/cell/OpenAiChat3CellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.openai.enums.OpenAiChatCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/31
12 | * OpenAi 对话 GPT-3.5 配置项策略
13 | */
14 | @Component
15 | public class OpenAiChat3CellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.OPENAI_CHAT_API_3_5;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return OpenAiChatCellConfigCodeEnum.class;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/cell/OpenAiChat4CellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.openai.enums.OpenAiChatCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/31
12 | * OpenAi 对话 GPT-4 配置项策略
13 | */
14 | @Component
15 | public class OpenAiChat4CellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.OPENAI_CHAT_API_4;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return OpenAiChatCellConfigCodeEnum.class;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/cell/OpenAiChatWeb3CellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.openai.enums.OpenAiChatWebCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/31
12 | * OpenAi 对话 Web GPT-3.5 配置项策略
13 | */
14 | @Component
15 | public class OpenAiChatWeb3CellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.OPENAI_CHAT_WEB_3_5;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return OpenAiChatWebCellConfigCodeEnum.class;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/cell/OpenAiChatWeb4CellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.openai.enums.OpenAiChatWebCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/31
12 | * OpenAi 对话 Web GPT-4 配置项策略
13 | */
14 | @Component
15 | public class OpenAiChatWeb4CellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.OPENAI_CHAT_WEB_4;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return OpenAiChatWebCellConfigCodeEnum.class;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/cell/OpenAiImageCellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.openai.enums.OpenAiImageCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/3
12 | * OpenAi 图像配置项策略
13 | */
14 | @Component
15 | public class OpenAiImageCellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.OPENAI_IMAGE;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return OpenAiImageCellConfigCodeEnum.class;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/converter/RoomOpenAiChatMsgConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.converter;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatMsgDO;
4 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
5 | import org.mapstruct.Mapper;
6 | import org.mapstruct.factory.Mappers;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/31
13 | * OpenAi 对话房间消息相关转换
14 | */
15 | @Mapper
16 | public interface RoomOpenAiChatMsgConverter {
17 |
18 | RoomOpenAiChatMsgConverter INSTANCE = Mappers.getMapper(RoomOpenAiChatMsgConverter.class);
19 |
20 | /**
21 | * List 转 List
22 | *
23 | * @param roomOpenAiChatMsgDOList List
24 | * @return List
25 | */
26 | List entityToVO(List roomOpenAiChatMsgDOList);
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/handler/converter/RoomOpenAiChatWebMsgConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.handler.converter;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatWebMsgDO;
4 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
5 | import org.mapstruct.Mapper;
6 | import org.mapstruct.factory.Mappers;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/6/1
13 | * OpenAi 对话 Web 房间消息相关转换
14 | */
15 | @Mapper
16 | public interface RoomOpenAiChatWebMsgConverter {
17 |
18 | RoomOpenAiChatWebMsgConverter INSTANCE = Mappers.getMapper(RoomOpenAiChatWebMsgConverter.class);
19 |
20 | /**
21 | * List 转 List
22 | *
23 | * @param roomOpenAiChatWebMsgDOList List
24 | * @return List
25 | */
26 | List entityToVO(List roomOpenAiChatWebMsgDOList);
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/apikey/ChatErrorNode.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.apikey;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatMsgDO;
4 | import com.hncboy.beehive.cell.core.hander.strategy.DataWrapper;
5 | import com.hncboy.beehive.cell.openai.enums.OpenAiChatCellConfigCodeEnum;
6 | import cn.hutool.core.lang.Pair;
7 |
8 | import java.util.Map;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/6/10
13 | * Openai 对话错误链路
14 | */
15 | public interface ChatErrorNode {
16 |
17 | /**
18 | * 处理问题消息
19 | *
20 | * @param questionMessage 问题消息
21 | * @param roomConfigParamAsMap 房间配置参数
22 | * @return 结果 key:是否通过 value:错误内容
23 | */
24 | Pair doHandle(RoomOpenAiChatMsgDO questionMessage, Map roomConfigParamAsMap);
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/emitter/RoomOpenAiChatResponseEmitter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.emitter;
2 |
3 | import com.hncboy.beehive.cell.core.hander.strategy.CellConfigStrategy;
4 | import com.hncboy.beehive.cell.openai.domain.request.RoomOpenAiChatSendRequest;
5 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023-3-24
10 | * OpenAi 对话房间消息响应转 Emitter
11 | */
12 | public interface RoomOpenAiChatResponseEmitter {
13 |
14 | /**
15 | * 消息请求转 Emitter
16 | *
17 | * @param sendRequest 消息处理请求
18 | * @param emitter ResponseBodyEmitter
19 | * @param cellConfigStrategy cell 配置项策略
20 | */
21 | void requestToResponseEmitter(RoomOpenAiChatSendRequest sendRequest, ResponseBodyEmitter emitter, CellConfigStrategy cellConfigStrategy);
22 | }
23 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/emitter/RoomOpenAiChatResponseEmitterDispatcher.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.emitter;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import cn.hutool.extra.spring.SpringUtil;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/5/31
12 | * OpenAi 对话房间消息响应转 Emitter 分发器
13 | */
14 | public class RoomOpenAiChatResponseEmitterDispatcher {
15 |
16 | /**
17 | * 响应处理器
18 | */
19 | public static final Map RESPONSE_EMITTER_MAP = new HashMap<>() {{
20 | put(CellCodeEnum.OPENAI_CHAT_API_3_5, SpringUtil.getBean(RoomOpenAiChatApiResponseEmitter.class));
21 | put(CellCodeEnum.OPENAI_CHAT_API_4, SpringUtil.getBean(RoomOpenAiChatApiResponseEmitter.class));
22 | put(CellCodeEnum.OPENAI_CHAT_WEB_3_5, SpringUtil.getBean(RoomOpenAiChatWebResponseEmitter.class));
23 | put(CellCodeEnum.OPENAI_CHAT_WEB_4, SpringUtil.getBean(RoomOpenAiChatWebResponseEmitter.class));
24 | }};
25 |
26 | /**
27 | * 根据 cellCodeEnum 获取对应的响应处理器
28 | *
29 | * @param cellCodeEnum cellCodeEnum
30 | * @return 响应处理器
31 | */
32 | public static RoomOpenAiChatResponseEmitter doDispatch(CellCodeEnum cellCodeEnum) {
33 | return RESPONSE_EMITTER_MAP.get(cellCodeEnum);
34 | }
35 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/listener/AbstractStreamListener.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.listener;
2 |
3 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
4 | import okhttp3.Response;
5 | import org.jetbrains.annotations.Nullable;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023-3-24
10 | * 消息流监听器抽象类
11 | */
12 | public abstract class AbstractStreamListener {
13 |
14 | /**
15 | * 初始化
16 | */
17 | public void onInit() {
18 |
19 | }
20 |
21 | /**
22 | * 接收到新消息
23 | *
24 | * @param newMessage 新的单条消息
25 | * @param roomOpenAiChatMsgVO 消息展示参数
26 | */
27 | public abstract void onMessage(String newMessage, RoomOpenAiChatMsgVO roomOpenAiChatMsgVO);
28 |
29 | /**
30 | * 结束响应
31 | *
32 | * @param receivedMessage 接收到消息
33 | */
34 | public void onComplete(String receivedMessage) {
35 |
36 | }
37 |
38 | /**
39 | * 异常处理
40 | *
41 | * @param roomOpenAiChatMsgVO 消息展示参数
42 | * @param t 异常
43 | * @param response 响应信息
44 | */
45 | public abstract void onError(RoomOpenAiChatMsgVO roomOpenAiChatMsgVO, Throwable t, @Nullable Response response);
46 | }
47 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/listener/ConsoleStreamListener.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.listener;
2 |
3 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
4 | import okhttp3.Response;
5 | import org.jetbrains.annotations.Nullable;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023-3-24
10 | * 控制台消息流监听
11 | */
12 | public class ConsoleStreamListener extends AbstractStreamListener {
13 |
14 | @Override
15 | public void onMessage(String newMessage, RoomOpenAiChatMsgVO roomOpenAiChatMsgVO) {
16 | System.out.println(newMessage);
17 | }
18 |
19 | @Override
20 | public void onError(RoomOpenAiChatMsgVO roomOpenAiChatMsgVO, Throwable t, @Nullable Response response) {
21 | System.out.println("控制台消息输出异常了");
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/parser/ResponseParser.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.parser;
2 |
3 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
4 | import com.hncboy.beehive.cell.openai.module.chat.storage.RoomOpenAiChatMessageStorage;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023-3-24
9 | * 响应数据解析器接口
10 | */
11 | public interface ResponseParser {
12 |
13 | /**
14 | * 解析响应成功的原始数据
15 | *
16 | * @param originalData 原始数据
17 | * @return 实体类
18 | */
19 | SUCCESS parseSuccess(String originalData);
20 |
21 | /**
22 | * 解析接收到消息转成当前收到的所有消息
23 | * 1.ApiKey 模式需要拼接前面的句子
24 | * 2.AccessToken 模式不需要拼接
25 | *
26 | * @param receivedMessage 已经接收到的所有消息
27 | * @param newMessage 新的消息
28 | * @return 当前收到的所有消息
29 | */
30 | String parseReceivedMessage(String receivedMessage, String newMessage);
31 |
32 | /**
33 | * 解析本次返回新消息
34 | *
35 | * @param originalData 原始数据
36 | * @return 消息内容
37 | */
38 | String parseNewMessage(String originalData);
39 |
40 | /**
41 | * 解析错误消息
42 | *
43 | * @param originalResponseErrorMsg 原始错误消息
44 | * @return 错误消息
45 | */
46 | String parseErrorMessage(String originalResponseErrorMsg);
47 |
48 | /**
49 | * 解析回答消息
50 | *
51 | * @param chatMessageStorage 消息存储
52 | * @return 展示内容
53 | */
54 | RoomOpenAiChatMsgVO parseChatMessageVO(RoomOpenAiChatMessageStorage chatMessageStorage);
55 | }
56 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/storage/DataStorage.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.storage;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023-3-25
6 | * 数据存储接口
7 | */
8 | public interface DataStorage {
9 |
10 | /**
11 | * 接收到新消息
12 | *
13 | * @param roomOpenAiChatMessageStorage chatMessageStorage
14 | */
15 | void onMessage(RoomOpenAiChatMessageStorage roomOpenAiChatMessageStorage);
16 |
17 | /**
18 | * 结束响应
19 | *
20 | * @param roomOpenAiChatMessageStorage 聊天消息存储
21 | */
22 | void onComplete(RoomOpenAiChatMessageStorage roomOpenAiChatMessageStorage);
23 |
24 | /**
25 | * 异常处理
26 | *
27 | * @param roomOpenAiChatMessageStorage 聊天消息存储
28 | */
29 | void onError(RoomOpenAiChatMessageStorage roomOpenAiChatMessageStorage);
30 | }
31 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/chat/storage/RoomOpenAiChatMessageStorage.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.chat.storage;
2 |
3 | import com.hncboy.beehive.cell.openai.module.chat.parser.ResponseParser;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023-3-25
12 | * OpenAi 对话消息数据存储业业务参数
13 | */
14 | @Data
15 | @Builder
16 | @NoArgsConstructor
17 | @AllArgsConstructor
18 | public class RoomOpenAiChatMessageStorage {
19 |
20 | /**
21 | * 问题消息
22 | */
23 | private Object questionMessageDO;
24 |
25 | /**
26 | * 回答消息
27 | */
28 | private Object answerMessageDO;
29 |
30 | /**
31 | * 原始响应数据
32 | */
33 | private String originalResponseData;
34 |
35 | /**
36 | * 异常响应数据
37 | */
38 | private String errorResponseData;
39 |
40 | /**
41 | * 响应解析器
42 | */
43 | private ResponseParser> parser;
44 |
45 | /**
46 | * 当前已经响应内容
47 | */
48 | private String receivedMessage;
49 |
50 | /**
51 | * 当前消息流条数
52 | */
53 | private Integer currentStreamMessageCount;
54 | }
55 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/key/OpenAiApiKeyFactory.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.key;
2 |
3 | import com.hncboy.beehive.cell.openai.enums.OpenAiApiKeyStrategyEnum;
4 | import org.springframework.stereotype.Component;
5 |
6 | import java.util.HashMap;
7 | import java.util.List;
8 | import java.util.Map;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/7/1
13 | * OpenAi ApiKey 工厂
14 | */
15 | @Component
16 | public class OpenAiApiKeyFactory {
17 |
18 | private final Map strategies = new HashMap<>();
19 |
20 | public OpenAiApiKeyFactory(List strategyList) {
21 | for (OpenAiApiKeyStrategy strategy : strategyList) {
22 | strategies.put(strategy.getStrategyEnum(), strategy);
23 | }
24 | }
25 |
26 | /**
27 | * 获取策略
28 | *
29 | * @param strategyEnum 策略枚举
30 | * @return 策略
31 | */
32 | public OpenAiApiKeyStrategy getOpenAiApiKeyStrategy(OpenAiApiKeyStrategyEnum strategyEnum) {
33 | return strategies.get(strategyEnum);
34 | }
35 |
36 | /**
37 | * 获取策略
38 | *
39 | * @param strategyEnumCode 策略枚举编码
40 | * @return 策略
41 | */
42 | public OpenAiApiKeyStrategy getOpenAiApiKeyStrategy(String strategyEnumCode) {
43 | return getOpenAiApiKeyStrategy(OpenAiApiKeyStrategyEnum.CODE_MAP.get(strategyEnumCode));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/key/OpenAiApiKeyStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module.key;
2 |
3 | import com.hncboy.beehive.base.domain.entity.OpenAiApiKeyDO;
4 | import com.hncboy.beehive.base.enums.OpenAiApiKeyUseSceneEnum;
5 | import com.hncboy.beehive.cell.openai.enums.OpenAiApiKeyStrategyEnum;
6 |
7 | /**
8 | * @author hncboy
9 | * @date 2023/7/1
10 | * OpenAi ApiKey 策略接口
11 | */
12 | public interface OpenAiApiKeyStrategy {
13 |
14 | /**
15 | * 获取策略枚举
16 | *
17 | * @return 策略枚举
18 | */
19 | OpenAiApiKeyStrategyEnum getStrategyEnum();
20 |
21 | /**
22 | * 获取 ApiKey 信息
23 | *
24 | * @param useSceneEnum 使用场景
25 | * @return ApiKey 配置信息
26 | */
27 | OpenAiApiKeyDO getApiKeyInfo(OpenAiApiKeyUseSceneEnum useSceneEnum);
28 | }
29 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/module/package-info.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.module;
2 |
3 | /*
4 | * chat 对话
5 | * key 密钥
6 | */
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/service/OpenAiApiKeyService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.hncboy.beehive.base.domain.entity.OpenAiApiKeyDO;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/6/30
9 | * OpenAi ApiKey 业务接口
10 | */
11 | public interface OpenAiApiKeyService extends IService {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/service/RoomOpenAiChatMsgService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatMsgDO;
4 | import com.hncboy.beehive.base.domain.query.RoomMsgCursorQuery;
5 | import com.hncboy.beehive.base.handler.mp.IBeehiveService;
6 | import com.hncboy.beehive.cell.openai.domain.request.RoomOpenAiChatSendRequest;
7 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
8 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author hncboy
14 | * @date 2023/5/31
15 | * OpenAi 对话房间消息业务接口
16 | */
17 | public interface RoomOpenAiChatMsgService extends IBeehiveService {
18 |
19 | /**
20 | * 查询消息列表
21 | *
22 | * @param cursorQuery 请求参数
23 | * @return 消息列表
24 | */
25 | List list(RoomMsgCursorQuery cursorQuery);
26 |
27 | /**
28 | * 发送消息
29 | *
30 | * @param sendRequest 请求参数
31 | * @return 响应参数
32 | */
33 | ResponseBodyEmitter send(RoomOpenAiChatSendRequest sendRequest);
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/service/RoomOpenAiChatWebMsgService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiChatWebMsgDO;
4 | import com.hncboy.beehive.base.domain.query.RoomMsgCursorQuery;
5 | import com.hncboy.beehive.base.handler.mp.IBeehiveService;
6 | import com.hncboy.beehive.cell.core.hander.strategy.DataWrapper;
7 | import com.hncboy.beehive.cell.openai.domain.request.RoomOpenAiChatSendRequest;
8 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiChatMsgVO;
9 | import com.hncboy.beehive.cell.openai.enums.OpenAiChatWebCellConfigCodeEnum;
10 |
11 | import java.util.List;
12 | import java.util.Map;
13 |
14 | /**
15 | * @author hncboy
16 | * @date 2023/6/1
17 | * OpenAi 对话 Web 房间消息业务接口
18 | */
19 | public interface RoomOpenAiChatWebMsgService extends IBeehiveService {
20 |
21 | /**
22 | * 查询消息列表
23 | *
24 | * @param cursorQuery 请求参数
25 | * @return 消息列表
26 | */
27 | List list(RoomMsgCursorQuery cursorQuery);
28 |
29 | /**
30 | * 初始化问题消息
31 | *
32 | * @param sendRequest 请求参数
33 | * @param roomConfigParamAsMap 房间配置参数
34 | * @return 问题消息
35 | */
36 | RoomOpenAiChatWebMsgDO initQuestionMessage(RoomOpenAiChatSendRequest sendRequest, Map roomConfigParamAsMap);
37 | }
38 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/service/RoomOpenAiImageMsgService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomOpenAiImageMsgDO;
4 | import com.hncboy.beehive.base.domain.query.RoomMsgCursorQuery;
5 | import com.hncboy.beehive.base.handler.mp.IBeehiveService;
6 | import com.hncboy.beehive.cell.openai.domain.request.RoomOpenAiImageSendRequest;
7 | import com.hncboy.beehive.cell.openai.domain.vo.RoomOpenAiImageMsgVO;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * @author hncboy
13 | * @date 2023/6/3
14 | * OpenAi 图像房间消息业务接口
15 | */
16 | public interface RoomOpenAiImageMsgService extends IBeehiveService {
17 |
18 | /**
19 | * 查询消息列表
20 | *
21 | * @param cursorQuery 请求参数
22 | * @return 消息列表
23 | */
24 | List list(RoomMsgCursorQuery cursorQuery);
25 |
26 | /**
27 | * 发送消息
28 | *
29 | * @param sendRequest 请求参数
30 | * @return 响应参数
31 | */
32 | RoomOpenAiImageMsgVO send(RoomOpenAiImageSendRequest sendRequest);
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-openai/src/main/java/com/hncboy/beehive/cell/openai/service/impl/OpenAiApiKeyServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.openai.service.impl;
2 |
3 | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 | import com.hncboy.beehive.base.domain.entity.OpenAiApiKeyDO;
5 | import com.hncboy.beehive.base.mapper.OpenAiApiKeyMapper;
6 | import com.hncboy.beehive.cell.openai.service.OpenAiApiKeyService;
7 | import org.springframework.stereotype.Service;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/6/30
12 | * OpenAi ApiKey 业务实现类
13 | */
14 | @Service
15 | public class OpenAiApiKeyServiceImpl extends ServiceImpl implements OpenAiApiKeyService {
16 | }
17 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.hncboy
6 | beehive-cell
7 | ${revision}
8 |
9 | beehive-cell-wxqf
10 |
11 |
12 |
13 | com.hncboy
14 | beehive-cell-core
15 | ${project.version}
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/domain/request/RoomWxqfChatSendRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotNull;
5 | import jakarta.validation.constraints.Size;
6 | import lombok.Data;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/7/24
11 | * 文心千帆对话房间消息发送参数
12 | */
13 | @Data
14 | @Schema(title = "文心千帆对话消息发送参数")
15 | public class RoomWxqfChatSendRequest {
16 |
17 | @NotNull(message = "房间 id 不能为空")
18 | @Schema(title = "房间 id")
19 | private Long roomId;
20 |
21 | @Size(min = 1, max = 1000, message = "消息内容长度必须在 1-1000 之间")
22 | @NotNull(message = "消息内容不能为空")
23 | @Schema(title = "消息内容")
24 | private String content;
25 | }
26 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/domain/vo/RoomWxqfChatMsgVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.MessageTypeEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/24
12 | * 文心千帆对话房间消息展示参数
13 | */
14 | @Data
15 | @Schema(title = "文心千帆对话房间消息展示参数")
16 | public class RoomWxqfChatMsgVO {
17 |
18 | @Schema(title = "主键")
19 | private Long id;
20 |
21 | @Schema(title = "消息内容")
22 | private String content;
23 |
24 | @Schema(title = "消息类型")
25 | private MessageTypeEnum messageType;
26 |
27 | @Schema(title = "创建时间")
28 | private Date createTime;
29 | }
30 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/enums/WxqfChatModelEnum.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.enums;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Getter;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/7/24
9 | * 文心千帆对话模型枚举
10 | */
11 | @AllArgsConstructor
12 | public enum WxqfChatModelEnum {
13 |
14 | /**
15 | * ERNIE-Bot 是百度自行研发的大语言模型,覆盖海量中文数据,具有更强的对话问答、内容创作生成等能力
16 | */
17 | ERNIE_BOT("ERNIE-Bot"),
18 |
19 | /**
20 | * ERNIE-Bot-turbo 是百度自行研发的大语言模型,覆盖海量中文数据,具有更强的对话问答、内容创作生成等能力,响应速度更快
21 | */
22 | ERNIE_BOT_TURBO("ERNIE-Bot-turbo"),
23 |
24 | /**
25 | * BLOOMZ-7B 是业内知名的大语言模型,由 Hugging Face 研发并开源,能够以 46 种语言和 13 种编程语言输出文本
26 | */
27 | BLOOMZ_7B("BLOOMZ-7B");
28 |
29 | @Getter
30 | private final String code;
31 | }
32 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/handler/cell/WxqfChatBloomz7bCellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.wxqf.enums.WxqfChatBloomz7bCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/24
12 | * 文心千帆对话 BLOOMZ-7B 配置项策略
13 | */
14 | @Component
15 | public class WxqfChatBloomz7bCellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.WXQF_BLOOMZ_7B;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return WxqfChatBloomz7bCellConfigCodeEnum.class;
25 | }
26 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/handler/cell/WxqfChatErnieBotCellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.wxqf.enums.WxqfChatErnieBotCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/24
12 | * 文心千帆对话 ERNIE-Bot 配置项策略
13 | */
14 | @Component
15 | public class WxqfChatErnieBotCellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.WXQF_ERNIE_BOT;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return WxqfChatErnieBotCellConfigCodeEnum.class;
25 | }
26 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/handler/cell/WxqfChatErnieBotTurboCellConfigStrategy.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.handler.cell;
2 |
3 | import com.hncboy.beehive.base.enums.CellCodeEnum;
4 | import com.hncboy.beehive.cell.core.hander.strategy.AbstractCellConfigStrategy;
5 | import com.hncboy.beehive.cell.core.hander.strategy.ICellConfigCodeEnum;
6 | import com.hncboy.beehive.cell.wxqf.enums.WxqfChatErnieBotTurboCellConfigCodeEnum;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/24
12 | * 文心千帆对话 ERNIE-Bot-turbo 配置项策略
13 | */
14 | @Component
15 | public class WxqfChatErnieBotTurboCellConfigStrategy extends AbstractCellConfigStrategy {
16 |
17 | @Override
18 | public CellCodeEnum getCellCode() {
19 | return CellCodeEnum.WXQF_ERNIE_BOT_TURBO;
20 | }
21 |
22 | @Override
23 | public Class extends ICellConfigCodeEnum> getCellConfigCodeEnumClazz() {
24 | return WxqfChatErnieBotTurboCellConfigCodeEnum.class;
25 | }
26 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/handler/converter/RoomWxqfChatMsgConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.handler.converter;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomWxqfChatMsgDO;
4 | import com.hncboy.beehive.cell.wxqf.domain.vo.RoomWxqfChatMsgVO;
5 | import org.mapstruct.Mapper;
6 | import org.mapstruct.factory.Mappers;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/7/24
13 | * 文心千帆对话房间消息相关转换
14 | */
15 | @Mapper
16 | public interface RoomWxqfChatMsgConverter {
17 |
18 | RoomWxqfChatMsgConverter INSTANCE = Mappers.getMapper(RoomWxqfChatMsgConverter.class);
19 |
20 | /**
21 | * List 转 List
22 | *
23 | * @param roomWxqfChatMsgDOList List
24 | * @return List
25 | */
26 | List entityToVO(List roomWxqfChatMsgDOList);
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/api/WxqfChatErnieBotApiRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.api;
2 |
3 | import com.fasterxml.jackson.annotation.JsonProperty;
4 | import lombok.Data;
5 | import lombok.EqualsAndHashCode;
6 |
7 | import java.math.BigDecimal;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/24
12 | * 文心千帆对话 ERNIE-Bot API 请求参数
13 | */
14 | @Data
15 | @EqualsAndHashCode(callSuper = false)
16 | public class WxqfChatErnieBotApiRequest extends WxqfChatApiCommonRequest {
17 |
18 | /**
19 | * 温度说明:
20 | * (1)较高的数值会使输出更加随机,而较低的数值会使其更加集中和确定
21 | * (2)默认 0.95,范围 (0, 1.0],不能为 0
22 | * (3)建议该参数和 top_p 只设置1个
23 | * (4)建议 top_p 和 temperature 不要同时更改
24 | */
25 |
26 | private BigDecimal temperature;
27 |
28 | /**
29 | * 说明:
30 | * (1)较高的数值会使输出更加随机,而较低的数值会使其更加集中和确定
31 | * (2)默认 0.95,范围 (0, 1.0],不能为 0
32 | * (3)建议该参数和 top_p 只设置1个
33 | * (4)建议 top_p 和 temperature 不要同时更改
34 | */
35 | @JsonProperty("top_p")
36 | private BigDecimal topP;
37 |
38 | /**
39 | * 通过对已生成的 token 增加惩罚,减少重复生成的现象。说明:
40 | * (1)值越大表示惩罚越大
41 | * (2)默认1.0,取值范围:[1.0, 2.0]
42 | */
43 | @JsonProperty("penaltyScore")
44 | private BigDecimal penaltyScore;
45 | }
46 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/emitter/WxqfChatResponseEmitterDispatcher.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.emitter;
2 |
3 | import cn.hutool.extra.spring.SpringUtil;
4 | import com.hncboy.beehive.base.enums.CellCodeEnum;
5 |
6 | import java.util.HashMap;
7 | import java.util.Map;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/24
12 | * 文心千帆对话房间消息响应转 Emitter 分发器
13 | */
14 | public class WxqfChatResponseEmitterDispatcher {
15 |
16 | /**
17 | * 响应处理器
18 | */
19 | public static final Map RESPONSE_EMITTER_MAP = new HashMap<>() {{
20 | put(CellCodeEnum.WXQF_ERNIE_BOT, SpringUtil.getBean(WxqfChatErnieBotResponseEmitter.class));
21 | put(CellCodeEnum.WXQF_ERNIE_BOT_TURBO, SpringUtil.getBean(WxqfChatErnieBotTurboResponseEmitter.class));
22 | put(CellCodeEnum.WXQF_BLOOMZ_7B, SpringUtil.getBean(WxqfChatBloomz7bResponseEmitter.class));
23 | }};
24 |
25 | /**
26 | * 根据 cellCodeEnum 获取对应的响应处理器
27 | *
28 | * @param cellCodeEnum cellCodeEnum
29 | * @return 响应处理器
30 | */
31 | public static AbstractWxqfChatResponseEmitter doDispatch(CellCodeEnum cellCodeEnum) {
32 | return RESPONSE_EMITTER_MAP.get(cellCodeEnum);
33 | }
34 | }
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/listener/AbstractStreamListener.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.listener;
2 |
3 | import com.hncboy.beehive.cell.wxqf.domain.vo.RoomWxqfChatMsgVO;
4 | import com.hncboy.beehive.cell.wxqf.module.chat.api.WxqfChatApiCommonResponse;
5 | import okhttp3.Response;
6 | import org.jetbrains.annotations.Nullable;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/7/24
11 | * 消息流监听器抽象类
12 | */
13 | public abstract class AbstractStreamListener {
14 |
15 | /**
16 | * 接收到新消息
17 | *
18 | * @param chatApiCommonResponse 通用响应内容
19 | * @param newMessage 新的单条消息
20 | * @param roomOpenAiChatMsgVO 消息展示参数
21 | */
22 | public abstract void onMessage(WxqfChatApiCommonResponse chatApiCommonResponse, String newMessage, RoomWxqfChatMsgVO roomOpenAiChatMsgVO);
23 |
24 | /**
25 | * 异常处理
26 | *
27 | * @param roomOpenAiChatMsgVO 消息展示参数
28 | * @param t 异常
29 | * @param response 响应信息
30 | */
31 | public abstract void onError(RoomWxqfChatMsgVO roomOpenAiChatMsgVO, Throwable t, @Nullable Response response);
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/listener/ConsoleStreamListener.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.listener;
2 |
3 | import com.hncboy.beehive.cell.wxqf.domain.vo.RoomWxqfChatMsgVO;
4 | import com.hncboy.beehive.cell.wxqf.module.chat.api.WxqfChatApiCommonResponse;
5 | import okhttp3.Response;
6 | import org.jetbrains.annotations.Nullable;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/7/24
11 | * 控制台消息流监听
12 | */
13 | public class ConsoleStreamListener extends AbstractStreamListener {
14 |
15 | @Override
16 | public void onMessage(WxqfChatApiCommonResponse chatApiCommonResponse, String newMessage, RoomWxqfChatMsgVO roomOpenAiChatMsgVO) {
17 | System.out.println(newMessage);
18 | }
19 |
20 | @Override
21 | public void onError(RoomWxqfChatMsgVO roomOpenAiChatMsgVO, Throwable t, @Nullable Response response) {
22 | System.out.println("控制台消息输出异常了");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/parser/ResponseParser.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.parser;
2 |
3 | import com.hncboy.beehive.cell.wxqf.domain.vo.RoomWxqfChatMsgVO;
4 | import com.hncboy.beehive.cell.wxqf.module.chat.storage.RoomWxqfChatMessageStorage;
5 |
6 | /**
7 | * @author hncboy
8 | * @date 2023/7/24
9 | * 响应数据解析器接口
10 | */
11 | public interface ResponseParser {
12 |
13 | /**
14 | * 解析响应成功的原始数据
15 | *
16 | * @param originalData 原始数据
17 | * @return 实体类
18 | */
19 | SUCCESS parseSuccess(String originalData);
20 |
21 | /**
22 | * 解析接收到消息转成当前收到的所有消息
23 | *
24 | * @param receivedMessage 已经接收到的所有消息
25 | * @param newMessage 新的消息
26 | * @return 当前收到的所有消息
27 | */
28 | String parseReceivedMessage(String receivedMessage, String newMessage);
29 |
30 | /**
31 | * 解析本次返回新消息
32 | *
33 | * @param originalData 原始数据
34 | * @return 消息内容
35 | */
36 | String parseNewMessage(String originalData);
37 |
38 | /**
39 | * 解析错误消息
40 | *
41 | * @param originalResponseErrorMsg 原始错误消息
42 | * @return 错误消息
43 | */
44 | String parseErrorMessage(String originalResponseErrorMsg);
45 |
46 | /**
47 | * 解析回答消息
48 | *
49 | * @param chatMessageStorage 消息存储
50 | * @return 展示内容
51 | */
52 | RoomWxqfChatMsgVO parseChatMessageVO(RoomWxqfChatMessageStorage chatMessageStorage);
53 | }
54 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/storage/DataStorage.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.storage;
2 |
3 | /**
4 | * @author hncboy
5 | * @date 2023/7/24
6 | * 数据存储接口
7 | */
8 | public interface DataStorage {
9 |
10 | /**
11 | * 接收到新消息
12 | *
13 | * @param roomWxqfChatMessageStorage chatMessageStorage
14 | */
15 | void onMessage(RoomWxqfChatMessageStorage roomWxqfChatMessageStorage);
16 |
17 | /**
18 | * 异常处理
19 | *
20 | * @param roomWxqfChatMessageStorage 聊天消息存储
21 | */
22 | void onError(RoomWxqfChatMessageStorage roomWxqfChatMessageStorage);
23 | }
24 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/chat/storage/RoomWxqfChatMessageStorage.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module.chat.storage;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomWxqfChatMsgDO;
4 | import com.hncboy.beehive.cell.wxqf.module.chat.api.WxqfChatApiCommonResponse;
5 | import com.hncboy.beehive.cell.wxqf.module.chat.parser.ResponseParser;
6 | import lombok.AllArgsConstructor;
7 | import lombok.Builder;
8 | import lombok.Data;
9 | import lombok.NoArgsConstructor;
10 |
11 | import java.util.LinkedList;
12 | import java.util.List;
13 |
14 | /**
15 | * @author hncboy
16 | * @date 2023/7/24
17 | * 对话消息数据存储业业务参数
18 | */
19 | @Data
20 | @Builder
21 | @NoArgsConstructor
22 | @AllArgsConstructor
23 | public class RoomWxqfChatMessageStorage {
24 |
25 | /**
26 | * 问题消息
27 | */
28 | private RoomWxqfChatMsgDO questionMessageDO;
29 |
30 | /**
31 | * 回答消息
32 | */
33 | private RoomWxqfChatMsgDO answerMessageDO;
34 |
35 | /**
36 | * 接口响应数据列表
37 | */
38 | private LinkedList apiCommonResponses;
39 |
40 | /**
41 | * 响应数据解析器
42 | */
43 | private ResponseParser> parser;
44 |
45 | /**
46 | * 上一次响应数据
47 | */
48 | private WxqfChatApiCommonResponse lastApiCommonResponse;
49 |
50 | /**
51 | * 异常响应数据
52 | */
53 | private String errorResponseData;
54 |
55 | /**
56 | * 当前已经响应内容
57 | */
58 | private String receivedMessage;
59 | }
60 |
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/module/package-info.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.module;
--------------------------------------------------------------------------------
/beehive-cell/beehive-cell-wxqf/src/main/java/com/hncboy/beehive/cell/wxqf/service/RoomWxqfChatMsgService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.cell.wxqf.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.RoomWxqfChatMsgDO;
4 | import com.hncboy.beehive.base.domain.query.RoomMsgCursorQuery;
5 | import com.hncboy.beehive.base.handler.mp.IBeehiveService;
6 | import com.hncboy.beehive.cell.wxqf.domain.request.RoomWxqfChatSendRequest;
7 | import com.hncboy.beehive.cell.wxqf.domain.vo.RoomWxqfChatMsgVO;
8 | import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author hncboy
14 | * @date 2023/7/24
15 | * 文心千帆对话房间消息业务接口
16 | */
17 | public interface RoomWxqfChatMsgService extends IBeehiveService {
18 |
19 | /**
20 | * 查询消息列表
21 | *
22 | * @param cursorQuery 请求参数
23 | * @return 消息列表
24 | */
25 | List list(RoomMsgCursorQuery cursorQuery);
26 |
27 | /**
28 | * 发送消息
29 | *
30 | * @param sendRequest 请求参数
31 | * @return 响应参数
32 | */
33 | ResponseBodyEmitter send(RoomWxqfChatSendRequest sendRequest);
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-cell/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 |
5 | com.hncboy
6 | ai-beehive
7 | ${revision}
8 |
9 | pom
10 | beehive-cell
11 |
12 |
13 | beehive-cell-core
14 | beehive-cell-midjourney
15 | beehive-cell-openai
16 | beehive-cell-bing
17 | beehive-cell-starter
18 | beehive-cell-wxqf
19 |
20 |
21 |
22 |
23 | com.hncboy
24 | beehive-base
25 | ${project.version}
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/beehive-web/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.hncboy
7 | ai-beehive
8 | ${revision}
9 |
10 | beehive-web
11 |
12 |
13 |
14 | com.hncboy
15 | beehive-base
16 | ${project.version}
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/cache/FrontUserCache.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.cache;
2 |
3 | import com.hncboy.beehive.web.domain.bo.FrontUserBO;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/6/27
8 | * 前端用户缓存
9 | */
10 | public class FrontUserCache {
11 |
12 | /**
13 | * 获取用户业务对象
14 | *
15 | * @return 用户业务对象
16 | */
17 | public FrontUserBO getUser() {
18 | return new FrontUserBO();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/controller/SysUserController.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.controller;
2 |
3 | import com.hncboy.beehive.web.domain.request.SysUserLoginRequest;
4 | import com.hncboy.beehive.web.service.SysUserService;
5 | import com.hncboy.beehive.base.annotation.ApiAdminRestController;
6 | import com.hncboy.beehive.base.handler.response.R;
7 | import io.swagger.v3.oas.annotations.Operation;
8 | import io.swagger.v3.oas.annotations.tags.Tag;
9 | import lombok.AllArgsConstructor;
10 | import org.springframework.validation.annotation.Validated;
11 | import org.springframework.web.bind.annotation.PostMapping;
12 | import org.springframework.web.bind.annotation.RequestBody;
13 |
14 | /**
15 | * @author hncboy
16 | * @date 2023-3-28
17 | * 系统用户相关接口
18 | */
19 | @AllArgsConstructor
20 | @Tag(name = "管理端-系统用户相关接口")
21 | @ApiAdminRestController("/sys_user")
22 | public class SysUserController {
23 |
24 | private final SysUserService sysUserService;
25 |
26 | @Operation(summary = "用户登录")
27 | @PostMapping("/login")
28 | public R login(@Validated @RequestBody SysUserLoginRequest sysUserLoginRequest) {
29 | sysUserService.login(sysUserLoginRequest);
30 | return R.success("登录成功");
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/bo/FrontUserBO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.bo;
2 |
3 | import lombok.Data;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023/6/27
8 | * 前端用户业务参数对象
9 | */
10 | @Data
11 | public class FrontUserBO {
12 |
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/query/SensitiveWordPageQuery.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.query;
2 |
3 | import com.hncboy.beehive.base.domain.query.PageQuery;
4 | import com.hncboy.beehive.base.enums.EnableDisableStatusEnum;
5 | import io.swagger.v3.oas.annotations.media.Schema;
6 | import jakarta.validation.constraints.Size;
7 | import lombok.Data;
8 | import lombok.EqualsAndHashCode;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023-3-28
13 | * 敏感词分页查询
14 | */
15 | @Data
16 | @EqualsAndHashCode(callSuper = false)
17 | @Schema(title = "敏感词分页查询")
18 | public class SensitiveWordPageQuery extends PageQuery {
19 |
20 | @Size(max = 20, message = "敏感词内容不超过 20 个字")
21 | @Schema(title = "敏感词内容")
22 | private String word;
23 |
24 | @Schema(title = "状态 1 启用 2 停用")
25 | private EnableDisableStatusEnum status;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/query/SysParamPageQuery.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.query;
2 |
3 | import com.hncboy.beehive.base.domain.query.PageQuery;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 | import lombok.EqualsAndHashCode;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/10
11 | * 系统参数分页查询
12 | */
13 | @Data
14 | @EqualsAndHashCode(callSuper = false)
15 | @Schema(title = "系统参数分页查询")
16 | public class SysParamPageQuery extends PageQuery {
17 |
18 | @Schema(title = "名称")
19 | private String name;
20 |
21 | @Schema(title = "key")
22 | private String paramKey;
23 |
24 | @Schema(title = "value")
25 | private String paramValue;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/request/LoginFrontUserByEmailRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.Data;
5 |
6 | /**
7 | * 前端用户登录请求
8 | *
9 | * @author CoDeleven
10 | */
11 | @Data
12 | @Schema(title = "前端用户登录请求")
13 | public class LoginFrontUserByEmailRequest {
14 |
15 | @Schema(title = "邮箱地址")
16 | private String username;
17 |
18 | @Schema(title = "密码")
19 | private String password;
20 | }
21 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/request/RegisterFrontUserForEmailRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.request;
2 |
3 | import com.hncboy.beehive.base.enums.FrontUserRegisterTypeEnum;
4 | import com.hncboy.beehive.web.handler.validation.FrontUserRegisterAvailable;
5 | import io.swagger.v3.oas.annotations.media.Schema;
6 | import jakarta.validation.constraints.NotNull;
7 | import jakarta.validation.constraints.Size;
8 | import lombok.AllArgsConstructor;
9 | import lombok.Builder;
10 | import lombok.Data;
11 | import lombok.NoArgsConstructor;
12 |
13 | /**
14 | * 前端用户注册请求
15 | *
16 | * @author CoDeleven
17 | */
18 | @AllArgsConstructor
19 | @NoArgsConstructor
20 | @Builder
21 | @Data
22 | @FrontUserRegisterAvailable
23 | @Schema(title = "前端用户注册请求,适用于邮箱登录登录")
24 | public class RegisterFrontUserForEmailRequest {
25 |
26 | @Size(min = 6, max = 64, message = "用户名长度应为6~64个字符")
27 | @NotNull
28 | @Schema(title = "用户ID,可以为邮箱,可以为手机号")
29 | private String identity;
30 |
31 | @Schema(title = "密码")
32 | @NotNull(message = "密码不能为空")
33 | private String password;
34 |
35 | @Schema(title = "图形验证码会话 ID")
36 | @NotNull(message = "验证码会话 ID 不能为空")
37 | private String picCodeSessionId;
38 |
39 | @Schema(title = "图片验证码")
40 | @NotNull(message = "图片验证码不能为空")
41 | private String picVerificationCode;
42 |
43 | private FrontUserRegisterTypeEnum registerType = FrontUserRegisterTypeEnum.EMAIL;
44 | }
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/request/SensitiveWordRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import jakarta.validation.constraints.NotEmpty;
5 | import jakarta.validation.constraints.NotNull;
6 | import jakarta.validation.constraints.Size;
7 | import lombok.Data;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023/7/4
12 | * 敏感词新增或更新请求参数
13 | */
14 | @Schema(title = "敏感词新增或更新请求参数")
15 | @Data
16 | public class SensitiveWordRequest {
17 |
18 | @NotNull(groups = {Update.class}, message = "id 不能为空")
19 | @Schema(title = "id,修改用")
20 | private Integer id;
21 |
22 | @NotEmpty(groups = {Save.class, Update.class}, message = "敏感词名称不能为空")
23 | @Size(min = 1, max = 50, groups = {Save.class, Update.class}, message = "名称字数范围[1,50]")
24 | @Schema(title = "名称")
25 | private String word;
26 |
27 | /**
28 | * 新增
29 | */
30 | public interface Update {
31 |
32 | }
33 |
34 | /**
35 | * 更新
36 | */
37 | public interface Save {
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/request/SysUserLoginRequest.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.request;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.Data;
5 |
6 | import jakarta.validation.constraints.NotNull;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023-3-28
11 | * 系统用户登录参数
12 | */
13 | @Schema(title = "系统用户登录参数")
14 | @Data
15 | public class SysUserLoginRequest {
16 |
17 | @NotNull(message = "账号不能为空")
18 | @Schema(title = "账号")
19 | private String account;
20 |
21 | @NotNull(message = "密码不能为空")
22 | @Schema(title = "密码")
23 | private String password;
24 | }
25 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/vo/LoginInfoVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.vo;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | /**
10 | * 登录成功返回登录结果
11 | *
12 | * @author CoDeleven
13 | */
14 | @NoArgsConstructor
15 | @AllArgsConstructor
16 | @Builder
17 | @Data
18 | @Schema(title = "登录成功后返回前端登录结果")
19 | public class LoginInfoVO {
20 |
21 | @Schema(title = "登录的Token")
22 | private String token;
23 |
24 | @Schema(title = "基础用户ID")
25 | private Integer baseUserId;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/vo/RegisterCaptchaVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.vo;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Builder;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | /**
10 | * 注册验证码请求参数
11 | *
12 | * @author CoDeleven
13 | */
14 | @NoArgsConstructor
15 | @AllArgsConstructor
16 | @Builder
17 | @Data
18 | @Schema(title = "每次注册前需要获取图形验证码信息")
19 | public class RegisterCaptchaVO {
20 |
21 | @Schema(title = "图形验证码会话ID,注册时需要传过来")
22 | private String picCodeSessionId;
23 |
24 | @Schema(title = "图形验证码Base64")
25 | private String picCodeBase64;
26 | }
27 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/vo/SensitiveWordVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.EnableDisableStatusEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.Data;
6 |
7 | import java.util.Date;
8 |
9 | /**
10 | * @author hncboy
11 | * @date 2023-3-28
12 | * 敏感词展示参数
13 | */
14 | @Data
15 | @Schema(title = "敏感词展示参数")
16 | public class SensitiveWordVO {
17 |
18 | @Schema(title = "主键")
19 | private Long id;
20 |
21 | @Schema(title = "敏感词内容")
22 | private String word;
23 |
24 | @Schema(title = "状态 1 启用 2 停用")
25 | private EnableDisableStatusEnum status;
26 |
27 | @Schema(title = "创建时间")
28 | private Date createTime;
29 |
30 | @Schema(title = "更新时间")
31 | private Date updateTime;
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/vo/SysParamVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.vo;
2 |
3 | import io.swagger.v3.oas.annotations.media.Schema;
4 | import lombok.Data;
5 |
6 | import java.util.Date;
7 |
8 | /**
9 | * @author hncboy
10 | * @date 2023/5/10
11 | * 系统参数
12 | */
13 | @Data
14 | @Schema(title = "系统参数")
15 | public class SysParamVO {
16 |
17 | @Schema(title = "id")
18 | private Integer id;
19 |
20 | @Schema(title = "名称")
21 | private String name;
22 |
23 | @Schema(title = "key")
24 | private String paramKey;
25 |
26 | @Schema(title = "value")
27 | private String paramValue;
28 |
29 | @Schema(title = "创建时间")
30 | private Date createTime;
31 |
32 | @Schema(title = "更新时间")
33 | private Date updateTime;
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/domain/vo/UserInfoVO.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.domain.vo;
2 |
3 | import com.hncboy.beehive.base.enums.FrontUserStatusEnum;
4 | import io.swagger.v3.oas.annotations.media.Schema;
5 | import lombok.AllArgsConstructor;
6 | import lombok.Builder;
7 | import lombok.Data;
8 | import lombok.NoArgsConstructor;
9 |
10 | /**
11 | * 登录成功返回用户信息
12 | *
13 | * @author CoDeleven
14 | */
15 | @NoArgsConstructor
16 | @AllArgsConstructor
17 | @Builder
18 | @Data
19 | @Schema(title = "登录成功后返回前端用户信息")
20 | public class UserInfoVO {
21 |
22 | @Schema(title = "基础用户ID")
23 | private Integer baseUserId;
24 |
25 | @Schema(title = "用户昵称")
26 | private String nickname;
27 |
28 | @Schema(title = "状态枚举")
29 | private FrontUserStatusEnum status;
30 |
31 | @Schema(title = "邮箱")
32 | private String email;
33 |
34 | @Schema(title = "自我介绍")
35 | private String description;
36 |
37 | @Schema(title = "头像地址")
38 | private String avatarUrl;
39 | }
40 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/handler/converter/SensitiveWordConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.handler.converter;
2 |
3 | import com.hncboy.beehive.base.domain.entity.SensitiveWordDO;
4 | import com.hncboy.beehive.web.domain.vo.SensitiveWordVO;
5 | import org.mapstruct.Mapper;
6 | import org.mapstruct.factory.Mappers;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023-3-28
13 | * 敏感词相关转换
14 | */
15 | @Mapper
16 | public interface SensitiveWordConverter {
17 |
18 | SensitiveWordConverter INSTANCE = Mappers.getMapper(SensitiveWordConverter.class);
19 |
20 | /**
21 | * List 转 List
22 | *
23 | * @param sensitiveWordDOList List
24 | * @return List
25 | */
26 | List entityToVO(List sensitiveWordDOList);
27 |
28 | /**
29 | * SensitiveWordDO 转 SensitiveWordVO
30 | *
31 | * @param sensitiveWordDO SensitiveWordDO
32 | * @return SensitiveWordVO
33 | */
34 | SensitiveWordVO entityToVO(SensitiveWordDO sensitiveWordDO);
35 | }
36 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/handler/converter/SysParamConverter.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.handler.converter;
2 |
3 | import com.hncboy.beehive.web.domain.vo.SysParamVO;
4 | import com.hncboy.beehive.base.domain.entity.SysParamDO;
5 | import org.mapstruct.Mapper;
6 | import org.mapstruct.factory.Mappers;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/10
13 | * 系统参数相关转换
14 | */
15 | @Mapper
16 | public interface SysParamConverter {
17 |
18 | SysParamConverter INSTANCE = Mappers.getMapper(SysParamConverter.class);
19 |
20 | /**
21 | * entity 转 VO
22 | *
23 | * @param sysParamDOList List
24 | * @return List
25 | */
26 | List entityToVO(List sysParamDOList);
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/handler/validation/FrontUserRegisterAvailable.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.handler.validation;
2 |
3 | import com.hncboy.beehive.web.handler.validation.FrontUserRegisterAvailableValidator;
4 | import jakarta.validation.Constraint;
5 | import jakarta.validation.Payload;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * 前端用户注册校验器
14 | *
15 | * @author CoDeleven
16 | */
17 | @Target({ElementType.TYPE})
18 | @Retention(RetentionPolicy.RUNTIME)
19 | @Constraint(validatedBy = FrontUserRegisterAvailableValidator.class)
20 | public @interface FrontUserRegisterAvailable {
21 |
22 | String message() default "校验不通过";
23 |
24 | Class>[] groups() default {};
25 |
26 | Class extends Payload>[] payload() default {};
27 | }
28 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/EmailService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import cn.hutool.core.lang.Pair;
4 |
5 | /**
6 | * 邮箱服务
7 | *
8 | * @author CoDeleven
9 | */
10 | public interface EmailService {
11 |
12 | /**
13 | * 发送邮箱验证码到目标邮箱里去
14 | *
15 | * @param targetEmail 目标邮箱
16 | * @param verifyCode 验证码
17 | * @return 是否发送成功
18 | */
19 | Pair sendForVerifyCode(String targetEmail, String verifyCode);
20 | }
21 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/EmailVerifyCodeService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.EmailVerifyCodeDO;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 | import com.hncboy.beehive.base.enums.EmailBizTypeEnum;
6 |
7 | /**
8 | * 邮箱验证码核销记录业务接口
9 | *
10 | * @author CoDeleven
11 | */
12 | public interface EmailVerifyCodeService extends IService {
13 |
14 | /**
15 | * 创建校验码
16 | *
17 | * @param emailBizTypeEnum 业务用途枚举
18 | * @param identity 标识
19 | * @return 校验码
20 | */
21 | EmailVerifyCodeDO createVerifyCode(EmailBizTypeEnum emailBizTypeEnum, String identity);
22 |
23 | /**
24 | * 根据验证码查找一个有效(未过期,未验证)的验证记录
25 | *
26 | * @param verifyCode 验证码
27 | * @return 验证记录
28 | */
29 | EmailVerifyCodeDO findAvailableByVerifyCode(String verifyCode);
30 |
31 | /**
32 | * 完成验证记录
33 | *
34 | * @param availableVerifyCode 待完成的验证记录
35 | */
36 | void verifySuccess(EmailVerifyCodeDO availableVerifyCode);
37 | }
38 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/FrontUserBaseService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.hncboy.beehive.base.domain.entity.FrontUserBaseDO;
5 |
6 | /**
7 | * 前端用户基础用户业务接口
8 | *
9 | * @author CoDeleven
10 | */
11 | public interface FrontUserBaseService extends IService {
12 |
13 | /**
14 | * 创建一个空的基础用户信息
15 | *
16 | * @return 用户信息
17 | */
18 | FrontUserBaseDO createEmptyBaseUser();
19 |
20 | /**
21 | * 获取基础用户信息
22 | *
23 | * @param baseUserId 基础用户 id
24 | * @return 用户信息
25 | */
26 | FrontUserBaseDO findUserInfoById(Integer baseUserId);
27 |
28 | /**
29 | * 更新上次登录 ip
30 | *
31 | * @param baseUserId 基础用户 id
32 | */
33 | void updateLastLoginIp(Integer baseUserId);
34 | }
35 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/FrontUserExtraBindingService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.hncboy.beehive.base.domain.entity.FrontUserBaseDO;
5 | import com.hncboy.beehive.base.domain.entity.FrontUserExtraBindingDO;
6 | import com.hncboy.beehive.base.domain.entity.FrontUserExtraEmailDO;
7 | import com.hncboy.beehive.base.enums.FrontUserRegisterTypeEnum;
8 |
9 | /**
10 | * 前端用户绑定相关业务接口
11 | *
12 | * @author CoDeleven
13 | */
14 | public interface FrontUserExtraBindingService extends IService {
15 |
16 | /**
17 | * 绑定邮箱
18 | *
19 | * @param baseUser 基础用户
20 | * @param extraEmailDO 邮件扩展信息
21 | */
22 | void bindEmail(FrontUserBaseDO baseUser, FrontUserExtraEmailDO extraEmailDO);
23 |
24 | /**
25 | * 找到绑定关系
26 | *
27 | * @param frontUserRegisterTypeEnum 注册类型
28 | * @param extraInfoId 扩展信息 id
29 | * @return 绑定关系
30 | */
31 | FrontUserExtraBindingDO findExtraBinding(FrontUserRegisterTypeEnum frontUserRegisterTypeEnum, Integer extraInfoId);
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/FrontUserExtraEmailService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.baomidou.mybatisplus.extension.service.IService;
4 | import com.hncboy.beehive.base.domain.entity.FrontUserExtraEmailDO;
5 |
6 | /**
7 | * 前端用户邮箱扩展业务接口
8 | *
9 | * @author CoDeleven
10 | */
11 | public interface FrontUserExtraEmailService extends IService {
12 |
13 | /**
14 | * 是否已使用
15 | *
16 | * @param username 邮箱
17 | * @return 是否已使用,true已使用;false未使用
18 | */
19 | boolean isUsed(String username);
20 |
21 | /**
22 | * 获取一个未被验证的邮箱账号信息
23 | *
24 | * @param identity 邮箱
25 | * @return 邮箱信息
26 | */
27 | FrontUserExtraEmailDO getUnverifiedEmailAccount(String identity);
28 |
29 | /**
30 | * 根据用户名获取邮箱账号信息
31 | *
32 | * @param username 邮箱
33 | * @return 邮箱信息
34 | */
35 | FrontUserExtraEmailDO getEmailAccount(String username);
36 |
37 | /**
38 | * 邮件验证完毕
39 | *
40 | * @param emailExtraInfo 邮箱登录信息
41 | */
42 | void verifySuccess(FrontUserExtraEmailDO emailExtraInfo);
43 | }
44 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/SysEmailSendLogService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.SysEmailSendLogDO;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 | import com.hncboy.beehive.base.enums.EmailBizTypeEnum;
6 |
7 | /**
8 | * 邮箱发送日志业务接口
9 | *
10 | * @author CoDeleven
11 | */
12 | public interface SysEmailSendLogService extends IService {
13 |
14 | /**
15 | * 创建邮件发送成功的日志
16 | *
17 | * @param messageId 邮件msgId
18 | * @param from 发件人地址
19 | * @param to 收件人地址
20 | * @param bizType 业务类型
21 | * @param content 发送内容
22 | */
23 | void createSuccessLogBySysLog(String messageId, String from, String to, EmailBizTypeEnum bizType, String content);
24 |
25 | /**
26 | * 创建邮件发送失败的日志
27 | *
28 | * @param messageId 邮件msgId
29 | * @param from 发件人地址
30 | * @param to 收件人地址
31 | * @param bizType 业务类型
32 | * @param content 发送内容
33 | * @param failedMsg 失败消息
34 | */
35 | void createFailedLogBySysLog(String messageId, String from, String to, EmailBizTypeEnum bizType, String content, String failedMsg);
36 | }
37 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/SysFrontUserLoginLogService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.hncboy.beehive.base.domain.entity.SysFrontUserLoginLogDO;
4 | import com.baomidou.mybatisplus.extension.service.IService;
5 | import com.hncboy.beehive.base.enums.FrontUserRegisterTypeEnum;
6 |
7 | /**
8 | * 前端用户登录日志业务接口
9 | *
10 | * @author CoDeleven
11 | */
12 | public interface SysFrontUserLoginLogService extends IService {
13 |
14 | /**
15 | * 登录失败记录表
16 | *
17 | * @param registerType 注册类型
18 | * @param extraInfoId 登录信息表ID
19 | * @param baseUserId 基础用户ID
20 | * @param message 失败原因
21 | */
22 | void loginFailed(FrontUserRegisterTypeEnum registerType, Integer extraInfoId, Integer baseUserId, String message);
23 |
24 | /**
25 | * 登录成功记录表
26 | *
27 | * @param registerType 注册类型
28 | * @param extraInfoId 登录信息表ID
29 | * @param baseUserId 基础用户ID
30 | */
31 | void loginSuccess(FrontUserRegisterTypeEnum registerType, Integer extraInfoId, Integer baseUserId);
32 | }
33 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/SysParamService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.hncboy.beehive.web.domain.query.SysParamPageQuery;
4 | import com.hncboy.beehive.web.domain.request.SysParamRequest;
5 | import com.hncboy.beehive.web.domain.vo.SysParamVO;
6 | import com.hncboy.beehive.base.domain.entity.SysParamDO;
7 | import com.baomidou.mybatisplus.core.metadata.IPage;
8 | import com.baomidou.mybatisplus.extension.service.IService;
9 |
10 | /**
11 | * @author hncboy
12 | * @date 2023/5/10
13 | * 系统参数业务接口
14 | */
15 | public interface SysParamService extends IService {
16 |
17 | /**
18 | * 参数分页
19 | *
20 | * @param query 查询条件
21 | * @return 分页结果
22 | */
23 | IPage page(SysParamPageQuery query);
24 |
25 | /**
26 | * 参数保存
27 | *
28 | * @param request 请求参数
29 | * @return id
30 | */
31 | Integer save(SysParamRequest request);
32 |
33 | /**
34 | * 参数更新
35 | *
36 | * @param request 请求参数
37 | */
38 | void update(SysParamRequest request);
39 |
40 | /**
41 | * 参数删除
42 | *
43 | * @param id id
44 | */
45 | void remove(Integer id);
46 | }
47 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/SysUserService.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service;
2 |
3 | import com.hncboy.beehive.web.domain.request.SysUserLoginRequest;
4 |
5 | /**
6 | * @author hncboy
7 | * @date 2023-3-28
8 | * 系统用户相关接口
9 | */
10 | public interface SysUserService {
11 |
12 | /**
13 | * 登录
14 | *
15 | * @param sysUserLoginRequest 登录参数
16 | */
17 | void login(SysUserLoginRequest sysUserLoginRequest);
18 | }
19 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/impl/SysUserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service.impl;
2 |
3 | import com.hncboy.beehive.web.domain.request.SysUserLoginRequest;
4 | import com.hncboy.beehive.web.service.SysUserService;
5 | import com.hncboy.beehive.base.cache.SysParamCache;
6 | import com.hncboy.beehive.base.exception.AuthException;
7 | import com.hncboy.beehive.base.util.StpAdminUtil;
8 | import org.springframework.stereotype.Service;
9 |
10 | import java.util.Arrays;
11 | import java.util.Map;
12 |
13 | /**
14 | * @author hncboy
15 | * @date 2023-3-28
16 | * 系统用户业务实现类
17 | */
18 | @Service
19 | public class SysUserServiceImpl implements SysUserService {
20 |
21 | private static final String ADMIN_ACCOUNT = "admin-account";
22 | private static final String ADMIN_PASSWORD = "admin-password";
23 |
24 | @Override
25 | public void login(SysUserLoginRequest sysUserLoginRequest) {
26 | Map adminInfoMap = SysParamCache.multiGet(Arrays.asList(ADMIN_ACCOUNT, ADMIN_PASSWORD));
27 | if (sysUserLoginRequest.getAccount().equals(adminInfoMap.get(ADMIN_ACCOUNT)) && sysUserLoginRequest.getPassword().equals(adminInfoMap.get(ADMIN_PASSWORD))) {
28 | StpAdminUtil.login(sysUserLoginRequest.getAccount());
29 | return;
30 | }
31 | throw new AuthException("账号或密码错误");
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/beehive-web/src/main/java/com/hncboy/beehive/web/service/strategy/package-info.java:
--------------------------------------------------------------------------------
1 | package com.hncboy.beehive.web.service.strategy;
--------------------------------------------------------------------------------
/docs/pics/cell_list_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_list_01.png
--------------------------------------------------------------------------------
/docs/pics/cell_midjourney_describe_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_midjourney_describe_01.png
--------------------------------------------------------------------------------
/docs/pics/cell_midjourney_describe_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_midjourney_describe_02.png
--------------------------------------------------------------------------------
/docs/pics/cell_midjourney_imagine_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_midjourney_imagine_01.png
--------------------------------------------------------------------------------
/docs/pics/cell_midjourney_imagine_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_midjourney_imagine_02.png
--------------------------------------------------------------------------------
/docs/pics/cell_midjourney_upscale_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_midjourney_upscale_01.png
--------------------------------------------------------------------------------
/docs/pics/cell_midjourney_variation_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_midjourney_variation_01.png
--------------------------------------------------------------------------------
/docs/pics/cell_openai_gpt_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_openai_gpt_01.png
--------------------------------------------------------------------------------
/docs/pics/cell_openai_image_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/cell_openai_image_01.png
--------------------------------------------------------------------------------
/docs/pics/login_with_not_permit_email_suffix.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/login_with_not_permit_email_suffix.png
--------------------------------------------------------------------------------
/docs/pics/register_login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/register_login.png
--------------------------------------------------------------------------------
/docs/pics/system_not_permit_register.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/system_not_permit_register.png
--------------------------------------------------------------------------------
/docs/pics/wechat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hncboy/ai-beehive/a87a815b14e82bc68c9e682b2438a728105e21a7/docs/pics/wechat.png
--------------------------------------------------------------------------------