@@ -13,14 +13,12 @@ import com.vetti.common.enums.RoleBenefitsEnum;
import com.vetti.common.exception.ServiceException ;
import com.vetti.common.utils.SecurityUtils ;
import com.vetti.common.utils.html.ReadHtmlByOkHttp ;
import com.vetti.hotake.domain.HotakeInitScreQuestionsReplyRecordInfo ;
import com.vetti.hotake.domain.HotakeInitialScreeningQuestionsInfo ;
import com.vetti.hotake.domain.HotakeRolesApplyInfo ;
import com.vetti.hotake.domain.HotakeRolesInfo ;
import com.vetti.hotake.domain.* ;
import com.vetti.hotake.domain.dto.* ;
import com.vetti.hotake.domain.dto.VcDto.* ;
import com.vetti.hotake.domain.dto.roleDto.* ;
import com.vetti.hotake.domain.vo.* ;
import com.vetti.hotake.mapper.HotakeAiInterviewQuestionsInfoMapper ;
import com.vetti.hotake.mapper.HotakeInitialScreeningQuestionsInfoMapper ;
import com.vetti.hotake.mapper.HotakeRolesApplyInfoMapper ;
import com.vetti.hotake.mapper.HotakeRolesInfoMapper ;
@@ -55,6 +53,9 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
@Autowired
private HotakeInitialScreeningQuestionsInfoMapper hotakeInitialScreeningQuestionsInfoMapper ;
@Autowired
private HotakeAiInterviewQuestionsInfoMapper hotakeAiInterviewQuestionsInfoMapper ;
@Autowired
private ChatGPTClient chatGPTClient ;
@@ -588,12 +589,20 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
@Override
public String handleWebInfoExtract ( HotakeWebInfoExtractVo webInfoExtractVo ) {
//获取
String webContent = handleWebContentScraping ( webInfoExtractVo . getWebUrl ( ) ) ;
if ( StrUtil . isEmpty ( webInfoExtractVo . getWebUrl ( ) ) ) {
throw new ServiceException ( " " ) ;
}
String webUrl = webInfoExtractVo . getWebUrl ( ) ;
if ( ! webInfoExtractVo . getWebUrl ( ) . toLowerCase ( ) . contains ( " https " ) ) {
webUrl = webUrl . replaceAll ( " http " , " https " ) ;
}
String webContent = handleWebContentScraping ( webUrl ) ;
String prompt = AiCommonPromptConstants . initializationWebInfoExtractPrompt ( ) ;
String userPrompt = " Please analyze the following company website: \ n " +
" \ n " +
" URL: " + webInfoExtractVo . getWebUrl ( ) + " \ n " +
" URL: " + webUrl + " \ n " +
" \ n " +
" Content: \ n " +
webContent ;
@@ -973,19 +982,20 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
* @return
*/
@Override
public String getAiInterviewQuestions ( HotakeRolesInfo rolesInfo ) {
public HotakeAiInterviewQuestionsInfo getAiInterviewQuestions ( HotakeRolesInfo rolesInfo ) {
HotakeRolesInfo hotakeRolesInfo = hotakeRolesInfoMapper . selectHotakeRolesInfoById ( rolesInfo . getId ( ) ) ;
String prompt = AiCommonPromptConstants . initializationAiInterviewQuestionsPrompt ( ) ;
String userPrompt_1 = " Please generate AI interview questions based on the following job description: \ n " +
" \ n " +
" **Job Information**: \ n " +
" Job Title: 【 " + r olesInfo. getRoleName ( ) + " 】 \ n " +
" Technical Requirements: 【 " + r olesInfo. getRequiredSkillsJson ( ) + " - " + r olesInfo. getNiceToHaveSkillsJson ( ) + " 】 \ n " +
" Experience Requirements: 【 " + r olesInfo. getJobExperience ( ) + " 】 \ n " +
" Job Title: 【 " + hotakeR olesInfo. getRoleName ( ) + " 】 \ n " +
" Technical Requirements: 【 " + hotakeR olesInfo. getRequiredSkillsJson ( ) + " - " + hotakeR olesInfo. getNiceToHaveSkillsJson ( ) + " 】 \ n " +
" Experience Requirements: 【 " + hotakeR olesInfo. getJobExperience ( ) + " 】 \ n " +
" Interview Duration: 【】 \ n " +
" Company Culture: 【】 \ n " +
" Special Requirements: 【 " + r olesInfo. getAboutRole ( ) + " 】 \ n " +
" Special Requirements: 【 " + hotakeR olesInfo. getAboutRole ( ) + " 】 \ n " +
" `; " ;
log . info ( " AI面试问题生成:{} " , userPrompt_1 ) ;
//处理岗位信息补充
@@ -1003,7 +1013,35 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
String resultJsonOne = resultStrOne . replaceAll ( " ```json " , " " ) . replaceAll ( " ``` " , " " ) ;
log . info ( " AI面试问题生成结果:{} " , resultJsonOne ) ;
return resultJsonOne ;
try {
Map mapData = JSONUtil . toBean ( resultJsonOne , Map . class ) ;
List < Map > questionMapList = ( List < Map > ) mapData . get ( " interview_questions " ) ;
if ( CollectionUtil . isNotEmpty ( questionMapList ) ) {
HotakeAiInterviewQuestionsInfo questionsInfo = new HotakeAiInterviewQuestionsInfo ( ) ;
questionsInfo . setQuestionTitle ( " General Questions " ) ;
questionsInfo . setFocusType ( " Personality & Culture " ) ;
questionsInfo . setRoleId ( rolesInfo . getId ( ) ) ;
questionsInfo . setRecruiterId ( SecurityUtils . getUserId ( ) ) ;
questionsInfo . setOverview ( " This is General Questions Overview " ) ;
BigDecimal times = BigDecimal . ZERO ;
List < AiQuestionDto > questionDtoList = new ArrayList < > ( ) ;
for ( Map map : questionMapList ) {
AiQuestionDto questionDto = new AiQuestionDto ( ) ;
questionDto . setQuestions ( map . get ( " question_text " ) . toString ( ) ) ;
questionDtoList . add ( questionDto ) ;
times = times . add ( new BigDecimal ( map . get ( " estimated_time " ) . toString ( ) ) ) ;
}
questionsInfo . setAiQuestionList ( questionDtoList ) ;
questionsInfo . setTimes ( times . toString ( ) ) ;
//进行数据更新
hotakeAiInterviewQuestionsInfoMapper . insertHotakeAiInterviewQuestionsInfo ( questionsInfo ) ;
return questionsInfo ;
}
} catch ( Exception e ) {
e . printStackTrace ( ) ;
}
return new HotakeAiInterviewQuestionsInfo ( ) ;
}
/**