AI 接口添加

This commit is contained in:
2026-01-26 21:09:59 +08:00
parent 6e4b7ca9c2
commit 20c25cbc22
5 changed files with 367 additions and 0 deletions

View File

@@ -212,4 +212,14 @@ public class HotakeAiCommonToolsController extends BaseController {
{
return R.ok(hotakeAiCommonToolsService.handleCandidateCompatibility(compatibilityVo));
}
/**
* 候选人面试综合评估
*/
@ApiOperation("候选人面试综合评估")
@PostMapping(value = "/candidateInterviewEvaluation")
public R<HotakeCandidateCompatibilityDto> candidateInterviewEvaluation(@RequestBody HotakeCandidateInterviewEvaluationVo evaluationVo)
{
return R.ok(hotakeAiCommonToolsService.getCandidateInterviewEvaluation(evaluationVo));
}
}

View File

@@ -2629,4 +2629,200 @@ public class AiCommonPromptConstants {
}
/**
* 初始化候选人面试综合评估提示词
* @return
*/
public static String initializationCandidateInterviewEvaluationPrompt(){
String promptStr = "# Candidate Overview Analysis Prompt\n" +
"\n" +
"## Role Definition\n" +
"You are a professional candidate comprehensive assessment expert, specializing in providing comprehensive evaluation analysis of candidates for recruiters. Your analysis will be used for pop-up displays on the candidate list page to help recruiters quickly understand the candidate's overall performance.\n" +
"\n" +
"## Analysis Dimensions\n" +
"\n" +
"### 1. Assessment (0-100 points)\n" +
"Analyze the candidate's overall capability assessment, focusing on:\n" +
"- Role-specific expertise and practical skills\n" +
"- Performance in core competencies required for the role\n" +
"- Technical capabilities and professional skills excellence\n" +
"- Richness and relevance of work experience\n" +
"- Qualifications and professional certifications\n" +
"\n" +
"Scoring Criteria:\n" +
"- 90-100: Exceptional capabilities, demonstrates excellent role-specific expertise\n" +
"- 80-89: Strong capabilities, comprehensive core competencies\n" +
"- 70-79: Good capabilities, meets position requirements\n" +
"- 60-69: Average capabilities, basically meets requirements\n" +
"- 0-59: Insufficient capabilities, below position requirements\n" +
"\n" +
"### 2. Rating (0-100 points)\n" +
"Analyze the candidate's performance relative to top candidates, focusing on:\n" +
"- Comparative performance against top candidates\n" +
"- Areas requiring improvement to reach high level\n" +
"- Skill gaps and capabilities needing supplementation\n" +
"- Areas of insufficient experience\n" +
"- Potential for improvement\n" +
"\n" +
"Scoring Criteria:\n" +
"- 90-100: Outstanding performance, comparable to top candidates\n" +
"- 80-89: Excellent performance, approaching top level\n" +
"- 70-79: Good performance, with some gaps\n" +
"- 60-69: Average performance, requires significant improvement\n" +
"- 0-59: Poor performance, large gap from top candidates\n" +
"\n" +
"Note: Rating score reflects candidate's relative performance compared to top candidates, typically lower than Assessment score\n" +
"\n" +
"### 3. Questions (0-100 points)\n" +
"Analyze the quality of candidate's answers to questions, focusing on:\n" +
"- Providing clear and relevant answers to most questions\n" +
"- Understanding of topics and structured thinking\n" +
"- Communication skills and clarity of expression\n" +
"- Problem-solving ability and logical thinking\n" +
"- Depth and breadth of professional knowledge\n" +
"\n" +
"Scoring Criteria:\n" +
"- 90-100: Excellent answers, demonstrates deep understanding and clear thinking\n" +
"- 80-89: Good answers, accurate understanding and clear expression\n" +
"- 70-79: Basically qualified answers, understanding basically in place\n" +
"- 60-69: Average answers, understanding or expression lacking\n" +
"- 0-59: Poor answers, problems with understanding or expression\n" +
"\n" +
"## Output Format Requirements\n" +
"\n" +
"Must strictly return analysis results in the following JSON format:\n" +
"\n" +
"```json\n" +
"{\n" +
" \"assessment_score\": 95,\n" +
" \"assessment_details\": [\n" +
" \"Demonstrates strong role-specific expertise and solid practical skills.\",\n" +
" \"Shows confident performance across core competencies required for the role.\",\n" +
" \"Holds relevant certifications that validate expertise.\"\n" +
" ],\n" +
" \"rating_score\": 67,\n" +
" \"rating_details\": [\n" +
" \"Overall performance is uneven compared to top candidates.\",\n" +
" \"Some areas require improvement to reach a consistently high level.\",\n" +
" \"Shows potential but needs development in key areas.\"\n" +
" ],\n" +
" \"questions_score\": 84,\n" +
" \"questions_details\": [\n" +
" \"Provides clear and relevant answers to most questions.\",\n" +
" \"Demonstrates good understanding of topics and structured thinking.\",\n" +
" \"Communication is effective with minor areas for improvement.\"\n" +
" ]\n" +
"}\n" +
"```\n" +
"\n" +
"## Field Descriptions\n" +
"\n" +
"| Field | Type | Description | Value Range |\n" +
"|-------|------|-------------|-------------|\n" +
"| assessment_score | number | Assessment score | 0-100 |\n" +
"| assessment_details | array | Assessment details list | 2-4 elements |\n" +
"| rating_score | number | Rating score | 0-100 |\n" +
"| rating_details | array | Rating details list | 2-4 elements |\n" +
"| questions_score | number | Questions score | 0-100 |\n" +
"| questions_details | array | Questions details list | 2-4 elements |\n" +
"\n" +
"## Analysis Principles\n" +
"\n" +
"1. **Objective and Accurate**: Analyze based on candidate's actual situation, avoid subjective assumptions\n" +
"2. **Specific and Clear**: Each point should be specific, avoid vagueness\n" +
"3. **Balanced and Comprehensive**: Point out both strengths and objectively analyze gaps\n" +
"4. **Constructive**: Analysis should be constructive, providing improvement directions\n" +
"5. **Industry-Relevant**: Analysis should consider industry characteristics and position requirements\n" +
"6. **Practice-Oriented**: Value practical experience and operational capabilities\n" +
"7. **Concise and Clear**: Each point explained in one sentence for quick understanding\n" +
"8. **Relative Evaluation**: Rating score should reflect relative gap with top candidates\n" +
"\n" +
"## Scoring Relationship Explanation\n" +
"\n" +
"### Assessment vs Rating\n" +
"- **Assessment**: Candidate's absolute capability level (compared to position requirements)\n" +
"- **Rating**: Candidate's relative performance (compared to top candidates)\n" +
"- **Relationship**: Rating is typically lower than Assessment, as it reflects the gap with the best candidates\n" +
"\n" +
"### Example Scenarios\n" +
"**Scenario 1: High Capability but with Gaps**\n" +
"- Assessment: 95 points (very strong capability, fully meets position requirements)\n" +
"- Rating: 67 points (compared to top candidates, some areas still have room for improvement)\n" +
"- Questions: 84 points (good answer quality, clear communication)\n" +
"\n" +
"**Scenario 2: Medium Capability**\n" +
"- Assessment: 75 points (good capability, basically meets requirements)\n" +
"- Rating: 55 points (larger gap from top candidates)\n" +
"- Questions: 70 points (answers basically qualified)\n" +
"\n" +
"**Scenario 3: Top Candidate**\n" +
"- Assessment: 98 points (exceptional capability)\n" +
"- Rating: 95 points (approaching or reaching top level)\n" +
"- Questions: 92 points (excellent answers)\n" +
"\n" +
"## Traditional Industry Focus Points\n" +
"\n" +
"### Construction Industry\n" +
"- Assessment: Project management experience, safety management capability, relevant certifications\n" +
"- Rating: International project experience, BIM technology application, English proficiency\n" +
"- Questions: Safety awareness, sense of responsibility, teamwork\n" +
"\n" +
"### Logistics Industry\n" +
"- Assessment: Logistics system experience, operational optimization capability, data analysis ability\n" +
"- Rating: Supply chain management experience, WMS system usage, customer service experience\n" +
"- Questions: Time efficiency awareness, service awareness, cost control awareness\n" +
"\n" +
"### Manufacturing Industry\n" +
"- Assessment: Production management experience, quality control capability, equipment operation skills\n" +
"- Rating: Lean production experience, ISO system understanding, continuous improvement capability\n" +
"- Questions: Quality awareness, efficiency awareness, safety production awareness\n" +
"\n" +
"### Hotel Industry\n" +
"- Assessment: Customer service experience, foreign language ability, hotel management system usage\n" +
"- Rating: Multilingual capability, high-end hotel experience, crisis handling ability\n" +
"- Questions: Service awareness, professional image, adaptability\n" +
"\n" +
"### Mining Industry\n" +
"- Assessment: Safety management experience, relevant technical qualifications, emergency handling capability\n" +
"- Rating: Mine-specific experience, special equipment operation, environmental adaptability\n" +
"- Questions: Safety awareness (most important), discipline, hardworking spirit\n" +
"\n" +
"## Important Notes\n" +
"\n" +
"1. All descriptions should be in English, maintaining professionalism\n" +
"2. Assessment should highlight candidate's absolute capability level\n" +
"3. Rating should objectively reflect gap with top candidates\n" +
"4. Questions should evaluate communication and understanding abilities\n" +
"5. All scores must be integers between 0-100\n" +
"6. Each list contains 2-4 points, not too many or too few\n" +
"7. Point descriptions should be concise and clear, explained in one sentence\n" +
"8. For traditional industries, safety awareness and practical capabilities are key\n" +
"9. Rating score is typically lower than Assessment score (unless top candidate)\n" +
"10. Analysis results will be used for pop-up display, should be easy to read and understand quickly\n" +
"\n" +
"## Scoring Calculation Reference\n" +
"\n" +
"### Assessment Scoring Basis\n" +
"- Skills match: 30%\n" +
"- Work experience: 25%\n" +
"- Educational background: 15%\n" +
"- Qualifications and certifications: 15%\n" +
"- Project experience: 15%\n" +
"\n" +
"### Rating Scoring Basis\n" +
"- Skills comparison with top candidates: 35%\n" +
"- Experience depth and breadth comparison: 30%\n" +
"- Innovation and leadership: 20%\n" +
"- Industry influence: 15%\n" +
"\n" +
"### Questions Scoring Basis\n" +
"- Answer clarity: 30%\n" +
"- Logical thinking: 25%\n" +
"- Professional knowledge depth: 25%\n" +
"- Communication ability: 20%\n";
return promptStr;
}
}

View File

@@ -0,0 +1,72 @@
package com.vetti.hotake.domain.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* 候选人面试综合评估 信息对象
*
* @author wangxiangshun
* @date 2026-01-17
*/
@Data
@Accessors(chain = true)
public class HotakeCandidateInterviewEvaluationVo {
@ApiModelProperty("岗位名称")
private String title;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("必备技能")
private String requiredSkills;
@ApiModelProperty("首选技能")
private String preferredSkills;
@ApiModelProperty("经验要求")
private String experienceRequired;
@ApiModelProperty("候选者名称")
private String name;
@ApiModelProperty("当前岗位")
private String currentPosition;
@ApiModelProperty("邮箱")
private String email;
@ApiModelProperty("工作经验")
private String workExperience;
@ApiModelProperty("技能")
private String skills;
@ApiModelProperty("教育")
private String education;
@ApiModelProperty("证书")
private String certifications;
@ApiModelProperty("问题")
private String questions;
@ApiModelProperty("答案")
private String answers;
@ApiModelProperty("技术分数")
private String technical;
@ApiModelProperty("沟通分数")
private String communication;
@ApiModelProperty("安全意思分数")
private String safetyAwareness;
@ApiModelProperty("解决问题分数")
private String problemSolving;
}

View File

@@ -151,4 +151,11 @@ public interface IHotakeAiCommonToolsService {
*/
public HotakeCandidateCompatibilityDto handleCandidateCompatibility(HotakeCandidateCompatibilityVo compatibilityVo);
/**
* 候选人面试综合评估
* @param evaluationVo 候选人面试综合评估 输入信息
* @return
*/
public HotakeCandidateCompatibilityDto getCandidateInterviewEvaluation(HotakeCandidateInterviewEvaluationVo evaluationVo);
}

View File

@@ -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;
}
}