简历读取基础逻辑添加以及用户语音配置信息字段添加

This commit is contained in:
2025-11-05 15:33:51 +08:00
parent 86e2fe238b
commit 6f2689fd1e
14 changed files with 143 additions and 22 deletions

View File

@@ -179,7 +179,7 @@ public class ChatWebSocketHandler {
} }
Map<String,String> mapEntity = new HashMap<>(); Map<String,String> mapEntity = new HashMap<>();
mapEntity.put("role","system"); mapEntity.put("role","system");
mapEntity.put("content","You are an interviewer. Generate follow-up questions based on Construction Labourer candidate responses.Return Only One Question"); mapEntity.put("content","You are an interviewer. Generate follow-up questions based on Construction Labourer candidate responses.Only return one question and do not repeat the previously returned questions \\n MPORTANT: Do not ask the same question again if the answer is incorrect");
List<Map<String,String>> list = new LinkedList(); List<Map<String,String>> list = new LinkedList();
list.add(mapEntity); list.add(mapEntity);
promptJson = JSONUtil.toJsonStr(list); promptJson = JSONUtil.toJsonStr(list);
@@ -313,7 +313,7 @@ public class ChatWebSocketHandler {
} }
log.info("结束AI提示词为:{}",promptJson); log.info("结束AI提示词为:{}",promptJson);
ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class); ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class);
String resultMsg = gptClient.handleAiChat(promptJson); String resultMsg = gptClient.handleAiChat(promptJson,"QA");
Map<String, String> resultEntity = new HashMap<>(); Map<String, String> resultEntity = new HashMap<>();
resultEntity.put("msg", resultMsg); resultEntity.put("msg", resultMsg);
resultEntity.put("dataType","score"); resultEntity.put("dataType","score");

View File

@@ -59,7 +59,7 @@ public class AiCommonController extends BaseController
@GetMapping("/handleAiChat") @GetMapping("/handleAiChat")
public AjaxResult handleAiChat(@RequestParam String text) public AjaxResult handleAiChat(@RequestParam String text)
{ {
String resultMsg = chatGPTClient.handleAiChat(text); String resultMsg = chatGPTClient.handleAiChat(text,"QA");
return AjaxResult.success(resultMsg); return AjaxResult.success(resultMsg);
} }

View File

@@ -80,7 +80,7 @@ public class SysProfileController extends BaseController
/** /**
* 修改用户 * 修改用户
*/ */
@ApiOperation("个人信息完善") @ApiOperation("个人信息完善(按照步骤完善信息)")
@Log(title = "个人信息完善", businessType = BusinessType.UPDATE) @Log(title = "个人信息完善", businessType = BusinessType.UPDATE)
@PutMapping("/completeInfo") @PutMapping("/completeInfo")
public R personalInfoProfile(@RequestBody SysUser user) public R personalInfoProfile(@RequestBody SysUser user)
@@ -107,12 +107,25 @@ public class SysProfileController extends BaseController
currentUser.setSteps(user.getSteps()); currentUser.setSteps(user.getSteps());
if (userService.updateUserProfile(currentUser) > 0) if (userService.updateUserProfile(currentUser) > 0)
{ {
loginUser.setUser(currentUser);
// 更新缓存用户信息 // 更新缓存用户信息
tokenService.setLoginUser(loginUser); tokenService.setLoginUser(loginUser);
} }
return R.ok(); return R.ok();
} }
/**
* 个人信息修改
*/
@ApiOperation("个人信息修改")
@Log(title = "个人信息修改", businessType = BusinessType.UPDATE)
@PutMapping("/updatePersonalInfo")
public R updatePersonalInfoProfile(@RequestBody SysUser user)
{
userService.updateUserProfile(user);
return R.ok();
}
/** /**
* 修改用户 * 修改用户

View File

@@ -169,7 +169,8 @@ whisper:
chatGpt: chatGpt:
apiKey: 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 apiKey: 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
apiUrl: https://api.openai.com/v1/chat/completions apiUrl: https://api.openai.com/v1/chat/completions
model: ft:gpt-3.5-turbo-0125:vetti:construction-labourer-test:CWKBNvE2 model: ft:gpt-3.5-turbo-0125:vetti:construction-labourer-test:CTIvLD5n
modelCV: ft:gpt-3.5-turbo-0125:vetti:vetti-resume-test:CWPinJQq
role: system role: system

View File

@@ -169,7 +169,8 @@ whisper:
chatGpt: chatGpt:
apiKey: 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 apiKey: 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
apiUrl: https://api.openai.com/v1/chat/completions apiUrl: https://api.openai.com/v1/chat/completions
model: ft:gpt-3.5-turbo-0125:vetti:construction-labourer-test:CWKBNvE2 model: ft:gpt-3.5-turbo-0125:vetti:construction-labourer-test:CTIvLD5n
modelCV: ft:gpt-3.5-turbo-0125:vetti:vetti-resume-test:CWPinJQq
role: system role: system

View File

@@ -33,6 +33,9 @@ public class ChatGPTClient {
@Value("${chatGpt.model}") @Value("${chatGpt.model}")
private String model; private String model;
@Value("${chatGpt.modelCV}")
private String modelCV;
@Value("${chatGpt.role}") @Value("${chatGpt.role}")
private String role; private String role;
@@ -42,7 +45,7 @@ public class ChatGPTClient {
* @param promptText 文字提示信息 * @param promptText 文字提示信息
* @return * @return
*/ */
public String handleAiChat(String promptText) { public String handleAiChat(String promptText,String type) {
String resultText = ""; String resultText = "";
// 创建ChatGPT客户端 // 创建ChatGPT客户端
// HTTP客户端 // HTTP客户端
@@ -54,7 +57,14 @@ public class ChatGPTClient {
ObjectMapper objectMapper = new ObjectMapper();; ObjectMapper objectMapper = new ObjectMapper();;
// 单轮对话返回结果 // 单轮对话返回结果
try { try {
if("CV".equals(type)){
resultText = sendMessage(promptText, modelCV,objectMapper,client,role);
}else if("QA".equals(type)){
resultText = sendMessage(promptText, "ft:gpt-3.5-turbo-0125:vetti:construction-labourer-test:CWKBNvE2",objectMapper,client,role);
} else {
resultText = sendMessage(promptText, model,objectMapper,client,role); resultText = sendMessage(promptText, model,objectMapper,client,role);
}
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
System.err.println("单轮对话出错: " + e.getMessage()); System.err.println("单轮对话出错: " + e.getMessage());
} }

View File

@@ -1,5 +1,6 @@
package com.vetti.common.utils.readText.vo; package com.vetti.common.utils.readText.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@@ -15,8 +16,13 @@ import java.util.List;
@Accessors(chain = true) @Accessors(chain = true)
public class PersonalInfo { public class PersonalInfo {
@ApiModelProperty("候选人姓名")
private String name; private String name;
@ApiModelProperty("候选人职位")
private String position;
@ApiModelProperty("工作年限")
private int experienceYears; private int experienceYears;
private List<String> certifications; private List<String> certifications;

View File

@@ -1,5 +1,6 @@
package com.vetti.common.utils.readText.vo; package com.vetti.common.utils.readText.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
@@ -15,11 +16,15 @@ import java.util.List;
@Accessors(chain = true) @Accessors(chain = true)
public class ResumeData { public class ResumeData {
@ApiModelProperty("候选人基础信息")
private PersonalInfo personalInfo; private PersonalInfo personalInfo;
@ApiModelProperty("候选人工作经验")
private List<WorkExperience> workExperience; private List<WorkExperience> workExperience;
@ApiModelProperty("候选人技能")
private List<String> skills; private List<String> skills;
@ApiModelProperty("候选人教育经历")
private List<Education> education; private List<Education> education;
} }

View File

@@ -66,4 +66,12 @@ public interface HotakeProblemBaseInfoMapper
*/ */
public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList); public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList);
/**
* 删除面试者问题库信息
*
* @param userId 面试者ID
* @return 结果
*/
public int deleteHotakeProblemBaseInfoByUserId(Long userId);
} }

View File

@@ -67,4 +67,12 @@ public interface IHotakeProblemBaseInfoService
*/ */
public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList); public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList);
/**
* 删除面试者问题库信息信息
*
* @param userId 面试者用户ID
* @return 结果
*/
public int deleteHotakeProblemBaseInfoByUserId(Long userId);
} }

View File

@@ -3,14 +3,22 @@ package com.vetti.hotake.service.impl;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.vetti.common.ai.gpt.ChatGPTClient;
import com.vetti.common.core.service.BaseServiceImpl; import com.vetti.common.core.service.BaseServiceImpl;
import com.vetti.common.enums.FillTypeEnum; import com.vetti.common.enums.FillTypeEnum;
import com.vetti.common.utils.DateUtils; import com.vetti.common.utils.DateUtils;
import com.vetti.common.utils.SecurityUtils;
import com.vetti.common.utils.readFile.FileContentUtil; import com.vetti.common.utils.readFile.FileContentUtil;
import com.vetti.common.utils.readText.ResumeTextExtractor; import com.vetti.common.utils.readText.ResumeTextExtractor;
import com.vetti.common.utils.readText.vo.ResumeData;
import com.vetti.hotake.domain.HotakeProblemBaseInfo;
import com.vetti.hotake.service.IHotakeProblemBaseInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -34,6 +42,14 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
@Autowired @Autowired
private HotakeCvInfoMapper hotakeCvInfoMapper; private HotakeCvInfoMapper hotakeCvInfoMapper;
@Autowired
private ChatGPTClient chatGPTClient;
@Autowired
private IHotakeProblemBaseInfoService hotakeProblemBaseInfoService;
/** /**
* 查询简历信息 * 查询简历信息
* *
@@ -73,7 +89,7 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
fill(FillTypeEnum.INSERT.getCode(),hotakeCvInfo); fill(FillTypeEnum.INSERT.getCode(),hotakeCvInfo);
hotakeCvInfoMapper.insertHotakeCvInfo(hotakeCvInfo); hotakeCvInfoMapper.insertHotakeCvInfo(hotakeCvInfo);
//对简历数据进行处理生成相应的题库数据 //对简历数据进行处理生成相应的题库数据
// handleHotakeCvInfo(hotakeCvInfo); handleHotakeCvInfo(hotakeCvInfo);
return hotakeCvInfo; return hotakeCvInfo;
} }
@@ -85,12 +101,49 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
@Override @Override
public HotakeCvInfo handleHotakeCvInfo(HotakeCvInfo hotakeCvInfo) { public HotakeCvInfo handleHotakeCvInfo(HotakeCvInfo hotakeCvInfo) {
try{ try{
InputStream inputStream = new FileInputStream("/Users/wangxiangshun/Desktop/管报数据/223/Abrar Mohammed Project Manager Resume.docx"); // InputStream inputStream = new FileInputStream("/Users/wangxiangshun/Desktop/管报数据/223/Abrar Mohammed Project Manager Resume.docx");
String contents = FileContentUtil.readFileContent(inputStream,hotakeCvInfo.getCvFileType()); // String contents = FileContentUtil.readFileContent(inputStream,hotakeCvInfo.getCvFileType());
//进行简历数据提取 // //进行简历数据提取
ResumeTextExtractor extractor = new ResumeTextExtractor(); // ResumeTextExtractor extractor = new ResumeTextExtractor();
extractor.extractResumeData(contents,""); // ResumeData resumeData = extractor.extractResumeData(contents,"");
log.info("返回简历基本内容:{}", JSONUtil.toJsonStr(extractor.extractResumeData(contents,""))); // log.info("返回简历基本内容:{}", resumeData);
//根据简历信息生成初始化问题集合
// messages: [
// {
// role: "system",
// content: "You are a construction industry HR expert. Evaluate resumes and provide a score (1-5) and brief recommendation for construction positions."
// },
// {
// role: "user",
// content: `Position: ${resume.position}\nCandidate: ${resume.candidate}\nExperience: ${resume.experience}\nSkills: ${resume.skills}\nEducation: ${resume.education}\nCertifications: ${resume.certifications}\nSummary: ${resume.summary}`
// }
// ]
//调用AI大模型
// List<Map<String,String>> list = new LinkedList();
// Map<String,String> mapEntity = new HashMap<>();
// mapEntity.put("role","system");
// mapEntity.put("content","You are a construction industry HR expert and experienced interviewer. Evaluate the resume and generate interview questions in one response. Use this exact format:\\n\\nEVALUATION:\\nScore: X/5\\nRecommendation: [recommendation]\\nStrengths: [strengths]\\nConcerns: [concerns]\\n\\nINTERVIEW QUESTIONS:\\nQuestion 1: [question]\\nCategory: [category]\\nReasoning: [reasoning]\\n\\nQuestion 2: [question]\\nCategory: [category]\\nReasoning: [reasoning]");
// list.add(mapEntity);
// Map<String,String> mapEntityOne = new HashMap<>();
// mapEntityOne.put("role","user");
// mapEntityOne.put("content","Position: Construction Labourer"+
// "\\nCandidate: "+resumeData.getPersonalInfo().getName()+
// "\\nExperience: "+resumeData.getPersonalInfo().getExperienceYears()+
// "\\nSkills: "+JSONUtil.toJsonStr(resumeData.getSkills())+
// "\\nEducation: "+JSONUtil.toJsonStr(resumeData.getEducation())+
// "\\nCertifications: "+JSONUtil.toJsonStr(resumeData.getPersonalInfo().getCertifications())+
// "\\nSummary: Experienced construction worker with strong safety record");
// list.add(mapEntityOne);
// String promptText = JSONUtil.toJsonStr(list);
// String resultMsg = chatGPTClient.handleAiChat(promptText,"CV");
// log.info("返回初始化问题:{}",resultMsg);
//生成预设问题记录
//先删除该用户的预设问题
hotakeProblemBaseInfoService.deleteHotakeProblemBaseInfoByUserId(SecurityUtils.getUserId());
HotakeProblemBaseInfo problemBaseInfo = new HotakeProblemBaseInfo();
problemBaseInfo.setUserId(SecurityUtils.getUserId());
problemBaseInfo.setContents("Can you provide an example of a situation where you had to work in a physically demanding environment?,How do you plan to handle tasks that require specific construction knowledge or skills that you may not have yet?");
hotakeProblemBaseInfoService.insertHotakeProblemBaseInfo(problemBaseInfo);
}catch (Exception e) { }catch (Exception e) {
} }

View File

@@ -3,6 +3,7 @@ package com.vetti.hotake.service.impl;
import java.util.List; import java.util.List;
import com.vetti.common.core.service.BaseServiceImpl; import com.vetti.common.core.service.BaseServiceImpl;
import com.vetti.common.enums.FillTypeEnum;
import com.vetti.common.utils.DateUtils; import com.vetti.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -61,7 +62,7 @@ public class HotakeProblemBaseInfoServiceImpl extends BaseServiceImpl implements
@Override @Override
public int insertHotakeProblemBaseInfo(HotakeProblemBaseInfo hotakeProblemBaseInfo) public int insertHotakeProblemBaseInfo(HotakeProblemBaseInfo hotakeProblemBaseInfo)
{ {
hotakeProblemBaseInfo.setCreateTime(DateUtils.getNowDate()); fill(FillTypeEnum.INSERT.getCode(), hotakeProblemBaseInfo);
return hotakeProblemBaseInfoMapper.insertHotakeProblemBaseInfo(hotakeProblemBaseInfo); return hotakeProblemBaseInfoMapper.insertHotakeProblemBaseInfo(hotakeProblemBaseInfo);
} }
@@ -115,4 +116,15 @@ public class HotakeProblemBaseInfoServiceImpl extends BaseServiceImpl implements
public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList){ public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList){
return hotakeProblemBaseInfoMapper.batchInsertHotakeProblemBaseInfo(hotakeProblemBaseInfoList); return hotakeProblemBaseInfoMapper.batchInsertHotakeProblemBaseInfo(hotakeProblemBaseInfoList);
} }
/**
* 删除面试者问题库信息信息
* @param userId 面试者用户ID
* @return
*/
@Override
public int deleteHotakeProblemBaseInfoByUserId(Long userId) {
return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoByUserId(userId);
}
} }

View File

@@ -81,6 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from hotake_problem_base_info where id = #{id} delete from hotake_problem_base_info where id = #{id}
</delete> </delete>
<delete id="deleteHotakeProblemBaseInfoByUserId" parameterType="Long">
delete from hotake_problem_base_info where user_id = #{userId}
</delete>
<delete id="deleteHotakeProblemBaseInfoByIds" parameterType="String"> <delete id="deleteHotakeProblemBaseInfoByIds" parameterType="String">
delete from hotake_problem_base_info where id in delete from hotake_problem_base_info where id in
<foreach item="id" collection="array" open="(" separator="," close=")"> <foreach item="id" collection="array" open="(" separator="," close=")">

View File

@@ -1,17 +1,17 @@
com/vetti/hotake/mapper/HotakeCvInfoMapper.class com/vetti/hotake/mapper/HotakeCvInfoMapper.class
com/vetti/hotake/service/impl/HotakeSysNoticeServiceImpl.class
com/vetti/hotake/domain/dto/HotakeSysNoticeTypeNameDto.class
com/vetti/hotake/domain/vo/HotakeSysFileVo.class
com/vetti/hotake/service/impl/HotakeSysFileServiceImpl.class com/vetti/hotake/service/impl/HotakeSysFileServiceImpl.class
com/vetti/hotake/domain/HotakeSysFile.class
com/vetti/hotake/domain/dto/HotakeSysNoticeViewDto.class
com/vetti/hotake/domain/dto/HotakeSysFileDto.class com/vetti/hotake/domain/dto/HotakeSysFileDto.class
com/vetti/hotake/service/IHotakeSysNoticeService.class com/vetti/hotake/service/IHotakeSysNoticeService.class
com/vetti/hotake/domain/HotakeSysNotice.class
com/vetti/hotake/domain/dto/HotakeSysNoticeDto.class com/vetti/hotake/domain/dto/HotakeSysNoticeDto.class
com/vetti/hotake/mapper/HotakeSysFileMapper.class com/vetti/hotake/mapper/HotakeSysFileMapper.class
com/vetti/hotake/mapper/HotakeSysNoticeMapper.class com/vetti/hotake/mapper/HotakeSysNoticeMapper.class
com/vetti/hotake/domain/HotakeCvInfo.class com/vetti/hotake/domain/HotakeCvInfo.class
com/vetti/hotake/service/impl/HotakeSysNoticeServiceImpl.class
com/vetti/hotake/domain/dto/HotakeSysNoticeTypeNameDto.class
com/vetti/hotake/domain/vo/HotakeSysFileVo.class
com/vetti/hotake/domain/HotakeSysFile.class
com/vetti/hotake/domain/dto/HotakeSysNoticeViewDto.class
com/vetti/hotake/domain/HotakeSysNotice.class
com/vetti/hotake/service/IHotakeSysFileService.class com/vetti/hotake/service/IHotakeSysFileService.class
com/vetti/hotake/service/impl/HotakeCvInfoServiceImpl.class com/vetti/hotake/service/impl/HotakeCvInfoServiceImpl.class
com/vetti/hotake/service/IHotakeCvInfoService.class com/vetti/hotake/service/IHotakeCvInfoService.class