From f7fd1296bf507132d91a6fe7a7924392c14e2ec4 Mon Sep 17 00:00:00 2001
From: Saumya
Date: Mon, 28 Jul 2025 11:49:24 +0530
Subject: [PATCH] improve ux a bit
---
.../agents/pipedream/pipedream-connector.tsx | 1 -
.../agents/pipedream/pipedream-registry.tsx | 2 +-
.../thread/chat-input/agent-selector.tsx | 24 ++++++++++++-------
.../content/pipedream-connect-button.tsx | 1 -
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/frontend/src/components/agents/pipedream/pipedream-connector.tsx b/frontend/src/components/agents/pipedream/pipedream-connector.tsx
index 15af0857..78288597 100644
--- a/frontend/src/components/agents/pipedream/pipedream-connector.tsx
+++ b/frontend/src/components/agents/pipedream/pipedream-connector.tsx
@@ -280,7 +280,6 @@ export const PipedreamConnector: React.FC = ({
}
-
{mode !== 'profile-only' && availableProfiles.length > 0 && !isCreatingProfile && (
{connectionSuccessProfileId && (
diff --git a/frontend/src/components/agents/pipedream/pipedream-registry.tsx b/frontend/src/components/agents/pipedream/pipedream-registry.tsx
index cff30a8b..50df380e 100644
--- a/frontend/src/components/agents/pipedream/pipedream-registry.tsx
+++ b/frontend/src/components/agents/pipedream/pipedream-registry.tsx
@@ -292,7 +292,7 @@ export const PipedreamRegistry: React.FC
= ({
- {showAgentSelector && currentAgentId ? 'Connected to Agent' : 'Connected Apps'}
+ Your Apps
diff --git a/frontend/src/components/thread/chat-input/agent-selector.tsx b/frontend/src/components/thread/chat-input/agent-selector.tsx
index 7d9eae0b..8687e164 100644
--- a/frontend/src/components/thread/chat-input/agent-selector.tsx
+++ b/frontend/src/components/thread/chat-input/agent-selector.tsx
@@ -85,12 +85,22 @@ export const AgentSelector: React.FC = ({
}))
];
- // Filter agents based on search query
const filteredAgents = allAgents.filter((agent) =>
agent.name.toLowerCase().includes(searchQuery.toLowerCase()) ||
agent.description?.toLowerCase().includes(searchQuery.toLowerCase())
);
+ const sortedFilteredAgents = React.useMemo(() => {
+ if (!selectedAgentId) {
+ return filteredAgents;
+ }
+
+ const selectedAgent = filteredAgents.find(agent => agent.id === selectedAgentId);
+ const otherAgents = filteredAgents.filter(agent => agent.id !== selectedAgentId);
+
+ return selectedAgent ? [selectedAgent, ...otherAgents] : filteredAgents;
+ }, [filteredAgents, selectedAgentId]);
+
useEffect(() => {
if (isOpen && searchInputRef.current) {
setTimeout(() => {
@@ -114,12 +124,10 @@ export const AgentSelector: React.FC = ({
};
}
- // If selectedAgentId is not undefined but no agent is found, log a warning
if (selectedAgentId !== undefined) {
console.warn('Agent with ID', selectedAgentId, 'not found, falling back to Suna');
}
- // Default to Suna (the first agent which has id: undefined)
const defaultAgent = allAgents[0];
const isDefaultAgentSuna = defaultAgent?.metadata?.is_suna_default || false;
return {
@@ -145,16 +153,16 @@ export const AgentSelector: React.FC = ({
if (e.key === 'ArrowDown') {
e.preventDefault();
setHighlightedIndex((prev) =>
- prev < filteredAgents.length - 1 ? prev + 1 : 0
+ prev < sortedFilteredAgents.length - 1 ? prev + 1 : 0
);
} else if (e.key === 'ArrowUp') {
e.preventDefault();
setHighlightedIndex((prev) =>
- prev > 0 ? prev - 1 : filteredAgents.length - 1
+ prev > 0 ? prev - 1 : sortedFilteredAgents.length - 1
);
} else if (e.key === 'Enter' && highlightedIndex >= 0) {
e.preventDefault();
- const selectedAgent = filteredAgents[highlightedIndex];
+ const selectedAgent = sortedFilteredAgents[highlightedIndex];
if (selectedAgent) {
handleAgentSelect(selectedAgent.id);
}
@@ -320,7 +328,7 @@ export const AgentSelector: React.FC = ({
- ) : filteredAgents.length === 0 ? (
+ ) : sortedFilteredAgents.length === 0 ? (
No agents found
@@ -328,7 +336,7 @@ export const AgentSelector: React.FC
= ({
) : (
- {filteredAgents.map((agent, index) => renderAgentItem(agent, index))}
+ {sortedFilteredAgents.map((agent, index) => renderAgentItem(agent, index))}
)}
diff --git a/frontend/src/components/thread/content/pipedream-connect-button.tsx b/frontend/src/components/thread/content/pipedream-connect-button.tsx
index 17f5286f..3b63262a 100644
--- a/frontend/src/components/thread/content/pipedream-connect-button.tsx
+++ b/frontend/src/components/thread/content/pipedream-connect-button.tsx
@@ -130,7 +130,6 @@ export const PipedreamConnectButton: React.FC = ({