|
|
|
|
@@ -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) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|