Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

1.2 KB
Raw Blame
import { ManagedMcpAppView } from '@/features/MCPApp/ManagedMcpAppView';
import type { McpAppViewProps } from '@/features/MCPApp/McpAppView';
import { useMcpAppIdentity } from '@/features/MCPApp/useMcpAppIdentity';
import { mcpAppAgentIdSelector } from '@/features/MCPApp/viewAgent';
import { messageMapKey } from '@/store/chat/utils/messageMapKey';

import { useConversationStore } from '../../../../../store';

export const InlineMcpAppView = (
  props: Omit<McpAppViewProps, 'host'> & { preferred?: 'inline' | 'fullscreen' },
) => {
  const agentId = useConversationStore(mcpAppAgentIdSelector(props.messageId));
  const [title, icon] = useMcpAppIdentity(props.identifier, agentId);
  const canSendMessage = useConversationStore((s) => s.composerTarget.writable);
  const sendMessage = useConversationStore((s) => s.sendMessage);
  const scope = useConversationStore((s) => messageMapKey(s.context));
  const topicId = useConversationStore((s) => s.context.topicId ?? undefined);
  return (
    <ManagedMcpAppView
      {...props}
      host={{ agentId, canSendMessage, sendMessage, topicId }}
      icon={icon}
      location={'inline'}
      scope={scope}
      title={title}
    />
  );
};