Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
lmp_server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lmp
lmp_server
Commits
7030872c
Commit
7030872c
authored
Dec 12, 2023
by
linpeiqin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加模型管理的已加载模型和停止接口
parent
eb129f4a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
ModelVersionController.java
.../yice/webadmin/app/controller/ModelVersionController.java
+45
-2
No files found.
application-webadmin/src/main/java/com/yice/webadmin/app/controller/ModelVersionController.java
View file @
7030872c
...
@@ -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
);
}
}
/**
/**
* 列出符合过滤条件的模型版本列表。
* 列出符合过滤条件的模型版本列表。
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment