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.

508 B
Raw Blame
import { AGENT_CHAT_URL } from '@lobechat/const';
import { useCallback } from 'react';

import { useQueryRoute } from '@/hooks/useQueryRoute';
import { useChatStore } from '@/store/chat';

export const useNavigateToAgent = () => {
  const clearPortalStack = useChatStore((s) => s.clearPortalStack);
  const router = useQueryRoute();

  return useCallback(
    (agentId: string) => {
      clearPortalStack();

      router.push(AGENT_CHAT_URL(agentId, false));
    },
    [clearPortalStack, router],
  );
};