Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/appbar/AddAgentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ interface AddAgentModalProps {
}

export const AddAgentModal: React.FC<AddAgentModalProps> = ({ open, onClose, addAgentByUrl }) => {
const [url, setUrl] = React.useState<string>("https://example.com/.well-known/agent-card.json");
const [url, setUrl] = React.useState<string>(process.env.NEXT_PUBLIC_DEFAULT_AGENT_CARDS_URL || "https://example.com/.well-known/agent-card.json");
const [loading, setLoading] = React.useState<boolean>(false);

const handleClose = (): void => {
setUrl("https://example.com/.well-known/agent-card.json");
setUrl(process.env.NEXT_PUBLIC_DEFAULT_AGENT_CARDS_URL || "https://example.com/.well-known/agent-card.json");
setLoading(false);
onClose();
};
Expand Down
20 changes: 19 additions & 1 deletion src/components/chat/Chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,25 @@ export const Chat: React.FC<ChatProps> = ({
}
}

return chatItems2;
// Deduplicate messages by messageId, keeping only the latest (last) occurrence
const seen = new Set<string>();
const deduplicated: ChatItem[] = [];
for (let i = chatItems2.length - 1; i >= 0; i--) {
const item = chatItems2[i];
if ("messageId" in item) {
// It's a Message
if (!seen.has(item.messageId)) {
seen.add(item.messageId);
deduplicated.unshift(item);
}
// Skip if already seen
} else {
// Non-message items (task-divider, tool-call, artifact) are always included
deduplicated.unshift(item);
}
}

return deduplicated;
}, [activeChatContext]);

const handleSendMessage = (message: string): void => {
Expand Down