简历读取基础逻辑添加以及用户语音配置信息字段添加
This commit is contained in:
@@ -179,7 +179,7 @@ public class ChatWebSocketHandler {
|
||||
}
|
||||
Map<String,String> mapEntity = new HashMap<>();
|
||||
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.add(mapEntity);
|
||||
promptJson = JSONUtil.toJsonStr(list);
|
||||
@@ -313,7 +313,7 @@ public class ChatWebSocketHandler {
|
||||
}
|
||||
log.info("结束AI提示词为:{}",promptJson);
|
||||
ChatGPTClient gptClient = SpringUtils.getBean(ChatGPTClient.class);
|
||||
String resultMsg = gptClient.handleAiChat(promptJson);
|
||||
String resultMsg = gptClient.handleAiChat(promptJson,"QA");
|
||||
Map<String, String> resultEntity = new HashMap<>();
|
||||
resultEntity.put("msg", resultMsg);
|
||||
resultEntity.put("dataType","score");
|
||||
|
||||
@@ -59,7 +59,7 @@ public class AiCommonController extends BaseController
|
||||
@GetMapping("/handleAiChat")
|
||||
public AjaxResult handleAiChat(@RequestParam String text)
|
||||
{
|
||||
String resultMsg = chatGPTClient.handleAiChat(text);
|
||||
String resultMsg = chatGPTClient.handleAiChat(text,"QA");
|
||||
return AjaxResult.success(resultMsg);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ public class SysProfileController extends BaseController
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@ApiOperation("个人信息完善")
|
||||
@ApiOperation("个人信息完善(按照步骤完善信息)")
|
||||
@Log(title = "个人信息完善", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/completeInfo")
|
||||
public R personalInfoProfile(@RequestBody SysUser user)
|
||||
@@ -107,12 +107,25 @@ public class SysProfileController extends BaseController
|
||||
currentUser.setSteps(user.getSteps());
|
||||
if (userService.updateUserProfile(currentUser) > 0)
|
||||
{
|
||||
loginUser.setUser(currentUser);
|
||||
// 更新缓存用户信息
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 个人信息修改
|
||||
*/
|
||||
@ApiOperation("个人信息修改")
|
||||
@Log(title = "个人信息修改", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePersonalInfo")
|
||||
public R updatePersonalInfoProfile(@RequestBody SysUser user)
|
||||
{
|
||||
userService.updateUserProfile(user);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
|
||||
@@ -169,7 +169,8 @@ whisper:
|
||||
chatGpt:
|
||||
apiKey: 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
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -169,7 +169,8 @@ whisper:
|
||||
chatGpt:
|
||||
apiKey: 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
|
||||
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
|
||||
|
||||
|
||||
|
||||
@@ -33,6 +33,9 @@ public class ChatGPTClient {
|
||||
@Value("${chatGpt.model}")
|
||||
private String model;
|
||||
|
||||
@Value("${chatGpt.modelCV}")
|
||||
private String modelCV;
|
||||
|
||||
@Value("${chatGpt.role}")
|
||||
private String role;
|
||||
|
||||
@@ -42,7 +45,7 @@ public class ChatGPTClient {
|
||||
* @param promptText 文字提示信息
|
||||
* @return
|
||||
*/
|
||||
public String handleAiChat(String promptText) {
|
||||
public String handleAiChat(String promptText,String type) {
|
||||
String resultText = "";
|
||||
// 创建ChatGPT客户端
|
||||
// HTTP客户端
|
||||
@@ -54,7 +57,14 @@ public class ChatGPTClient {
|
||||
ObjectMapper objectMapper = new ObjectMapper();;
|
||||
// 单轮对话返回结果
|
||||
try {
|
||||
resultText = sendMessage(promptText, model,objectMapper,client,role);
|
||||
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);
|
||||
}
|
||||
|
||||
} catch (IOException | InterruptedException e) {
|
||||
System.err.println("单轮对话出错: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.vetti.common.utils.readText.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -15,8 +16,13 @@ import java.util.List;
|
||||
@Accessors(chain = true)
|
||||
public class PersonalInfo {
|
||||
|
||||
@ApiModelProperty("候选人姓名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("候选人职位")
|
||||
private String position;
|
||||
|
||||
@ApiModelProperty("工作年限")
|
||||
private int experienceYears;
|
||||
|
||||
private List<String> certifications;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.vetti.common.utils.readText.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -15,11 +16,15 @@ import java.util.List;
|
||||
@Accessors(chain = true)
|
||||
public class ResumeData {
|
||||
|
||||
@ApiModelProperty("候选人基础信息")
|
||||
private PersonalInfo personalInfo;
|
||||
|
||||
@ApiModelProperty("候选人工作经验")
|
||||
private List<WorkExperience> workExperience;
|
||||
|
||||
@ApiModelProperty("候选人技能")
|
||||
private List<String> skills;
|
||||
|
||||
@ApiModelProperty("候选人教育经历")
|
||||
private List<Education> education;
|
||||
}
|
||||
|
||||
@@ -66,4 +66,12 @@ public interface HotakeProblemBaseInfoMapper
|
||||
*/
|
||||
public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList);
|
||||
|
||||
/**
|
||||
* 删除面试者问题库信息
|
||||
*
|
||||
* @param userId 面试者ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHotakeProblemBaseInfoByUserId(Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -67,4 +67,12 @@ public interface IHotakeProblemBaseInfoService
|
||||
*/
|
||||
public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList);
|
||||
|
||||
/**
|
||||
* 删除面试者问题库信息信息
|
||||
*
|
||||
* @param userId 面试者用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteHotakeProblemBaseInfoByUserId(Long userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,14 +3,22 @@ package com.vetti.hotake.service.impl;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.vetti.common.ai.gpt.ChatGPTClient;
|
||||
import com.vetti.common.core.service.BaseServiceImpl;
|
||||
import com.vetti.common.enums.FillTypeEnum;
|
||||
import com.vetti.common.utils.DateUtils;
|
||||
import com.vetti.common.utils.SecurityUtils;
|
||||
import com.vetti.common.utils.readFile.FileContentUtil;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -34,6 +42,14 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
||||
@Autowired
|
||||
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);
|
||||
hotakeCvInfoMapper.insertHotakeCvInfo(hotakeCvInfo);
|
||||
//对简历数据进行处理生成相应的题库数据
|
||||
// handleHotakeCvInfo(hotakeCvInfo);
|
||||
handleHotakeCvInfo(hotakeCvInfo);
|
||||
return hotakeCvInfo;
|
||||
}
|
||||
|
||||
@@ -85,12 +101,49 @@ public class HotakeCvInfoServiceImpl extends BaseServiceImpl implements IHotakeC
|
||||
@Override
|
||||
public HotakeCvInfo handleHotakeCvInfo(HotakeCvInfo hotakeCvInfo) {
|
||||
try{
|
||||
InputStream inputStream = new FileInputStream("/Users/wangxiangshun/Desktop/管报数据/223/Abrar Mohammed Project Manager Resume.docx");
|
||||
String contents = FileContentUtil.readFileContent(inputStream,hotakeCvInfo.getCvFileType());
|
||||
//进行简历数据提取
|
||||
ResumeTextExtractor extractor = new ResumeTextExtractor();
|
||||
extractor.extractResumeData(contents,"");
|
||||
log.info("返回简历基本内容:{}", JSONUtil.toJsonStr(extractor.extractResumeData(contents,"")));
|
||||
// InputStream inputStream = new FileInputStream("/Users/wangxiangshun/Desktop/管报数据/223/Abrar Mohammed Project Manager Resume.docx");
|
||||
// String contents = FileContentUtil.readFileContent(inputStream,hotakeCvInfo.getCvFileType());
|
||||
// //进行简历数据提取
|
||||
// ResumeTextExtractor extractor = new ResumeTextExtractor();
|
||||
// ResumeData resumeData = 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) {
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.vetti.hotake.service.impl;
|
||||
import java.util.List;
|
||||
|
||||
import com.vetti.common.core.service.BaseServiceImpl;
|
||||
import com.vetti.common.enums.FillTypeEnum;
|
||||
import com.vetti.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -61,7 +62,7 @@ public class HotakeProblemBaseInfoServiceImpl extends BaseServiceImpl implements
|
||||
@Override
|
||||
public int insertHotakeProblemBaseInfo(HotakeProblemBaseInfo hotakeProblemBaseInfo)
|
||||
{
|
||||
hotakeProblemBaseInfo.setCreateTime(DateUtils.getNowDate());
|
||||
fill(FillTypeEnum.INSERT.getCode(), hotakeProblemBaseInfo);
|
||||
return hotakeProblemBaseInfoMapper.insertHotakeProblemBaseInfo(hotakeProblemBaseInfo);
|
||||
}
|
||||
|
||||
@@ -115,4 +116,15 @@ public class HotakeProblemBaseInfoServiceImpl extends BaseServiceImpl implements
|
||||
public int batchInsertHotakeProblemBaseInfo(List<HotakeProblemBaseInfo> hotakeProblemBaseInfoList){
|
||||
return hotakeProblemBaseInfoMapper.batchInsertHotakeProblemBaseInfo(hotakeProblemBaseInfoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除面试者问题库信息信息
|
||||
* @param userId 面试者用户ID
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int deleteHotakeProblemBaseInfoByUserId(Long userId) {
|
||||
|
||||
return hotakeProblemBaseInfoMapper.deleteHotakeProblemBaseInfoByUserId(userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
delete from hotake_problem_base_info where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHotakeProblemBaseInfoByUserId" parameterType="Long">
|
||||
delete from hotake_problem_base_info where user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHotakeProblemBaseInfoByIds" parameterType="String">
|
||||
delete from hotake_problem_base_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
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/domain/HotakeSysFile.class
|
||||
com/vetti/hotake/domain/dto/HotakeSysNoticeViewDto.class
|
||||
com/vetti/hotake/domain/dto/HotakeSysFileDto.class
|
||||
com/vetti/hotake/service/IHotakeSysNoticeService.class
|
||||
com/vetti/hotake/domain/HotakeSysNotice.class
|
||||
com/vetti/hotake/domain/dto/HotakeSysNoticeDto.class
|
||||
com/vetti/hotake/mapper/HotakeSysFileMapper.class
|
||||
com/vetti/hotake/mapper/HotakeSysNoticeMapper.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/impl/HotakeCvInfoServiceImpl.class
|
||||
com/vetti/hotake/service/IHotakeCvInfoService.class
|
||||
|
||||
Reference in New Issue
Block a user