Commit 7030872c authored by linpeiqin's avatar linpeiqin

增加模型管理的已加载模型和停止接口

parent eb129f4a
...@@ -128,8 +128,7 @@ public class ModelVersionController { ...@@ -128,8 +128,7 @@ public class ModelVersionController {
jsonObject.put("new_model_path",modelVersion.getModelUrl()); jsonObject.put("new_model_path",modelVersion.getModelUrl());
jsonObject.put("controller_address",pythonConfig.getControllerAddress()); jsonObject.put("controller_address",pythonConfig.getControllerAddress());
String url = this.pythonConfig.getChatAddress() + "llm_model/change"; String url = this.pythonConfig.getChatAddress() + "llm_model/change";
String requestBody = jsonObject.toJSONString(); String result = proxyPythonService.predictPost(url,jsonObject.toJSONString());
String result = proxyPythonService.predictPost(url,requestBody);
JSONObject jo = JSON.parseObject(result); JSONObject jo = JSON.parseObject(result);
Integer code = jo.getIntValue("code"); Integer code = jo.getIntValue("code");
String msg = jo.getString("msg"); String msg = jo.getString("msg");
...@@ -140,6 +139,50 @@ public class ModelVersionController { ...@@ -140,6 +139,50 @@ public class ModelVersionController {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data); return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
} }
} }
/**
* 停止指定的LLM模型(Model Worker)
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/stop")
public ResponseResult<String> stop() throws IOException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("controller_address",pythonConfig.getControllerAddress());
String url = this.pythonConfig.getChatAddress() + "llm_model/stop";
String result = proxyPythonService.predictPost(url, jsonObject.toJSONString());
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.success(msg);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
}
/**
* 列出当前已加载的模型。
*
* @return 应答结果对象,包含查询结果集。
*/
@PostMapping("/listModels")
public ResponseResult<String> listModels() throws IOException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("placeholder","string");
jsonObject.put("controller_address",pythonConfig.getControllerAddress());
String url = this.pythonConfig.getChatAddress() + "llm_model/list_models";
String result = proxyPythonService.predictPost(url,jsonObject.toJSONString());
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.success(msg);
} else {
return ResponseResult.create(ErrorCodeEnum.SERVER_INTERNAL_ERROR, msg, data);
}
}
/** /**
* 列出符合过滤条件的模型版本列表。 * 列出符合过滤条件的模型版本列表。
......
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