From 3fd8003bcfce10bb38f39ce3d53b9ecc5da721e8 Mon Sep 17 00:00:00 2001 From: akhisud3195 Date: Fri, 11 Jul 2025 19:37:17 +0530 Subject: [PATCH] Add go to RAG CTA when no RAG sources in agent --- .../[projectId]/entities/agent_config.tsx | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx index bbdc40b4..a62722a4 100644 --- a/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx +++ b/apps/rowboat/app/projects/[projectId]/entities/agent_config.tsx @@ -3,7 +3,7 @@ import { WithStringId } from "../../../lib/types/types"; import { WorkflowPrompt, WorkflowAgent, Workflow, WorkflowTool } from "../../../lib/types/workflow_types"; import { DataSource } from "../../../lib/types/datasource_types"; import { z } from "zod"; -import { PlusIcon, Sparkles, X as XIcon, ChevronDown, ChevronRight, Trash2, Maximize2, Minimize2, StarIcon } from "lucide-react"; +import { PlusIcon, Sparkles, X as XIcon, ChevronDown, ChevronRight, Trash2, Maximize2, Minimize2, StarIcon, DatabaseIcon } from "lucide-react"; import { useState, useEffect, useRef } from "react"; import { usePreviewModal } from "../workflow/preview-modal"; import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter, Select, SelectItem, Chip, SelectSection } from "@heroui/react"; @@ -23,6 +23,7 @@ import { Info } from "lucide-react"; import { useCopilot } from "../copilot/use-copilot"; import { BillingUpgradeModal } from "@/components/common/billing-upgrade-modal"; import { ModelsResponse } from "@/app/lib/types/billing_types"; +import { useRouter } from "next/navigation"; // Common section header styles const sectionHeaderStyles = "block text-xs font-medium uppercase tracking-wider text-gray-500 dark:text-gray-400"; @@ -75,6 +76,7 @@ export function AgentConfig({ const [showRagCta, setShowRagCta] = useState(false); const [previousRagSources, setPreviousRagSources] = useState([]); const [billingError, setBillingError] = useState(null); + const router = useRouter(); const { start: startCopilotChat, @@ -644,12 +646,38 @@ export function AgentConfig({ > {dataSources .filter((ds) => !(agent.ragDataSources || []).includes(ds._id)) - .map((ds) => ( - - {ds.name} - - )) - } + .length > 0 ? ( + dataSources + .filter((ds) => !(agent.ragDataSources || []).includes(ds._id)) + .map((ds) => ( + + {ds.name} + + )) + ) : ( + +
+
+ +
+
+ No data sources available +
+ { + e.preventDefault(); + e.stopPropagation(); + router.push(`/projects/${projectId}/sources`); + }} + startContent={} + > + Go to RAG Sources + +
+
+ )} {showRagCta && (