wip
This commit is contained in:
parent
0f36610e23
commit
9b84176a42
@ -58,19 +58,21 @@ const AgentsPage: FC = () => {
|
|||||||
return groups
|
return groups
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.entries(agentGroups).forEach(([group, agents]) => {
|
const uniqueAgents = new Map<string, Agent>()
|
||||||
if (group === '精选') return
|
|
||||||
|
|
||||||
const filteredAgents = agents.filter(
|
Object.entries(agentGroups).forEach(([, agents]) => {
|
||||||
(agent) =>
|
agents.forEach((agent) => {
|
||||||
agent.name.toLowerCase().includes(search.toLowerCase()) ||
|
if (
|
||||||
agent.description?.toLowerCase().includes(search.toLowerCase())
|
(agent.name.toLowerCase().includes(search.toLowerCase()) ||
|
||||||
)
|
agent.description?.toLowerCase().includes(search.toLowerCase())) &&
|
||||||
if (filteredAgents.length > 0) {
|
!uniqueAgents.has(agent.name)
|
||||||
groups[group] = filteredAgents
|
) {
|
||||||
}
|
uniqueAgents.set(agent.name, agent)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
return groups
|
|
||||||
|
return { 搜索结果: Array.from(uniqueAgents.values()) }
|
||||||
}, [agentGroups, search])
|
}, [agentGroups, search])
|
||||||
|
|
||||||
const getAgentName = (agent: Agent) => {
|
const getAgentName = (agent: Agent) => {
|
||||||
@ -174,8 +176,25 @@ const AgentsPage: FC = () => {
|
|||||||
</Navbar>
|
</Navbar>
|
||||||
<ContentContainer id="content-container">
|
<ContentContainer id="content-container">
|
||||||
<AssistantsContainer>
|
<AssistantsContainer>
|
||||||
{tabItems.length > 0 ? (
|
{Object.values(filteredAgentGroups).flat().length > 0 ? (
|
||||||
<Tabs tabPosition="right" animated items={tabItems} />
|
search.trim() ? (
|
||||||
|
<TabContent>
|
||||||
|
<Row gutter={[20, 20]}>
|
||||||
|
{Object.values(filteredAgentGroups)
|
||||||
|
.flat()
|
||||||
|
.map((agent, index) => (
|
||||||
|
<Col span={6} key={index}>
|
||||||
|
<AgentCard
|
||||||
|
onClick={() => onAddAgentConfirm(getAgentFromSystemAgent(agent as any))}
|
||||||
|
agent={agent as any}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
))}
|
||||||
|
</Row>
|
||||||
|
</TabContent>
|
||||||
|
) : (
|
||||||
|
<Tabs tabPosition="right" animated items={tabItems} />
|
||||||
|
)
|
||||||
) : (
|
) : (
|
||||||
<EmptyView>
|
<EmptyView>
|
||||||
<Empty description={t('agents.search.no_results')} />
|
<Empty description={t('agents.search.no_results')} />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user