🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
import DragUploadZone, { useUploadFiles } from '@/components/DragUploadZone';
import { type ActionKeys } from '@/features/ChatInput';
import {
ChatInput,
ChatList,
conversationSelectors,
useConversationStore,
} from '@/features/Conversation';
import { usePermission } from '@/hooks/usePermission';
import { useAgentStore } from '@/store/agent';
import { agentByIdSelectors } from '@/store/agent/selectors';
import AgentBuilderWelcome from './AgentBuilderWelcome';
import { useResolveFeedbackOnSend } from './SuggestionChips/useResolveFeedbackOnSend';
import TopicSelector from './TopicSelector';
interface AgentBuilderConversationProps {
agentId: string;
}
const actions: ActionKeys[] = [];
const rightActions: ActionKeys[] = ['model'];
/**
* Agent Builder Conversation Component
* Displays the chat interface for configuring the agent via conversation
*/
const AgentBuilderConversation = memo<AgentBuilderConversationProps>(({ agentId }) => {
// Get agent's model info for vision support check
const model = useAgentStore((s) => agentByIdSelectors.getAgentModelById(agentId)(s));
const provider = useAgentStore((s) => agentByIdSelectors.getAgentModelProviderById(agentId)(s));
const composerKey = useConversationStore(conversationSelectors.composerKey);
const { handleUploadFiles } = useUploadFiles({
agentId,
contextKey: composerKey,
model,
provider,
});
const { allowed: canCreate } = usePermission('create_content');
// Resolve usage_in_followup / manual_edit feedback when a suggestion-seeded
// message is sent (no-op for normal sends).
useResolveFeedbackOnSend();
return (
<DragUploadZone
disabled={!canCreate}
style={{ flex: 1, height: '100%' }}
onUploadFiles={handleUploadFiles}
>
<Flexbox flex={1} height={'100%'}>
<TopicSelector agentId={agentId} disabled={!canCreate} />
<Flexbox flex={1} style={{ overflow: 'hidden' }}>
<ChatList welcome={<AgentBuilderWelcome disabled={!canCreate} />} />
</Flexbox>
<ChatInput leftActions={actions} rightActions={rightActions} showControlBar={false} />
</Flexbox>
</DragUploadZone>
);
});
export default AgentBuilderConversation;