mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(frontend): Sort agents by last edited date in publish dialog (#9724)
- fix #9189 Currently, the list of agents on the "Publish Agent" dialog is random. I have sorted them so that the latest edited ones appear first, similar to the library page. Co-authored-by: Bently <tomnoon9@gmail.com>
This commit is contained in:
@@ -214,14 +214,20 @@ export const PublishAgentPopout: React.FC<PublishAgentPopoutProps> = ({
|
||||
<div className="h-full overflow-y-auto">
|
||||
<PublishAgentSelect
|
||||
agents={
|
||||
myAgents?.agents.map((agent) => ({
|
||||
name: agent.agent_name,
|
||||
id: agent.agent_id,
|
||||
version: agent.agent_version,
|
||||
lastEdited: agent.last_edited,
|
||||
imageSrc:
|
||||
agent.agent_image || "https://picsum.photos/300/200",
|
||||
})) || []
|
||||
myAgents?.agents
|
||||
.map((agent) => ({
|
||||
name: agent.agent_name,
|
||||
id: agent.agent_id,
|
||||
version: agent.agent_version,
|
||||
lastEdited: agent.last_edited,
|
||||
imageSrc:
|
||||
agent.agent_image || "https://picsum.photos/300/200",
|
||||
}))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
new Date(b.lastEdited).getTime() -
|
||||
new Date(a.lastEdited).getTime(),
|
||||
) || []
|
||||
}
|
||||
onSelect={handleAgentSelect}
|
||||
onCancel={handleClose}
|
||||
|
||||
Reference in New Issue
Block a user