AI 接口添加
This commit is contained in:
@@ -151,4 +151,11 @@ public interface IHotakeAiCommonToolsService {
|
||||
*/
|
||||
public HotakeCandidateCompatibilityDto handleCandidateCompatibility(HotakeCandidateCompatibilityVo compatibilityVo);
|
||||
|
||||
/**
|
||||
* 候选人面试综合评估
|
||||
* @param evaluationVo 候选人面试综合评估 输入信息
|
||||
* @return
|
||||
*/
|
||||
public HotakeCandidateCompatibilityDto getCandidateInterviewEvaluation(HotakeCandidateInterviewEvaluationVo evaluationVo);
|
||||
|
||||
}
|
||||
|
||||
@@ -1331,4 +1331,86 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 候选人面试综合评估
|
||||
*
|
||||
* @param evaluationVo 候选人面试综合评估 输入信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HotakeCandidateCompatibilityDto getCandidateInterviewEvaluation(HotakeCandidateInterviewEvaluationVo evaluationVo) {
|
||||
HotakeCandidateCompatibilityDto dto = new HotakeCandidateCompatibilityDto();
|
||||
String prompt = AiCommonPromptConstants.initializationCandidateInterviewEvaluationPrompt();
|
||||
|
||||
String userPrompt_1 = "Job Posting:\n" +
|
||||
"Title: "+evaluationVo.getTitle()+"\n" +
|
||||
"Description: "+evaluationVo.getDescription()+"\n" +
|
||||
"Required Skills: ${jobPosting.required_skills.join(', ')}\n" +
|
||||
"Preferred Skills: ${jobPosting.preferred_skills.join(', ')}\n" +
|
||||
"Experience Required: ${jobPosting.experience_required}\n" +
|
||||
"\n" +
|
||||
"Candidate Information:\n" +
|
||||
"Name: ${candidate.name}\n" +
|
||||
"Current Position: ${candidate.current_position}\n" +
|
||||
"Email: ${candidate.email}\n" +
|
||||
"Work Experience: ${candidate.work_experience}\n" +
|
||||
"Skills: ${candidate.skills.join(', ')}\n" +
|
||||
"Education: ${candidate.education}\n" +
|
||||
"Certifications: ${candidate.certifications.join(', ')}\n" +
|
||||
"\n" +
|
||||
"${interviewData ? `Interview Data:\n" +
|
||||
"Questions: ${interviewData.questions.join('; ')}\n" +
|
||||
"Answers: ${interviewData.answers.join('; ')}\n" +
|
||||
"Scores: Technical=${interviewData.scores.technical}, Communication=${interviewData.scores.communication}, Safety Awareness=${interviewData.scores.safety_awareness}, Problem Solving=${interviewData.scores.problem_solving}` : ''}\n" +
|
||||
"\n" +
|
||||
"Please analyze this candidate and provide a comprehensive overview with Assessment, Rating, and Questions scores.";
|
||||
|
||||
//处理岗位信息补充
|
||||
List<Map<String, String>> listOne = new LinkedList();
|
||||
Map<String, String> mapEntityOne = new HashMap<>();
|
||||
mapEntityOne.put("role", "system");
|
||||
mapEntityOne.put("content", prompt);
|
||||
listOne.add(mapEntityOne);
|
||||
Map<String, String> mapUserEntityOne = new HashMap<>();
|
||||
mapUserEntityOne.put("role", "user");
|
||||
mapUserEntityOne.put("content", userPrompt_1);
|
||||
listOne.add(mapUserEntityOne);
|
||||
String promptJsonOne = JSONUtil.toJsonStr(listOne);
|
||||
String resultStrOne = chatGPTClient.handleAiChat(promptJsonOne, "AICAC");
|
||||
String resultJsonOne = resultStrOne.replaceAll("```json", "").replaceAll("```", "");
|
||||
log.info("候选人面试综合评估:{}", resultJsonOne);
|
||||
Map dataMap = JSONUtil.toBean(resultJsonOne, Map.class);
|
||||
if(ObjectUtil.isNotEmpty(dataMap.get("strengths_score"))){
|
||||
dto.setStrengthsScore(new BigDecimal(dataMap.get("strengths_score").toString()));
|
||||
}else{
|
||||
dto.setStrengthsScore(BigDecimal.ZERO);
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(dataMap.get("differences_score"))){
|
||||
dto.setDifferencesScore(new BigDecimal(dataMap.get("differences_score").toString()));
|
||||
}else{
|
||||
dto.setDifferencesScore(BigDecimal.ZERO);
|
||||
}
|
||||
if(ObjectUtil.isNotEmpty(dataMap.get("cultural_score"))){
|
||||
dto.setCulturalScore(new BigDecimal(dataMap.get("cultural_score").toString()));
|
||||
}else{
|
||||
dto.setCulturalScore(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
List<String> strengths = (List<String>)dataMap.get("key_strengths");
|
||||
dto.setKeyStrengths(strengths);
|
||||
|
||||
List<String> differences = (List<String>)dataMap.get("key_differences");
|
||||
dto.setKeyDifferences(differences);
|
||||
|
||||
List<String> fitDetails = (List<String>)dataMap.get("cultural_fit_details");
|
||||
dto.setCulturalFitDetails(fitDetails);
|
||||
|
||||
BigDecimal overallScore = dto.getStrengthsScore().multiply(new BigDecimal(0.4)).
|
||||
add(dto.getDifferencesScore().multiply(new BigDecimal(0.3)).add(dto.getCulturalScore().multiply(new BigDecimal(0.3))));
|
||||
dto.setOverallScore(overallScore);
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user