feat(channels): explode available channels by platform + apply platform theme
Backend: one source channel → N output rows, one per platform that has user-visible groups. Each row carries a single platform, so the frontend can color/icon an entire row without mixing sources. - userAvailableChannel: add Platform field - new explodeChannelByPlatform helper; drop now-redundant collectGroupPlatforms Frontend: use the row platform to drive theming and stop repeating "ANTHROPIC" / "OPENAI" labels on every model chip. - api/channels.ts: UserAvailableChannel.platform - AvailableChannelsTable: name cell — PlatformBadge next to channel name (replaces the two-line name/description block; description moves to the badge's title tooltip); groups cell — each chip uses platformBadgeLightClass + PlatformIcon; model list passes show-platform=false + platform-hint to child chips - SupportedModelChip: chip bg/border driven by platformBadgeClass, leading PlatformIcon; platform-hint fallback when model.platform missing
This commit is contained in:
@@ -42,21 +42,6 @@ func TestFilterUserVisibleGroups_IntersectionOnly(t *testing.T) {
|
||||
require.ElementsMatch(t, []int64{1, 3}, ids)
|
||||
}
|
||||
|
||||
func TestCollectGroupPlatforms_DerivesAllowedSet(t *testing.T) {
|
||||
groups := []userAvailableGroup{
|
||||
{ID: 1, Platform: "anthropic"},
|
||||
{ID: 2, Platform: "openai"},
|
||||
{ID: 3, Platform: "anthropic"}, // 去重
|
||||
{ID: 4, Platform: ""}, // 空平台忽略
|
||||
}
|
||||
got := collectGroupPlatforms(groups)
|
||||
require.Len(t, got, 2)
|
||||
_, hasAnt := got["anthropic"]
|
||||
_, hasOA := got["openai"]
|
||||
require.True(t, hasAnt)
|
||||
require.True(t, hasOA)
|
||||
}
|
||||
|
||||
func TestToUserSupportedModels_FiltersByAllowedPlatforms(t *testing.T) {
|
||||
// 用户可访问分组只覆盖 anthropic;anthropic 平台的模型保留,openai 模型被剔除。
|
||||
src := []service.SupportedModel{
|
||||
|
||||
Reference in New Issue
Block a user