fix(agents): simplify copy dropdown with agent-specific options
- Remove MCP server options from agent copy dropdown - Add: Agent UID, Chat URL (with random convo ID), cURL command - Fix dropdown styling with proper sizing and monospace fonts
This commit is contained in:
parent
f943e8e685
commit
2f02f0f412
1 changed files with 22 additions and 34 deletions
|
|
@ -63,23 +63,23 @@ export function CopyDropdown({
|
|||
</Button>
|
||||
|
||||
{isOpen && (
|
||||
<div className="absolute right-0 top-full mt-1 w-56 bg-background border border-border rounded-lg shadow-lg py-1 z-50">
|
||||
<div className="absolute right-0 top-full mt-1 min-w-[280px] bg-background border border-border rounded-lg shadow-lg py-1 z-50">
|
||||
{options.map((option) => (
|
||||
<Button
|
||||
<button
|
||||
type="button"
|
||||
key={option.label}
|
||||
variant="ghost"
|
||||
onClick={() => handleCopy(option)}
|
||||
className="w-full px-3 py-2 h-auto text-left justify-start hover:bg-surface"
|
||||
className="w-full px-3 py-2 text-left hover:bg-surface-secondary transition-colors"
|
||||
>
|
||||
<div className="flex flex-col items-start">
|
||||
<div className="font-medium text-foreground">{option.label}</div>
|
||||
{option.description && (
|
||||
<div className="text-xs text-foreground-tertiary truncate max-w-full">
|
||||
{option.description}
|
||||
</div>
|
||||
)}
|
||||
<div className="font-mono text-xs font-medium text-foreground lowercase">
|
||||
{option.label}
|
||||
</div>
|
||||
</Button>
|
||||
{option.description && (
|
||||
<div className="text-[10px] text-foreground-tertiary font-mono mt-0.5 truncate">
|
||||
{option.description}
|
||||
</div>
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
|
@ -125,33 +125,21 @@ export function getCollectionCopyOptions(
|
|||
export function getAgentCopyOptions(
|
||||
username: string,
|
||||
agentUid: string,
|
||||
agentName: string
|
||||
_agentName: string
|
||||
): CopyOption[] {
|
||||
const baseUrl = 'https://tpmjs.com';
|
||||
const mcpUrlHttp = `${baseUrl}/api/mcp/${username}/${agentUid}/http`;
|
||||
const mcpUrlSse = `${baseUrl}/api/mcp/${username}/${agentUid}/sse`;
|
||||
// Generate a random conversation ID
|
||||
const randomConvoId = `conv-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
||||
const chatUrl = `${baseUrl}/${username}/agents/${agentUid}/chat/${randomConvoId}`;
|
||||
|
||||
const claudeConfig = JSON.stringify(
|
||||
{
|
||||
mcpServers: {
|
||||
[agentName.toLowerCase().replace(/\s+/g, '-')]: {
|
||||
command: 'npx',
|
||||
args: ['-y', '@anthropic-ai/mcp-remote', mcpUrlSse],
|
||||
},
|
||||
},
|
||||
},
|
||||
null,
|
||||
2
|
||||
);
|
||||
const curlCommand = `curl -X POST "${baseUrl}/api/chat/${username}/${agentUid}/conversation/${randomConvoId}" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-H "Authorization: Bearer YOUR_TPMJS_API_KEY" \\
|
||||
-d '{"message": "Hello!"}'`;
|
||||
|
||||
return [
|
||||
{ label: 'Agent UID', value: agentUid, description: agentUid },
|
||||
{ label: 'MCP URL (HTTP)', value: mcpUrlHttp, description: mcpUrlHttp },
|
||||
{ label: 'MCP URL (SSE)', value: mcpUrlSse, description: mcpUrlSse },
|
||||
{
|
||||
label: 'Claude Config',
|
||||
value: claudeConfig,
|
||||
description: 'JSON for claude_desktop_config.json',
|
||||
},
|
||||
{ label: 'Chat URL', value: chatUrl, description: chatUrl },
|
||||
{ label: 'cURL', value: curlCommand, description: 'Send a message via API' },
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue