TASK:mixi;

This commit is contained in:
shahaibo
2024-08-30 16:44:19 +08:00
parent 38325fedc1
commit 6066c9bd04
4 changed files with 412 additions and 257 deletions

View File

@@ -569,7 +569,7 @@ public class PythonService {
return productList;
}
public JSONObject getAIRecommend(QeFilling qeFilling) {
public JSONArray getAIRecommend(QeFilling qeFilling) {
//限流校验
// AccessLimitUtils.validate("similarityMatch", 20);
OkHttpClient client = new OkHttpClient().newBuilder()
@@ -581,20 +581,20 @@ public class PythonService {
MediaType mediaType = MediaType.parse("application/json");
Map<String, Object> content = Maps.newHashMap();
content.put("user_id", qeFilling.getPhoneNum());
content.put("type", qeFilling.getType());
content.put("q1", qeFilling.getQ1());
content.put("q2", qeFilling.getQ2());
content.put("q3", qeFilling.getQ3());
content.put("q4", qeFilling.getQ4());
content.put("q5", qeFilling.getQ5());
content.put("q6", qeFilling.getQ6());
content.put("q7", qeFilling.getQ7());
content.put("q8", qeFilling.getQ8());
// content.put("type", qeFilling.getType());
// content.put("q1", qeFilling.getQ1());
// content.put("q2", qeFilling.getQ2());
// content.put("q3", qeFilling.getQ3());
// content.put("q4", qeFilling.getQ4());
// content.put("q5", qeFilling.getQ5());
// content.put("q6", qeFilling.getQ6());
// content.put("q7", qeFilling.getQ7());
// content.put("q8", qeFilling.getQ8());
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(content));
Request request = new Request.Builder()
// .url(accessPythonIp + ":9993/api/similar_matchsimilar_match")
.url("http://18.167.251.121:10001/chat")
.url("http://18.167.251.121:5001/chat")
.method("POST", body)
// .addHeader("Authorization", "Basic YWlkbGFiOjEyMw==")
.addHeader("Content-Type", "application/json")
@@ -618,8 +618,8 @@ public class PythonService {
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(response));
Boolean result = jsonObject.getBoolean("successful");
if (result) {
JSONObject parseObject = JSON.parseObject(bodyStr.trim());
return parseObject;
JSONArray parseArray = JSON.parseArray(bodyStr.trim());
return parseArray;
}
log.info("获取python获取AI推荐请求异常###{}", jsonObject);
//生成失败