AI 生成器逻辑完善

This commit is contained in:
2026-01-09 16:50:28 +08:00
parent 82fbe521fe
commit 009d839dce
13 changed files with 587 additions and 31 deletions

View File

@@ -674,7 +674,7 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
mapUserEntity.put("content",userPrompt);
list.add(mapUserEntity);
String promptJson = JSONUtil.toJsonStr(list);
String resultStr = chatGPTClient.handleAiChat(promptJson,"WEBAITQ");
String resultStr = chatGPTClient.handleAiChat(promptJson,"PPG");
String resultJson = resultStr.replaceAll("```json","").replaceAll("```","");
log.info("个人简介生成器:{}",resultJson);
@@ -686,5 +686,98 @@ public class HotakeAiCommonToolsServiceImpl extends BaseServiceImpl implements I
return generatorDto;
}
/**
* 工作经验生成器
* @param workExperienceGeneratorVo 工作信息
* @return
*/
@Override
public HotakeWorkExperienceGeneratorDto getWorkExperienceGenerator(HotakeWorkExperienceGeneratorVo workExperienceGeneratorVo) {
String prompt = AiCommonPromptConstants.initializationWorkExperienceGeneratorPrompt();
String candidateText = " Job Title: "+workExperienceGeneratorVo.getTitle()+" Company Name: "+workExperienceGeneratorVo.getCompany()+" Work Period: "+workExperienceGeneratorVo.getDurationStart()+"-"+workExperienceGeneratorVo.getDurationEnd()
+"Additional Info: ";
String userPrompt = "Please generate a professional work experience description based on the following information:\\n\\n"+candidateText;
List<Map<String, String>> list = new LinkedList();
Map<String, String> mapEntity = new HashMap<>();
mapEntity.put("role", "system");
mapEntity.put("content",prompt);
list.add(mapEntity);
Map<String, String> mapUserEntity = new HashMap<>();
mapUserEntity.put("role", "user");
mapUserEntity.put("content",userPrompt);
list.add(mapUserEntity);
String promptJson = JSONUtil.toJsonStr(list);
String resultStr = chatGPTClient.handleAiChat(promptJson,"PPG");
String resultJson = resultStr.replaceAll("```json","").replaceAll("```","");
log.info("工作经验生成器:{}",resultJson);
Map dataMap = JSONUtil.toBean(resultJson,Map.class);
HotakeWorkExperienceGeneratorDto generatorDto = new HotakeWorkExperienceGeneratorDto();
List<VcExperienceDescriptionDto> description = new ArrayList<>();
Map workExperienceMap = (Map)dataMap.get("work_experience");
VcExperienceDescriptionDto descriptionDto = new VcExperienceDescriptionDto();
descriptionDto.setContent(workExperienceMap.get("position_summary").toString());
description.add(descriptionDto);
List<String> keyResponsibilitiesList = (List<String>)workExperienceMap.get("key_responsibilities");
if(CollectionUtil.isNotEmpty(keyResponsibilitiesList)){
for (String Str : keyResponsibilitiesList){
VcExperienceDescriptionDto descriptionDto1 = new VcExperienceDescriptionDto();
descriptionDto1.setContent(Str);
description.add(descriptionDto1);
}
}
generatorDto.setDescription(description);
return generatorDto;
}
/**
* 招聘链接信息分析补全
* @param roleLinkAnalysisVo 岗位链接对象
* @return
*/
@Override
public String getRoleLinkAnalysis(HotakeRoleLinkAnalysisVo roleLinkAnalysisVo) {
//获取
String webContent = handleWebContentScraping(roleLinkAnalysisVo.getRoleUrl());
String prompt = AiCommonPromptConstants.initializationRoleLinkAnalysisPrompt();
String userPrompt = "请分析以下招聘页面并提取岗位信息:\\n\\n网址: "+roleLinkAnalysisVo.getRoleUrl()+"\\n\\n内容:\\n" +webContent;
List<Map<String, String>> list = new LinkedList();
Map<String, String> mapEntity = new HashMap<>();
mapEntity.put("role", "system");
mapEntity.put("content",prompt);
list.add(mapEntity);
Map<String, String> mapUserEntity = new HashMap<>();
mapUserEntity.put("role", "user");
mapUserEntity.put("content",userPrompt);
list.add(mapUserEntity);
String promptJson = JSONUtil.toJsonStr(list);
String resultStr = chatGPTClient.handleAiChat(promptJson,"RLINKAL");
String resultJson = resultStr.replaceAll("```json","").replaceAll("```","");
log.info("招聘链接信息提取:{}",resultJson);
//处理岗位信息补充
String userPrompt_1 = "请根据以下提取的岗位信息生成完整的API格式数据\\n\\n" +resultJson;
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,"RLINKAL");
String resultJsonOne = resultStrOne.replaceAll("```json","").replaceAll("```","");
log.info("招聘链接信息补全:{}",resultJsonOne);
return resultJsonOne;
}
}