From cbac042003e5f92d332499e98fb5a19a738d656c Mon Sep 17 00:00:00 2001 From: ramnique <30795890+ramnique@users.noreply.github.com> Date: Mon, 10 Mar 2025 12:03:06 +0530 Subject: [PATCH] Update feature flags + env docs --- .env.example | 28 +++++- .../rowboat/app/actions/datasource_actions.ts | 4 +- apps/rowboat/app/actions/project_actions.ts | 1 + apps/rowboat/app/lib/feature_flags.ts | 4 + .../app/projects/[projectId]/config/app.tsx | 4 +- .../app/projects/[projectId]/config/page.tsx | 5 +- .../app/projects/[projectId]/layout.tsx | 5 +- .../rowboat/app/projects/[projectId]/menu.tsx | 6 +- apps/rowboat/app/projects/[projectId]/nav.tsx | 8 +- .../[projectId]/playground/messages.tsx | 14 +-- .../projects/[projectId]/sources/new/form.tsx | 87 ++--------------- .../projects/[projectId]/sources/new/page.tsx | 11 ++- .../[projectId]/workflow/agent_config.tsx | 9 +- .../app/projects/[projectId]/workflow/app.tsx | 4 +- .../projects/[projectId]/workflow/page.tsx | 4 + .../[projectId]/workflow/workflow_editor.tsx | 3 + apps/rowboat/app/scripts/rag_files_worker.ts | 10 +- apps/rowboat/app/scripts/rag_urls_worker.ts | 28 +----- apps/rowboat/scripts.Dockerfile | 46 +++++++++ docker-compose.yml | 97 +++++++++++++------ 20 files changed, 210 insertions(+), 168 deletions(-) create mode 100644 apps/rowboat/app/lib/feature_flags.ts create mode 100644 apps/rowboat/scripts.Dockerfile diff --git a/.env.example b/.env.example index 8351ad5b..cce09ad6 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,31 @@ +# Basic configuration +# ------------------------------------------------------------ +MONGODB_CONNECTION_STRING=mongodb://127.0.0.1:27017/rowboat OPENAI_API_KEY= -MONGODB_CONNECTION_STRING= AUTH0_SECRET= AUTH0_BASE_URL=http://localhost:3000 AUTH0_ISSUER_BASE_URL= AUTH0_CLIENT_ID= AUTH0_CLIENT_SECRET= -COPILOT_API_KEY=test -AGENTS_API_KEY=test \ No newline at end of file + +# Uncomment to enable RAG: +# ------------------------------------------------------------ +# USE_RAG=true + +# Uncomment to enable RAG: File uploads +# ------------------------------------------------------------ +# USE_RAG_UPLOADS=true +# AWS_ACCESS_KEY_ID= +# AWS_SECRET_ACCESS_KEY= +# RAG_UPLOADS_S3_BUCKET= +# RAG_UPLOADS_S3_REGION= + +# Uncomment to enable RAG: Scraping URLs +# ------------------------------------------------------------ +# USE_RAG_SCRAPING=true +# FIRECRAWL_API_KEY= + +# Uncomment to enable chat widget +# ------------------------------------------------------------ +# USE_CHAT_WIDGET=true +# CHAT_WIDGET_SESSION_JWT_SECRET= \ No newline at end of file diff --git a/apps/rowboat/app/actions/datasource_actions.ts b/apps/rowboat/app/actions/datasource_actions.ts index b9159c96..806e1709 100644 --- a/apps/rowboat/app/actions/datasource_actions.ts +++ b/apps/rowboat/app/actions/datasource_actions.ts @@ -294,7 +294,7 @@ export async function getDownloadUrlForFile( } const command = new GetObjectCommand({ - Bucket: process.env.UPLOADS_S3_BUCKET, + Bucket: process.env.RAG_UPLOADS_S3_BUCKET, Key: file.data.s3Key, }); @@ -328,7 +328,7 @@ export async function getUploadUrlsForFilesDataSource( const s3Key = `datasources/files/${projectIdPrefix}/${projectId}/${sourceId}/${fileId}/${file.name}`; // Generate presigned URL const command = new PutObjectCommand({ - Bucket: process.env.UPLOADS_S3_BUCKET, + Bucket: process.env.RAG_UPLOADS_S3_BUCKET, Key: s3Key, ContentType: file.type, }); diff --git a/apps/rowboat/app/actions/project_actions.ts b/apps/rowboat/app/actions/project_actions.ts index 163501cf..b7a1762f 100644 --- a/apps/rowboat/app/actions/project_actions.ts +++ b/apps/rowboat/app/actions/project_actions.ts @@ -53,6 +53,7 @@ export async function createProject(formData: FormData) { secret, nextWorkflowNumber: 1, testRunCounter: 0, + webhookUrl: 'http://tools_webhook:3005/tool_call', }); // add first workflow version diff --git a/apps/rowboat/app/lib/feature_flags.ts b/apps/rowboat/app/lib/feature_flags.ts new file mode 100644 index 00000000..bb48726e --- /dev/null +++ b/apps/rowboat/app/lib/feature_flags.ts @@ -0,0 +1,4 @@ +export const USE_RAG = process.env.USE_RAG === 'true'; +export const USE_RAG_UPLOADS = process.env.USE_RAG_UPLOADS === 'true'; +export const USE_RAG_SCRAPING = process.env.USE_RAG_SCRAPING === 'true'; +export const USE_CHAT_WIDGET = process.env.USE_CHAT_WIDGET === 'true'; \ No newline at end of file diff --git a/apps/rowboat/app/projects/[projectId]/config/app.tsx b/apps/rowboat/app/projects/[projectId]/config/app.tsx index 4b094658..cb4944c6 100644 --- a/apps/rowboat/app/projects/[projectId]/config/app.tsx +++ b/apps/rowboat/app/projects/[projectId]/config/app.tsx @@ -569,9 +569,11 @@ export function DeleteProjectSection({ export default function App({ projectId, + useChatWidget, chatWidgetHost, }: { projectId: string; + useChatWidget: boolean; chatWidgetHost: string; }) { return
@@ -586,7 +588,7 @@ export default function App({ - + {useChatWidget && }
diff --git a/apps/rowboat/app/projects/[projectId]/config/page.tsx b/apps/rowboat/app/projects/[projectId]/config/page.tsx index e0ee6cfc..a0577fc3 100644 --- a/apps/rowboat/app/projects/[projectId]/config/page.tsx +++ b/apps/rowboat/app/projects/[projectId]/config/page.tsx @@ -1,5 +1,7 @@ import { Metadata } from "next"; import App from "./app"; +import { USE_CHAT_WIDGET } from "@/app/lib/feature_flags"; + export const metadata: Metadata = { title: "Project config", }; @@ -13,6 +15,7 @@ export default function Page({ }) { return ; } \ No newline at end of file diff --git a/apps/rowboat/app/projects/[projectId]/layout.tsx b/apps/rowboat/app/projects/[projectId]/layout.tsx index 21c9fbfb..c871c175 100644 --- a/apps/rowboat/app/projects/[projectId]/layout.tsx +++ b/apps/rowboat/app/projects/[projectId]/layout.tsx @@ -1,4 +1,5 @@ import { Nav } from "./nav"; +import { USE_RAG } from "@/app/lib/feature_flags"; export default async function Layout({ params, @@ -7,10 +8,10 @@ export default async function Layout({ params: { projectId: string } children: React.ReactNode }) { - const useDataSources = process.env.USE_DATA_SOURCES === 'true'; + const useRag = USE_RAG; return
-
; } \ No newline at end of file diff --git a/apps/rowboat/app/projects/[projectId]/playground/messages.tsx b/apps/rowboat/app/projects/[projectId]/playground/messages.tsx index 7c2418cc..5b3c6045 100644 --- a/apps/rowboat/app/projects/[projectId]/playground/messages.tsx +++ b/apps/rowboat/app/projects/[projectId]/playground/messages.tsx @@ -186,26 +186,28 @@ function ToolCall({ sender={sender} />; } - if (matchingWorkflowTool && testProfile && !testProfile.mockTools) { - return ; } - return ; } } diff --git a/apps/rowboat/app/projects/[projectId]/sources/new/form.tsx b/apps/rowboat/app/projects/[projectId]/sources/new/form.tsx index 39601e32..0c12e83b 100644 --- a/apps/rowboat/app/projects/[projectId]/sources/new/form.tsx +++ b/apps/rowboat/app/projects/[projectId]/sources/new/form.tsx @@ -8,27 +8,17 @@ import { PlusIcon } from "lucide-react"; import { useRouter } from "next/navigation"; export function Form({ - projectId + projectId, + useRagUploads, + useRagScraping, }: { projectId: string; + useRagUploads: boolean; + useRagScraping: boolean; }) { const [sourceType, setSourceType] = useState(""); const router = useRouter(); - // async function createCrawlDataSource(formData: FormData) { - // const source = await createDataSource({ - // projectId, - // name: formData.get('name') as string, - // data: { - // type: 'crawl', - // startUrl: formData.get('startUrl') as string, - // limit: parseInt(formData.get('limit') as string), - // }, - // status: 'queued', - // }); - // router.push(`/projects/${projectId}/sources/${source._id}`); - // } - async function createUrlsDataSource(formData: FormData) { const source = await createDataSource({ projectId, @@ -80,14 +70,11 @@ export function Form({ label="Select type" selectedKeys={[sourceType]} onChange={handleSourceTypeChange} + disabledKeys={[ + ...(useRagUploads ? [] : ['files']), + ...(useRagScraping ? [] : ['urls']), + ]} > - {/* } - > - Crawl URLs - */} } @@ -102,62 +89,6 @@ export function Form({ - {/* {sourceType === "crawl" &&
- -
- -
-
- -
-
-

Note:

-
    -
  • Expect about 5-10 minutes to crawl 100 pages
  • -
-
-