mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-08 22:39:36 +08:00
refactor: sort mentioned models in QuickPanel (#6666)
This commit is contained in:
parent
ea061a3ba6
commit
2c8086f078
@ -74,29 +74,33 @@ const MentionModelsButton: FC<Props> = ({ ref, mentionModels, onMentionModel, To
|
|||||||
}
|
}
|
||||||
|
|
||||||
providers.forEach((p) => {
|
providers.forEach((p) => {
|
||||||
const providerModels = p.models
|
const providerModels = sortBy(
|
||||||
.filter((m) => !isEmbeddingModel(m) && !isRerankModel(m))
|
p.models
|
||||||
.filter((m) => !pinnedModels.includes(getModelUniqId(m)))
|
.filter((m) => !isEmbeddingModel(m) && !isRerankModel(m))
|
||||||
.map((m) => ({
|
.filter((m) => !pinnedModels.includes(getModelUniqId(m))),
|
||||||
label: (
|
['group', 'name']
|
||||||
<>
|
)
|
||||||
<ProviderName>{p.isSystem ? t(`provider.${p.id}`) : p.name}</ProviderName>
|
|
||||||
<span style={{ opacity: 0.8 }}> | {m.name}</span>
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
description: <ModelTagsWithLabel model={m} showLabel={false} size={10} style={{ opacity: 0.8 }} />,
|
|
||||||
icon: (
|
|
||||||
<Avatar src={getModelLogo(m.id)} size={20}>
|
|
||||||
{first(m.name)}
|
|
||||||
</Avatar>
|
|
||||||
),
|
|
||||||
filterText: (p.isSystem ? t(`provider.${p.id}`) : p.name) + m.name,
|
|
||||||
action: () => onMentionModel(m),
|
|
||||||
isSelected: mentionModels.some((selected) => getModelUniqId(selected) === getModelUniqId(m))
|
|
||||||
}))
|
|
||||||
|
|
||||||
if (providerModels.length > 0) {
|
const providerModelItems = providerModels.map((m) => ({
|
||||||
items.push(...sortBy(providerModels, ['label']))
|
label: (
|
||||||
|
<>
|
||||||
|
<ProviderName>{p.isSystem ? t(`provider.${p.id}`) : p.name}</ProviderName>
|
||||||
|
<span style={{ opacity: 0.8 }}> | {m.name}</span>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
description: <ModelTagsWithLabel model={m} showLabel={false} size={10} style={{ opacity: 0.8 }} />,
|
||||||
|
icon: (
|
||||||
|
<Avatar src={getModelLogo(m.id)} size={20}>
|
||||||
|
{first(m.name)}
|
||||||
|
</Avatar>
|
||||||
|
),
|
||||||
|
filterText: (p.isSystem ? t(`provider.${p.id}`) : p.name) + m.name,
|
||||||
|
action: () => onMentionModel(m),
|
||||||
|
isSelected: mentionModels.some((selected) => getModelUniqId(selected) === getModelUniqId(m))
|
||||||
|
}))
|
||||||
|
|
||||||
|
if (providerModelItems.length > 0) {
|
||||||
|
items.push(...providerModelItems)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user