fix: agents sort
This commit is contained in:
parent
2143a6614e
commit
057efbf98c
@ -4,7 +4,7 @@ import Scrollbar from '@renderer/components/Scrollbar'
|
||||
import SystemAgents from '@renderer/config/agents.json'
|
||||
import { createAssistantFromAgent } from '@renderer/services/assistant'
|
||||
import { Agent } from '@renderer/types'
|
||||
import { sortByEnglishFirst, uuid } from '@renderer/utils'
|
||||
import { uuid } from '@renderer/utils'
|
||||
import { Col, Empty, Input, Row, Tabs as TabsAntd, Typography } from 'antd'
|
||||
import { groupBy, omit } from 'lodash'
|
||||
import { FC, useCallback, useMemo, useState } from 'react'
|
||||
@ -96,9 +96,10 @@ const AgentsPage: FC = () => {
|
||||
}
|
||||
|
||||
const tabItems = useMemo(() => {
|
||||
return Object.keys(filteredAgentGroups)
|
||||
.sort(sortByEnglishFirst)
|
||||
.map((group, i) => {
|
||||
let groups = Object.keys(filteredAgentGroups)
|
||||
groups = groups.filter((g) => g !== '办公')
|
||||
groups = ['办公', ...groups]
|
||||
return groups.map((group, i) => {
|
||||
const id = String(i + 1)
|
||||
return {
|
||||
label: group,
|
||||
@ -112,10 +113,7 @@ const AgentsPage: FC = () => {
|
||||
{filteredAgentGroups[group].map((agent, index) => {
|
||||
return (
|
||||
<Col span={8} key={group + index}>
|
||||
<AgentCard
|
||||
onClick={() => onAddAgentConfirm(getAgentFromSystemAgent(agent))}
|
||||
agent={agent as any}
|
||||
/>
|
||||
<AgentCard onClick={() => onAddAgentConfirm(getAgentFromSystemAgent(agent))} agent={agent as any} />
|
||||
</Col>
|
||||
)
|
||||
})}
|
||||
|
||||
@ -15,7 +15,9 @@ const AgentCard: React.FC<Props> = ({ agent, onClick }) => {
|
||||
<AgentHeader>
|
||||
<AgentName style={{ marginBottom: 0 }}>{agent.name}</AgentName>
|
||||
</AgentHeader>
|
||||
<AgentCardPrompt className="text-nowrap">{agent.description || agent.prompt}</AgentCardPrompt>
|
||||
<AgentCardPrompt className="text-nowrap">
|
||||
{(agent.description || agent.prompt).substring(0, 20)}
|
||||
</AgentCardPrompt>
|
||||
</Col>
|
||||
</Container>
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user