TASK:LLM;

This commit is contained in:
shahaibo
2025-05-22 13:43:50 +08:00
parent af1c839495
commit 91ee58db1b

View File

@@ -101,7 +101,7 @@ public class LLMServiceImpl implements LLMService {
jsonBodyObject.put("message", prompt); jsonBodyObject.put("message", prompt);
jsonBodyObject.put("enable_thinking", enableThinking); jsonBodyObject.put("enable_thinking", enableThinking);
jsonBodyObject.put("process", !StringUtils.isEmpty(process) ? process : ""); jsonBodyObject.put("process", !StringUtils.isEmpty(process) ? process : "");
jsonBodyObject.put("is_create_project", !StringUtils.isEmpty(process)); jsonBodyObject.put("is_create_project", false);
// 1. 存储用户输入 // 1. 存储用户输入
ChatMessage userMessage = new ChatMessage(); ChatMessage userMessage = new ChatMessage();
@@ -188,113 +188,103 @@ public class LLMServiceImpl implements LLMService {
systemImage.setAccountId(accountId); systemImage.setAccountId(accountId);
chatMessageMapper.insert(systemImage); chatMessageMapper.insert(systemImage);
} }
if (status.equals("[PROJECT_CREATE_SIGNAL]")) { // if (status.equals("[PROJECT_CREATE_SIGNAL]")) {
JSONObject data = toolsData; // JSONObject data = toolsData;
Project project = projectMapper.selectById(projectId); // Project project = projectMapper.selectById(projectId);
LocalDateTime now = LocalDateTime.now(); // LocalDateTime now = LocalDateTime.now();
project.setUpdateTime(now); // project.setUpdateTime(now);
project.setAccountId(accountId); // project.setAccountId(accountId);
project.setName(data.getString("project_name")); // project.setName(data.getString("project_name"));
project.setOriginal(1); // project.setOriginal(1);
// String process = data.getString("process"); // project.setProcess(process);
// if (StringUtils.isEmpty(process)) { // projectMapper.updateById(project);
// project.setProcess(DesignProcess.SERIES_DESIGN.name()); //
// Workspace workspace = new Workspace();
// workspace.setAccountId(accountId);
// workspace.setCreateTime(now);
// String ageGroup = data.getString("ageGroup");
// if (StringUtils.isEmpty(ageGroup)) {
// workspace.setAgeGroup("Adult");
// }else { // }else {
// if (DesignProcess.isValidName(process)) { // if (AgeGroup.isValidName(process)) {
// project.setProcess(process); // workspace.setAgeGroup(ageGroup);
// }else { // }else {
// project.setProcess(DesignProcess.SERIES_DESIGN.name()); // workspace.setAgeGroup("Adult");
// } // }
// } // }
project.setProcess(process); // String gender = data.getString("gender");
projectMapper.updateById(project); // if (StringUtils.isEmpty(gender)) {
// workspace.setSex("Female");
Workspace workspace = new Workspace(); // }else {
workspace.setAccountId(accountId); // if (Sex.isValidName(gender)) {
workspace.setCreateTime(now); // workspace.setSex(gender);
String ageGroup = data.getString("ageGroup"); // }else {
if (StringUtils.isEmpty(ageGroup)) { // workspace.setSex("Female");
workspace.setAgeGroup("Adult"); // }
}else { // }
if (AgeGroup.isValidName(process)) { // String position = data.getString("position");
workspace.setAgeGroup(ageGroup); // if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
}else { // workspace.setPosition("Overall");
workspace.setAgeGroup("Adult"); // }else {
} // if (StringUtils.isEmpty(position)) {
} // if (workspace.getSex().equals("Female")) {
String gender = data.getString("gender"); // workspace.setPosition(Position.BLOUSE.getValue());
if (StringUtils.isEmpty(gender)) { // }else {
workspace.setSex("Female"); // workspace.setPosition(Position.TOPS.getValue());
}else { // }
if (Sex.isValidName(gender)) { // }else {
workspace.setSex(gender); // if (Position.isValidName(position)) {
}else { // workspace.setPosition(position);
workspace.setSex("Female"); // }else {
} // if (workspace.getSex().equals("Female")) {
} // workspace.setPosition(Position.BLOUSE.getValue());
String position = data.getString("position"); // }else {
if (process.equals(DesignProcess.SERIES_DESIGN.name())) { // workspace.setPosition(Position.TOPS.getValue());
workspace.setPosition("Overall"); // }
}else { // }
if (StringUtils.isEmpty(position)) { // }
if (workspace.getSex().equals("Female")) { // }
workspace.setPosition(Position.BLOUSE.getValue()); // workspace.setSystemDesignerPercentage(30);
}else { // workspace.setProjectId(project.getId());
workspace.setPosition(Position.TOPS.getValue()); // workspace.setAccountId(accountId);
} // String style = data.getString("style");
}else { // String styleName = null;
if (Position.isValidName(position)) { // if (StringUtils.isEmpty(style)) {
workspace.setPosition(position); // styleName = StyleEnum.NEW_CHINESE.name();
}else { // }else {
if (workspace.getSex().equals("Female")) { // if (StyleEnum.isValidName(style)) {
workspace.setPosition(Position.BLOUSE.getValue()); // styleName = style;
}else { // }else {
workspace.setPosition(Position.TOPS.getValue()); // styleName = StyleEnum.NEW_CHINESE.name();
} // }
} // }
} //
} // SysFile sysFile = sysFileService.getOneBySex(styleName, workspace.getSex(), workspace.getAgeGroup());
workspace.setSystemDesignerPercentage(30); //
workspace.setProjectId(project.getId()); // if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
workspace.setAccountId(accountId); // workspace.setMannequinFemaleId(sysFile.getId());
String style = data.getString("style"); // workspace.setMannequinFemaleType("System");
String styleName = null; // }else {
if (StringUtils.isEmpty(style)) { // workspace.setMannequinMaleId(sysFile.getId());
styleName = StyleEnum.NEW_CHINESE.name(); // workspace.setMannequinMaleType("System");
}else { // }
if (StyleEnum.isValidName(style)) { //
styleName = style; // workspaceMapper.insert(workspace);
}else { //
styleName = StyleEnum.NEW_CHINESE.name(); // if (!StringUtils.isEmpty(styleName)) {
} // QueryWrapper<Style> qw = new QueryWrapper<>();
} // qw.lambda().eq(Style::getName, styleName);
// Style style1 = styleMapper.selectOne(qw);
SysFile sysFile = sysFileService.getOneBySex(styleName, workspace.getSex(), workspace.getAgeGroup()); // if (Objects.nonNull(style1)) {
// WorkspaceRelStyle rel = new WorkspaceRelStyle();
if (workspace.getSex().equals(Sex.FEMALE.getValue())) { // rel.setWorkspaceId(workspace.getId());
workspace.setMannequinFemaleId(sysFile.getId()); // rel.setStyleId(style1.getId());
workspace.setMannequinFemaleType("System"); // workspaceRelStyleMapper.insert(rel);
}else { // }
workspace.setMannequinMaleId(sysFile.getId()); // }
workspace.setMannequinMaleType("System"); // toolsData.put("projectId", projectId);
} // json.put("tools_data", toolsData.toJSONString());
// }
workspaceMapper.insert(workspace);
if (!StringUtils.isEmpty(styleName)) {
QueryWrapper<Style> qw = new QueryWrapper<>();
qw.lambda().eq(Style::getName, styleName);
Style style1 = styleMapper.selectOne(qw);
if (Objects.nonNull(style1)) {
WorkspaceRelStyle rel = new WorkspaceRelStyle();
rel.setWorkspaceId(workspace.getId());
rel.setStyleId(style1.getId());
workspaceRelStyleMapper.insert(rel);
}
}
toolsData.put("projectId", projectId);
json.put("tools_data", toolsData.toJSONString());
}
emitter.send(json.toJSONString()); emitter.send(json.toJSONString());
} }
} }
@@ -368,13 +358,25 @@ public class LLMServiceImpl implements LLMService {
} }
} }
String position = data.getString("position"); String position = data.getString("position");
if (StringUtils.isEmpty(position)) { if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
workspace.setPosition("Overall"); workspace.setPosition("Overall");
}else { }else {
if (Position.isValidName(position)) { if (StringUtils.isEmpty(position)) {
workspace.setPosition(position); if (workspace.getSex().equals("Female")) {
workspace.setPosition(Position.BLOUSE.getValue());
}else {
workspace.setPosition(Position.TOPS.getValue());
}
}else { }else {
workspace.setPosition("Overall"); if (Position.isValidName(position) && !position.equals(Position.OVERALL.getValue())) {
workspace.setPosition(position);
}else {
if (workspace.getSex().equals("Female")) {
workspace.setPosition(Position.BLOUSE.getValue());
}else {
workspace.setPosition(Position.TOPS.getValue());
}
}
} }
} }
workspace.setSystemDesignerPercentage(30); workspace.setSystemDesignerPercentage(30);