TASK:机器人添加查询男装

This commit is contained in:
xupei
2023-11-21 16:47:43 +08:00
parent 13208fed14
commit 8a3e6833ee
4 changed files with 51 additions and 13 deletions

View File

@@ -139,6 +139,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
log.info("chatRobot请求python 参数:####{}", param);
RequestBody body = RequestBody.create(mediaType, param);
Request request = new Request.Builder()
// .url("http://127.0.0.1:5000/api/chat_stream_test")
.url("http://18.167.251.121:9991/api/chat_stream_test")
// .url(accessPythonIp + ":10200/aifda/api/v1.0/generate")
.method("POST", body)
@@ -152,7 +153,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
}
if (Objects.isNull(response)) {
log.error("PythonService##chatRobot异常###{}", "response is empty!");
throw new BusinessException("system error!");
throw new BusinessException("chat-bot.interface.exception");
}
if (response.isSuccessful()) {
try {
@@ -193,7 +194,9 @@ public class ChatRobotServiceImpl implements ChatRobotService {
}
ChatRobotLibraryVO chatRobotLibraryVO = new ChatRobotLibraryVO();
String bucketName = sysImage;
String path = "images/female/" + array.getString(i);
String prefix = getPrefix(array.getString(i));
String path = prefix;
// String path = prefix + array.getString(i);
QueryWrapper<Library> qw = new QueryWrapper<>();
qw.lambda().eq(Library::getUrl, bucketName + "/" + path);
qw.lambda().eq(Library::getAccountId, chatSendDTO.getUser_id());
@@ -220,12 +223,14 @@ public class ChatRobotServiceImpl implements ChatRobotService {
}
return chatRobotVO;
}
throw new BusinessException("ChatRobot response data is null!");
log.error("ChatRobot response data is null!");
throw new BusinessException("chat-bot.interface.exception");
} catch (IOException e) {
throw new RuntimeException(e);
throw new BusinessException("chat-bot.interface.exception");
}
}
throw new BusinessException("ChatRobot exception!");
log.error("ChatRobot exception!");
throw new BusinessException("chat-bot.interface.exception");
}
private void checkBalance(BigDecimal totalCost, Long userId) {
@@ -309,4 +314,24 @@ public class ChatRobotServiceImpl implements ChatRobotService {
}
}
private String getPrefix(String minioPath){
String substring = minioPath.substring(minioPath.lastIndexOf("/") + 1, minioPath.lastIndexOf("_"));
String folder = minioPath.substring(0,minioPath.lastIndexOf("/"));
if ("mens_test".equals(substring)){
switch (folder){
case "bottom":
minioPath = minioPath.replace("bottom","bottoms");
break;
case "top":
minioPath = minioPath.replace("top","tops");
break;
case "outer":
minioPath = minioPath.replace("outer","outwear");
break;
}
return "images/male/" + minioPath;
}
return "images/female/" + minioPath;
}
}