TASK:LLM;
This commit is contained in:
@@ -101,7 +101,7 @@ public class LLMServiceImpl implements LLMService {
|
||||
jsonBodyObject.put("message", prompt);
|
||||
jsonBodyObject.put("enable_thinking", enableThinking);
|
||||
jsonBodyObject.put("process", !StringUtils.isEmpty(process) ? process : "");
|
||||
jsonBodyObject.put("is_create_project", !StringUtils.isEmpty(process));
|
||||
jsonBodyObject.put("is_create_project", false);
|
||||
|
||||
// 1. 存储用户输入
|
||||
ChatMessage userMessage = new ChatMessage();
|
||||
@@ -188,113 +188,103 @@ public class LLMServiceImpl implements LLMService {
|
||||
systemImage.setAccountId(accountId);
|
||||
chatMessageMapper.insert(systemImage);
|
||||
}
|
||||
if (status.equals("[PROJECT_CREATE_SIGNAL]")) {
|
||||
JSONObject data = toolsData;
|
||||
Project project = projectMapper.selectById(projectId);
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
project.setUpdateTime(now);
|
||||
project.setAccountId(accountId);
|
||||
project.setName(data.getString("project_name"));
|
||||
project.setOriginal(1);
|
||||
// String process = data.getString("process");
|
||||
// if (StringUtils.isEmpty(process)) {
|
||||
// project.setProcess(DesignProcess.SERIES_DESIGN.name());
|
||||
// if (status.equals("[PROJECT_CREATE_SIGNAL]")) {
|
||||
// JSONObject data = toolsData;
|
||||
// Project project = projectMapper.selectById(projectId);
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// project.setUpdateTime(now);
|
||||
// project.setAccountId(accountId);
|
||||
// project.setName(data.getString("project_name"));
|
||||
// project.setOriginal(1);
|
||||
// project.setProcess(process);
|
||||
// projectMapper.updateById(project);
|
||||
//
|
||||
// Workspace workspace = new Workspace();
|
||||
// workspace.setAccountId(accountId);
|
||||
// workspace.setCreateTime(now);
|
||||
// String ageGroup = data.getString("ageGroup");
|
||||
// if (StringUtils.isEmpty(ageGroup)) {
|
||||
// workspace.setAgeGroup("Adult");
|
||||
// }else {
|
||||
// if (DesignProcess.isValidName(process)) {
|
||||
// project.setProcess(process);
|
||||
// if (AgeGroup.isValidName(process)) {
|
||||
// workspace.setAgeGroup(ageGroup);
|
||||
// }else {
|
||||
// project.setProcess(DesignProcess.SERIES_DESIGN.name());
|
||||
// workspace.setAgeGroup("Adult");
|
||||
// }
|
||||
// }
|
||||
project.setProcess(process);
|
||||
projectMapper.updateById(project);
|
||||
|
||||
Workspace workspace = new Workspace();
|
||||
workspace.setAccountId(accountId);
|
||||
workspace.setCreateTime(now);
|
||||
String ageGroup = data.getString("ageGroup");
|
||||
if (StringUtils.isEmpty(ageGroup)) {
|
||||
workspace.setAgeGroup("Adult");
|
||||
}else {
|
||||
if (AgeGroup.isValidName(process)) {
|
||||
workspace.setAgeGroup(ageGroup);
|
||||
}else {
|
||||
workspace.setAgeGroup("Adult");
|
||||
}
|
||||
}
|
||||
String gender = data.getString("gender");
|
||||
if (StringUtils.isEmpty(gender)) {
|
||||
workspace.setSex("Female");
|
||||
}else {
|
||||
if (Sex.isValidName(gender)) {
|
||||
workspace.setSex(gender);
|
||||
}else {
|
||||
workspace.setSex("Female");
|
||||
}
|
||||
}
|
||||
String position = data.getString("position");
|
||||
if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
|
||||
workspace.setPosition("Overall");
|
||||
}else {
|
||||
if (StringUtils.isEmpty(position)) {
|
||||
if (workspace.getSex().equals("Female")) {
|
||||
workspace.setPosition(Position.BLOUSE.getValue());
|
||||
}else {
|
||||
workspace.setPosition(Position.TOPS.getValue());
|
||||
}
|
||||
}else {
|
||||
if (Position.isValidName(position)) {
|
||||
workspace.setPosition(position);
|
||||
}else {
|
||||
if (workspace.getSex().equals("Female")) {
|
||||
workspace.setPosition(Position.BLOUSE.getValue());
|
||||
}else {
|
||||
workspace.setPosition(Position.TOPS.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
workspace.setSystemDesignerPercentage(30);
|
||||
workspace.setProjectId(project.getId());
|
||||
workspace.setAccountId(accountId);
|
||||
String style = data.getString("style");
|
||||
String styleName = null;
|
||||
if (StringUtils.isEmpty(style)) {
|
||||
styleName = StyleEnum.NEW_CHINESE.name();
|
||||
}else {
|
||||
if (StyleEnum.isValidName(style)) {
|
||||
styleName = style;
|
||||
}else {
|
||||
styleName = StyleEnum.NEW_CHINESE.name();
|
||||
}
|
||||
}
|
||||
|
||||
SysFile sysFile = sysFileService.getOneBySex(styleName, workspace.getSex(), workspace.getAgeGroup());
|
||||
|
||||
if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
|
||||
workspace.setMannequinFemaleId(sysFile.getId());
|
||||
workspace.setMannequinFemaleType("System");
|
||||
}else {
|
||||
workspace.setMannequinMaleId(sysFile.getId());
|
||||
workspace.setMannequinMaleType("System");
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
// String gender = data.getString("gender");
|
||||
// if (StringUtils.isEmpty(gender)) {
|
||||
// workspace.setSex("Female");
|
||||
// }else {
|
||||
// if (Sex.isValidName(gender)) {
|
||||
// workspace.setSex(gender);
|
||||
// }else {
|
||||
// workspace.setSex("Female");
|
||||
// }
|
||||
// }
|
||||
// String position = data.getString("position");
|
||||
// if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
|
||||
// workspace.setPosition("Overall");
|
||||
// }else {
|
||||
// if (StringUtils.isEmpty(position)) {
|
||||
// if (workspace.getSex().equals("Female")) {
|
||||
// workspace.setPosition(Position.BLOUSE.getValue());
|
||||
// }else {
|
||||
// workspace.setPosition(Position.TOPS.getValue());
|
||||
// }
|
||||
// }else {
|
||||
// if (Position.isValidName(position)) {
|
||||
// workspace.setPosition(position);
|
||||
// }else {
|
||||
// if (workspace.getSex().equals("Female")) {
|
||||
// workspace.setPosition(Position.BLOUSE.getValue());
|
||||
// }else {
|
||||
// workspace.setPosition(Position.TOPS.getValue());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// workspace.setSystemDesignerPercentage(30);
|
||||
// workspace.setProjectId(project.getId());
|
||||
// workspace.setAccountId(accountId);
|
||||
// String style = data.getString("style");
|
||||
// String styleName = null;
|
||||
// if (StringUtils.isEmpty(style)) {
|
||||
// styleName = StyleEnum.NEW_CHINESE.name();
|
||||
// }else {
|
||||
// if (StyleEnum.isValidName(style)) {
|
||||
// styleName = style;
|
||||
// }else {
|
||||
// styleName = StyleEnum.NEW_CHINESE.name();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// SysFile sysFile = sysFileService.getOneBySex(styleName, workspace.getSex(), workspace.getAgeGroup());
|
||||
//
|
||||
// if (workspace.getSex().equals(Sex.FEMALE.getValue())) {
|
||||
// workspace.setMannequinFemaleId(sysFile.getId());
|
||||
// workspace.setMannequinFemaleType("System");
|
||||
// }else {
|
||||
// workspace.setMannequinMaleId(sysFile.getId());
|
||||
// workspace.setMannequinMaleType("System");
|
||||
// }
|
||||
//
|
||||
// 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());
|
||||
}
|
||||
}
|
||||
@@ -368,13 +358,25 @@ public class LLMServiceImpl implements LLMService {
|
||||
}
|
||||
}
|
||||
String position = data.getString("position");
|
||||
if (StringUtils.isEmpty(position)) {
|
||||
if (process.equals(DesignProcess.SERIES_DESIGN.name())) {
|
||||
workspace.setPosition("Overall");
|
||||
}else {
|
||||
if (Position.isValidName(position)) {
|
||||
workspace.setPosition(position);
|
||||
if (StringUtils.isEmpty(position)) {
|
||||
if (workspace.getSex().equals("Female")) {
|
||||
workspace.setPosition(Position.BLOUSE.getValue());
|
||||
}else {
|
||||
workspace.setPosition(Position.TOPS.getValue());
|
||||
}
|
||||
}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);
|
||||
|
||||
Reference in New Issue
Block a user