Skip to content

Commit 6d2c62d

Browse files
authored
Merge pull request #40 from DEEIX-AI/model_test
feat: add model connectivity testing endpoints
2 parents efda47d + fcb121d commit 6d2c62d

26 files changed

Lines changed: 2919 additions & 40 deletions

File tree

backend/docs/docs.go

Lines changed: 358 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,132 @@ const docTemplate = `{
999999
}
10001000
}
10011001
},
1002+
"/admin/llm/models/{id}/test": {
1003+
"post": {
1004+
"security": [
1005+
{
1006+
"BearerAuth": []
1007+
}
1008+
],
1009+
"description": "按平台模型当前活跃路由选择一个来源执行轻量连通性测试;返回结果内的调试信息已脱敏且不包含 Base URL 或密钥",
1010+
"consumes": [
1011+
"application/json"
1012+
],
1013+
"produces": [
1014+
"application/json"
1015+
],
1016+
"tags": [
1017+
"llm"
1018+
],
1019+
"summary": "管理员测试平台模型路由",
1020+
"parameters": [
1021+
{
1022+
"type": "integer",
1023+
"description": "模型ID",
1024+
"name": "id",
1025+
"in": "path",
1026+
"required": true
1027+
},
1028+
{
1029+
"description": "测试参数",
1030+
"name": "body",
1031+
"in": "body",
1032+
"schema": {
1033+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeRequest"
1034+
}
1035+
}
1036+
],
1037+
"responses": {
1038+
"200": {
1039+
"description": "OK",
1040+
"schema": {
1041+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeResponseDoc"
1042+
}
1043+
},
1044+
"400": {
1045+
"description": "Bad Request",
1046+
"schema": {
1047+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
1048+
}
1049+
},
1050+
"404": {
1051+
"description": "Not Found",
1052+
"schema": {
1053+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
1054+
}
1055+
},
1056+
"500": {
1057+
"description": "Internal Server Error",
1058+
"schema": {
1059+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
1060+
}
1061+
}
1062+
}
1063+
}
1064+
},
1065+
"/admin/llm/models/{id}/test-all": {
1066+
"post": {
1067+
"security": [
1068+
{
1069+
"BearerAuth": []
1070+
}
1071+
],
1072+
"description": "按平台模型当前全部匹配的活跃路由并发执行轻量连通性测试;返回结果内的调试信息已脱敏且不包含 Base URL 或密钥",
1073+
"consumes": [
1074+
"application/json"
1075+
],
1076+
"produces": [
1077+
"application/json"
1078+
],
1079+
"tags": [
1080+
"llm"
1081+
],
1082+
"summary": "管理员批量测试平台模型全部路由",
1083+
"parameters": [
1084+
{
1085+
"type": "integer",
1086+
"description": "模型ID",
1087+
"name": "id",
1088+
"in": "path",
1089+
"required": true
1090+
},
1091+
{
1092+
"description": "测试参数",
1093+
"name": "body",
1094+
"in": "body",
1095+
"schema": {
1096+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeRequest"
1097+
}
1098+
}
1099+
],
1100+
"responses": {
1101+
"200": {
1102+
"description": "OK",
1103+
"schema": {
1104+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeBatchResponseDoc"
1105+
}
1106+
},
1107+
"400": {
1108+
"description": "Bad Request",
1109+
"schema": {
1110+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
1111+
}
1112+
},
1113+
"404": {
1114+
"description": "Not Found",
1115+
"schema": {
1116+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
1117+
}
1118+
},
1119+
"500": {
1120+
"description": "Internal Server Error",
1121+
"schema": {
1122+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
1123+
}
1124+
}
1125+
}
1126+
}
1127+
},
10021128
"/admin/llm/settings": {
10031129
"get": {
10041130
"security": [
@@ -2212,6 +2338,76 @@ const docTemplate = `{
22122338
}
22132339
}
22142340
},
2341+
"/admin/llm/upstreams/{id}/models/{route_id}/test": {
2342+
"post": {
2343+
"security": [
2344+
{
2345+
"BearerAuth": []
2346+
}
2347+
],
2348+
"description": "使用指定路由绑定的当前上游配置执行一次轻量连通性测试;返回结果内的调试信息已脱敏且不包含 Base URL 或密钥",
2349+
"consumes": [
2350+
"application/json"
2351+
],
2352+
"produces": [
2353+
"application/json"
2354+
],
2355+
"tags": [
2356+
"llm"
2357+
],
2358+
"summary": "管理员测试上游模型路由绑定",
2359+
"parameters": [
2360+
{
2361+
"type": "integer",
2362+
"description": "上游ID",
2363+
"name": "id",
2364+
"in": "path",
2365+
"required": true
2366+
},
2367+
{
2368+
"type": "integer",
2369+
"description": "路由绑定ID",
2370+
"name": "route_id",
2371+
"in": "path",
2372+
"required": true
2373+
},
2374+
{
2375+
"description": "测试参数",
2376+
"name": "body",
2377+
"in": "body",
2378+
"schema": {
2379+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeRequest"
2380+
}
2381+
}
2382+
],
2383+
"responses": {
2384+
"200": {
2385+
"description": "OK",
2386+
"schema": {
2387+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeResponseDoc"
2388+
}
2389+
},
2390+
"400": {
2391+
"description": "Bad Request",
2392+
"schema": {
2393+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
2394+
}
2395+
},
2396+
"404": {
2397+
"description": "Not Found",
2398+
"schema": {
2399+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
2400+
}
2401+
},
2402+
"500": {
2403+
"description": "Internal Server Error",
2404+
"schema": {
2405+
"$ref": "#/definitions/internal_transport_http_channel.ErrorDoc"
2406+
}
2407+
}
2408+
}
2409+
}
2410+
},
22152411
"/admin/settings": {
22162412
"get": {
22172413
"security": [
@@ -9204,6 +9400,168 @@ const docTemplate = `{
92049400
}
92059401
}
92069402
},
9403+
"internal_transport_http_channel.ModelProbeBatchResponse": {
9404+
"type": "object",
9405+
"properties": {
9406+
"failedCount": {
9407+
"type": "integer"
9408+
},
9409+
"results": {
9410+
"type": "array",
9411+
"items": {
9412+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeResponse"
9413+
}
9414+
},
9415+
"successCount": {
9416+
"type": "integer"
9417+
},
9418+
"totalCount": {
9419+
"type": "integer"
9420+
},
9421+
"unsupportedCount": {
9422+
"type": "integer"
9423+
}
9424+
}
9425+
},
9426+
"internal_transport_http_channel.ModelProbeBatchResponseDoc": {
9427+
"type": "object",
9428+
"properties": {
9429+
"data": {
9430+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeBatchResponse"
9431+
},
9432+
"errorMsg": {
9433+
"type": "string"
9434+
}
9435+
}
9436+
},
9437+
"internal_transport_http_channel.ModelProbeDebugRequestResponse": {
9438+
"type": "object",
9439+
"properties": {
9440+
"body": {
9441+
"type": "string"
9442+
},
9443+
"headers": {
9444+
"type": "object",
9445+
"additionalProperties": {
9446+
"type": "string"
9447+
}
9448+
},
9449+
"method": {
9450+
"type": "string"
9451+
},
9452+
"path": {
9453+
"type": "string"
9454+
}
9455+
}
9456+
},
9457+
"internal_transport_http_channel.ModelProbeDebugResponse": {
9458+
"type": "object",
9459+
"properties": {
9460+
"request": {
9461+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeDebugRequestResponse"
9462+
},
9463+
"response": {
9464+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeDebugResponseResponse"
9465+
}
9466+
}
9467+
},
9468+
"internal_transport_http_channel.ModelProbeDebugResponseResponse": {
9469+
"type": "object",
9470+
"properties": {
9471+
"body": {
9472+
"type": "string"
9473+
},
9474+
"headers": {
9475+
"type": "object",
9476+
"additionalProperties": {
9477+
"type": "string"
9478+
}
9479+
},
9480+
"statusCode": {
9481+
"type": "integer"
9482+
}
9483+
}
9484+
},
9485+
"internal_transport_http_channel.ModelProbeRequest": {
9486+
"type": "object",
9487+
"properties": {
9488+
"taskType": {
9489+
"type": "string",
9490+
"enum": [
9491+
"chat",
9492+
"image_generation",
9493+
"image_edit"
9494+
]
9495+
}
9496+
}
9497+
},
9498+
"internal_transport_http_channel.ModelProbeResponse": {
9499+
"type": "object",
9500+
"properties": {
9501+
"bindingCode": {
9502+
"type": "string"
9503+
},
9504+
"debug": {
9505+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeDebugResponse"
9506+
},
9507+
"endpoint": {
9508+
"type": "string"
9509+
},
9510+
"errorCode": {
9511+
"type": "string"
9512+
},
9513+
"errorMessage": {
9514+
"type": "string"
9515+
},
9516+
"latencyMS": {
9517+
"type": "integer"
9518+
},
9519+
"platformModelID": {
9520+
"type": "integer"
9521+
},
9522+
"platformModelName": {
9523+
"type": "string"
9524+
},
9525+
"protocol": {
9526+
"type": "string"
9527+
},
9528+
"routeID": {
9529+
"type": "integer"
9530+
},
9531+
"status": {
9532+
"type": "string"
9533+
},
9534+
"success": {
9535+
"type": "boolean"
9536+
},
9537+
"upstreamID": {
9538+
"type": "integer"
9539+
},
9540+
"upstreamModelID": {
9541+
"type": "integer"
9542+
},
9543+
"upstreamModelName": {
9544+
"type": "string"
9545+
},
9546+
"upstreamName": {
9547+
"type": "string"
9548+
},
9549+
"upstreamStatusCode": {
9550+
"type": "integer"
9551+
}
9552+
}
9553+
},
9554+
"internal_transport_http_channel.ModelProbeResponseDoc": {
9555+
"type": "object",
9556+
"properties": {
9557+
"data": {
9558+
"$ref": "#/definitions/internal_transport_http_channel.ModelProbeResponse"
9559+
},
9560+
"errorMsg": {
9561+
"type": "string"
9562+
}
9563+
}
9564+
},
92079565
"internal_transport_http_channel.ModelResponse": {
92089566
"type": "object",
92099567
"properties": {

0 commit comments

Comments
 (0)