Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
80a609b7
authored
Feb 02, 2026
by
Seefs
Committed by
GitHub
Feb 02, 2026
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2759 from KiGamji/fix-group-colors
fix(ui): use distinct color palette for group tags
parents
aa498d5d
033365a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
15 deletions
+43
-15
web/src/helpers/render.jsx
+43
-15
No files found.
web/src/helpers/render.jsx
View file @
80a609b7
...
...
@@ -167,21 +167,21 @@ export const getModelCategories = (() => {
gemini
:
{
label
:
'Gemini'
,
icon
:
<
Gemini
.
Color
/>,
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'gemini'
)
||
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'gemini'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'gemma'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'learnlm'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'learnlm'
)
||
model
.
model_name
.
toLowerCase
().
startsWith
(
'embedding-'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'text-embedding-004'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'imagen-4'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'veo-'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'aqa'
)
,
model
.
model_name
.
toLowerCase
().
includes
(
'imagen-4'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'veo-'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'aqa'
),
},
moonshot
:
{
label
:
'Moonshot'
,
icon
:
<
Moonshot
/>,
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'moonshot'
)
||
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'moonshot'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'kimi'
),
},
zhipu
:
{
...
...
@@ -189,8 +189,8 @@ export const getModelCategories = (() => {
icon
:
<
Zhipu
.
Color
/>,
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'chatglm'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'glm-'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'cogview'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'glm-'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'cogview'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'cogvideo'
),
},
qwen
:
{
...
...
@@ -206,8 +206,8 @@ export const getModelCategories = (() => {
minimax
:
{
label
:
'MiniMax'
,
icon
:
<
Minimax
.
Color
/>,
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'abab'
)
||
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'abab'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'minimax'
),
},
baidu
:
{
...
...
@@ -233,7 +233,7 @@ export const getModelCategories = (() => {
cohere
:
{
label
:
'Cohere'
,
icon
:
<
Cohere
.
Color
/>,
filter
:
(
model
)
=>
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'command'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'c4ai-'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'embed-'
),
...
...
@@ -256,7 +256,7 @@ export const getModelCategories = (() => {
mistral
:
{
label
:
'Mistral AI'
,
icon
:
<
Mistral
.
Color
/>,
filter
:
(
model
)
=>
filter
:
(
model
)
=>
model
.
model_name
.
toLowerCase
().
includes
(
'mistral'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'codestral'
)
||
model
.
model_name
.
toLowerCase
().
includes
(
'pixtral'
)
||
...
...
@@ -602,6 +602,34 @@ export function stringToColor(str) {
return
colors
[
i
];
}
// High-contrast color palette for group tags (avoids similar blue/teal shades)
const
groupColors
=
[
'red'
,
'orange'
,
'yellow'
,
'lime'
,
'green'
,
'cyan'
,
'blue'
,
'indigo'
,
'violet'
,
'purple'
,
'pink'
,
'amber'
,
'grey'
,
];
export
function
groupToColor
(
str
)
{
// Use a better hash algorithm for more even distribution
let
hash
=
0
;
for
(
let
i
=
0
;
i
<
str
.
length
;
i
++
)
{
hash
=
(
hash
<<
5
)
-
hash
+
str
.
charCodeAt
(
i
);
hash
=
hash
&
hash
;
}
hash
=
Math
.
abs
(
hash
);
return
groupColors
[
hash
%
groupColors
.
length
];
}
// 渲染带有模型图标的标签
export
function
renderModelTag
(
modelName
,
options
=
{})
{
const
{
...
...
@@ -670,7 +698,7 @@ export function renderGroup(group) {
<
span
key=
{
group
}
>
{
groups
.
map
((
group
)
=>
(
<
Tag
color=
{
tagColors
[
group
]
||
string
ToColor
(
group
)
}
color=
{
tagColors
[
group
]
||
group
ToColor
(
group
)
}
key=
{
group
}
shape=
'circle'
onClick=
{
async
(
event
)
=>
{
...
...
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