Skip to content

Commit 9cec547

Browse files
authored
feat(ai-agents): add agent card tab and improve inspector UI (#2166)
* feat(ai-agents): add agent card tab and improve inspector UI - Add dedicated Agent Card tab to view and edit A2A discovery metadata - Add context ID display with copy button in chat header - Fix CopyButton hover animation causing visual shift - Add StringArrayInput component for editing tag arrays - Remove agent card config from create page (requires stepper UI) Agent card configuration on create will be added later with a proper multi-step form wizard to handle the complexity. * fix(frontend): address Biome linting violations in agent UI components Fix multiple linting issues in agent chat and inspector components: - Remove unnecessary fragment wrapper in context ID header - Fix className ordering violations (Biome enforces alphabetical order) - Move useState hooks to component top level before early returns (React rules) - Replace nested ternary with explicit if-else for dialog content states - Fix potential leaked render by using Boolean() instead of && The hook placement fix prevents potential bugs where React would lose state tracking across renders. The nested ternary refactor improves readability without changing behavior. * fix(ai-agents): point A2A SDK examples to main branch Replace hardcoded commit SHA with refs/heads/main now that the SDK examples PR is merged. The code snippets are fetched from the how-to-connect-code-snippets repository for display in the Agent Card tab. * fix(frontend): address PR review feedback - Use Redpanda UI Button component in StringArrayInput instead of raw button element for consistent styling and behavior - Import Fingerprint icon from components/icons barrel file instead of directly from lucide-react to follow project conventions - Add sanitizeSkill() helper function to centralize skill data transformation instead of inline trimming in handleSave
1 parent 408c24f commit 9cec547

File tree

9 files changed

+1021
-16
lines changed

9 files changed

+1021
-16
lines changed

frontend/src/components/icons/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export {
5353
Eye as EyeIcon, // IoMdEye, EyeIcon (Heroicons)
5454
EyeOff as EyeOffIcon, // IoMdEyeOff, MdOutlineVisibilityOff, EyeOffIcon (Heroicons), EyeClosedIcon (Octicons)
5555
Filter as FilterIcon, // FilterIcon (Heroicons)
56+
Fingerprint as FingerprintIcon, // Fingerprint icon for context IDs
5657
Flame as FlameIcon, // MdLocalFireDepartment
5758
HelpCircle as HelpIcon, // MdHelpOutline, MdOutlineQuestionMark
5859
Home as HomeIcon, // HomeIcon (Heroicons)

frontend/src/components/pages/agents/details/a2a/chat/ai-agent-chat.tsx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
import { Conversation, ConversationContent, ConversationEmptyState } from 'components/ai-elements/conversation';
1515
import { Loader } from 'components/ai-elements/loader';
16+
import { FingerprintIcon } from 'components/icons';
17+
import { Badge } from 'components/redpanda-ui/components/badge';
18+
import { CopyButton } from 'components/redpanda-ui/components/copy-button';
1619
import { useCallback, useEffect, useRef } from 'react';
1720

1821
import { ChatInput } from './components/chat-input';
@@ -22,7 +25,7 @@ import { useChatMessages } from './hooks/use-chat-messages';
2225
import { useCumulativeUsage } from './hooks/use-cumulative-usage';
2326
import type { AIAgentChatProps } from './types';
2427

25-
export const AIAgentChat = ({ agent }: AIAgentChatProps) => {
28+
export const AIAgentChat = ({ agent, headerActions }: AIAgentChatProps) => {
2629
const textareaRef = useRef<HTMLTextAreaElement>(null);
2730
const containerRef = useRef<HTMLDivElement>(null);
2831

@@ -86,10 +89,27 @@ export const AIAgentChat = ({ agent }: AIAgentChatProps) => {
8689
<div className="flex h-[calc(100vh-210px)] flex-col" ref={containerRef}>
8790
{/* Context ID header */}
8891
{Boolean(contextId) && (
89-
<div className="shrink-0 border-b bg-muted/30 px-4 py-2">
90-
<div className="flex gap-1.5 text-muted-foreground text-xs">
91-
<span className="font-medium">context_id:</span>
92-
<span className="font-mono">{contextId}</span>
92+
<div className="shrink-0 border-b bg-gradient-to-r from-muted/50 to-muted/30 px-4 py-1.5">
93+
<div className="flex items-center justify-between gap-4">
94+
<div className="flex items-center gap-2">
95+
<div className="flex h-5 w-5 items-center justify-center rounded bg-primary/10">
96+
<FingerprintIcon className="h-3 w-3 text-primary" />
97+
</div>
98+
<div className="flex items-center gap-1.5">
99+
<span className="font-medium text-muted-foreground text-xs uppercase tracking-wide">Context ID</span>
100+
<Badge className="font-mono text-xs" variant="outline">
101+
{contextId}
102+
</Badge>
103+
<CopyButton
104+
className="h-6 min-h-6 w-6 min-w-6 shrink-0 p-0"
105+
content={contextId}
106+
size="icon"
107+
variant="ghost"
108+
whileHover={{ scale: 1 }}
109+
/>
110+
</div>
111+
</div>
112+
{headerActions}
93113
</div>
94114
</div>
95115
)}

frontend/src/components/pages/agents/details/a2a/chat/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,5 @@ export type ChatMessage = {
9999

100100
export type AIAgentChatProps = {
101101
agent: AIAgent;
102+
headerActions?: React.ReactNode;
102103
};

0 commit comments

Comments
 (0)