feat(portal): add logical group guidance config
This commit is contained in:
@@ -16,10 +16,14 @@ func TestAPICreateLogicalGroupReturnsCreated(t *testing.T) {
|
||||
if req.LogicalGroupID != "gpt-shared" {
|
||||
t.Fatalf("LogicalGroupID = %q, want gpt-shared", req.LogicalGroupID)
|
||||
}
|
||||
if req.UsageScenario != "适合统一 GPT 产品入口" {
|
||||
t.Fatalf("UsageScenario = %q, want configured guidance", req.UsageScenario)
|
||||
}
|
||||
return LogicalGroupInfo{
|
||||
LogicalGroupID: req.LogicalGroupID,
|
||||
DisplayName: req.DisplayName,
|
||||
Status: req.Status,
|
||||
UsageScenario: req.UsageScenario,
|
||||
}, nil
|
||||
},
|
||||
})
|
||||
@@ -28,6 +32,7 @@ func TestAPICreateLogicalGroupReturnsCreated(t *testing.T) {
|
||||
"logical_group_id": "gpt-shared",
|
||||
"display_name": "GPT Shared",
|
||||
"status": "active",
|
||||
"usage_scenario": "适合统一 GPT 产品入口",
|
||||
}, "secret-token")
|
||||
response := httptestRecorder(handler, request)
|
||||
assertStatusCode(t, response, http.StatusCreated)
|
||||
@@ -44,6 +49,9 @@ func TestAPIGetLogicalGroupReturnsAggregatedItem(t *testing.T) {
|
||||
LogicalGroupID: groupID,
|
||||
DisplayName: "GPT Shared",
|
||||
Status: "active",
|
||||
UsageScenario: "适合统一 GPT 产品入口",
|
||||
Recommendation: "优先使用 gpt-5.4",
|
||||
NextStepHint: "先创建测试 Key",
|
||||
Models: []LogicalGroupModelInfo{{PublicModel: "gpt-5.4", Status: "active"}},
|
||||
Routes: []LogicalGroupRouteInfo{{
|
||||
RouteID: "asxs",
|
||||
@@ -83,6 +91,9 @@ func TestAPIGetLogicalGroupReturnsAggregatedItem(t *testing.T) {
|
||||
if !ok || firstRoute["route_id"] != "asxs" {
|
||||
t.Fatalf("first route = %#v, want route_id asxs", routes[0])
|
||||
}
|
||||
if group["usage_scenario"] != "适合统一 GPT 产品入口" || group["recommendation"] != "优先使用 gpt-5.4" || group["next_step_hint"] != "先创建测试 Key" {
|
||||
t.Fatalf("group guidance = %#v, want configured guidance fields", group)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPICreateLogicalGroupRouteUsesPathGroupID(t *testing.T) {
|
||||
@@ -151,6 +162,9 @@ func TestNewActionSetLogicalGroupCRUDFlow(t *testing.T) {
|
||||
LogicalGroupID: "gpt-shared",
|
||||
DisplayName: "GPT Shared",
|
||||
Status: "active",
|
||||
UsageScenario: "适合统一 GPT 产品入口",
|
||||
Recommendation: "优先使用 gpt-5.4",
|
||||
NextStepHint: "先创建测试 Key",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("CreateLogicalGroup() error = %v", err)
|
||||
@@ -158,6 +172,9 @@ func TestNewActionSetLogicalGroupCRUDFlow(t *testing.T) {
|
||||
if createdGroup.LogicalGroupID != "gpt-shared" {
|
||||
t.Fatalf("CreateLogicalGroup() = %+v, want logical_group_id gpt-shared", createdGroup)
|
||||
}
|
||||
if createdGroup.UsageScenario != "适合统一 GPT 产品入口" || createdGroup.Recommendation != "优先使用 gpt-5.4" || createdGroup.NextStepHint != "先创建测试 Key" {
|
||||
t.Fatalf("CreateLogicalGroup() guidance = %+v, want configured guidance fields", createdGroup)
|
||||
}
|
||||
|
||||
if _, err := actions.CreateLogicalGroupModel(ctx, CreateLogicalGroupModelRequest{
|
||||
LogicalGroupID: "gpt-shared",
|
||||
@@ -199,11 +216,17 @@ func TestNewActionSetLogicalGroupCRUDFlow(t *testing.T) {
|
||||
if len(group.Routes[0].Models) != 1 || group.Routes[0].Models[0].ShadowModel != "gpt-5.4" {
|
||||
t.Fatalf("GetLogicalGroup().Routes[0].Models = %+v, want shadow gpt-5.4", group.Routes[0].Models)
|
||||
}
|
||||
if group.UsageScenario != "适合统一 GPT 产品入口" || group.Recommendation != "优先使用 gpt-5.4" || group.NextStepHint != "先创建测试 Key" {
|
||||
t.Fatalf("GetLogicalGroup() guidance = %+v, want configured guidance fields", group)
|
||||
}
|
||||
|
||||
if _, err := actions.UpdateLogicalGroup(ctx, UpdateLogicalGroupRequest{
|
||||
LogicalGroupID: "gpt-shared",
|
||||
DisplayName: "GPT Shared Updated",
|
||||
Status: "paused",
|
||||
UsageScenario: "适合升级后的 GPT 产品入口",
|
||||
Recommendation: "先验证高质量推理链路",
|
||||
NextStepHint: "升级后重新申请测试 Key",
|
||||
}); err != nil {
|
||||
t.Fatalf("UpdateLogicalGroup() error = %v", err)
|
||||
}
|
||||
@@ -228,6 +251,9 @@ func TestNewActionSetLogicalGroupCRUDFlow(t *testing.T) {
|
||||
if len(groups) != 1 || groups[0].DisplayName != "GPT Shared Updated" {
|
||||
t.Fatalf("ListLogicalGroups() = %+v, want updated group", groups)
|
||||
}
|
||||
if groups[0].UsageScenario != "适合升级后的 GPT 产品入口" || groups[0].Recommendation != "先验证高质量推理链路" || groups[0].NextStepHint != "升级后重新申请测试 Key" {
|
||||
t.Fatalf("ListLogicalGroups() guidance = %+v, want updated guidance fields", groups[0])
|
||||
}
|
||||
|
||||
routeModels, err := actions.ListLogicalGroupRouteModels(ctx, ListLogicalGroupRouteModelsRequest{
|
||||
LogicalGroupID: "gpt-shared",
|
||||
|
||||
Reference in New Issue
Block a user