Commit a90bbae9 authored by linpeiqin's avatar linpeiqin

修改接口返回类型

parent cf476579
......@@ -102,7 +102,7 @@ public class ModelEstimateController {
* @return 应答结果对象。
*/
@GetMapping("/getPreviewCommand")
public ResponseResult<String> getPreviewCommand(@RequestParam Long taskId) {
public ResponseResult<JSONArray> getPreviewCommand(@RequestParam Long taskId) {
ModelEstimate modelEstimate = this.modelEstimateService.getById(taskId);
ModelVersion modelVersion = this.modelVersionService.getById(modelEstimate.getModelVersionId());
DatasetVersion datasetVersion = this.datasetVersionService.getById(modelEstimate.getDatasetVersionId());
......@@ -132,8 +132,8 @@ public class ModelEstimateController {
array.add(jsonObject.get("ToppSamplingValue"));
array.add(jsonObject.get("temperatureCoefficient"));
array.add(this.pythonConfig.getModelEstimateFileBaseDir() + modelVersion.getVersionName() + File.separator + "evl_" + taskId);
System.out.println(array.toJSONString());
return ResponseResult.success(array.toJSONString());
System.out.println(array);
return ResponseResult.success(array);
}
/**
......
package com.yice.webadmin.app.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.page.PageMethod;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
......@@ -166,7 +167,7 @@ public class ModelVersionController {
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/listModels")
public ResponseResult<String> listModels() throws IOException {
public ResponseResult<JSONArray> listModels() throws IOException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("placeholder","string");
jsonObject.put("controller_address",pythonConfig.getControllerAddress());
......@@ -175,11 +176,10 @@ public class ModelVersionController {
JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code");
String msg = jo.getString("msg");
String data = jo.getString("data");
if (code != null && code == 200) {
return ResponseResult.create(ErrorCodeEnum.NO_ERROR, msg, data);
return ResponseResult.create(ErrorCodeEnum.NO_ERROR, msg, jo.getJSONArray("data"));
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, null);
}
}
......
......@@ -144,7 +144,7 @@ public class TuningRunController {
* @return 应答结果对象。
*/
@GetMapping("/getPreviewCommand")
public ResponseResult<String> getPreviewCommand(@RequestParam Long runId) {
public ResponseResult<JSONArray> getPreviewCommand(@RequestParam Long runId) {
TuningRun tuningRun = this.tuningRunService.getById(runId);
ModelVersion modelVersion = this.modelVersionService.getById(tuningRun.getModelVersionId());
DatasetVersion datasetVersion = this.datasetVersionService.getById(tuningRun.getDatasetVersionId());
......@@ -190,8 +190,8 @@ public class TuningRunController {
array.add(jsonObject.get("dpoBetaData"));
array.add(new JSONArray());
array.add("train_" + runId);
System.out.println(array.toJSONString());
return ResponseResult.success(array.toJSONString());
System.out.println(array);
return ResponseResult.success(array);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment