OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
add run mode enum controls (#2204)
Mike Fortmancf5fb9e0056d
diff --git a/frontend/contexts/auth-context.tsx b/frontend/contexts/auth-context.tsxindex 1fb6d64cb..937bae8b1 100644--- a/frontend/contexts/auth-context.tsx+++ b/frontend/contexts/auth-context.tsx@@ -9,6 +9,7 @@ import React, {useState,} from "react";import { hasRbacPermission } from "@/lib/brand";+import type { RunMode } from "@/lib/constants";import { encodeBase64 } from "@/lib/utils";interface User {@@ -28,7 +29,7 @@ interface AuthContextType {isAuthenticated: boolean;isNoAuthMode: boolean;isIbmAuthMode: boolean;- runMode: string | null;+ runMode: RunMode | null;version: string | null;permissions: Set<string>;roles: string[];@@ -78,7 +79,7 @@ export function AuthProvider({ children }: AuthProviderProps) {const [isNoAuthMode, setIsNoAuthMode] = useState(false);const [isIbmAuthMode, setIsIbmAuthMode] = useState(false);const [version, setVersion] = useState<string | null>(null);- const [runMode, setRunMode] = useState<string | null>(null);+ const [runMode, setRunMode] = useState<RunMode | null>(null);const checkAuth = useCallback(async () => {setIsLoading(true);diff --git a/frontend/lib/constants.ts b/frontend/lib/constants.tsindex 1dc9b2316..21b2b707b 100644--- a/frontend/lib/constants.ts+++ b/frontend/lib/constants.ts@@ -1,3 +1,11 @@+export const RUN_MODE = {+ OSS: "oss",+ SAAS: "saas",+ ON_PREM: "on_prem",+} as const;++export type RunMode = (typeof RUN_MODE)[keyof typeof RUN_MODE];+/*** Default agent settings*/diff --git a/frontend/lib/url-utils.ts b/frontend/lib/url-utils.tsindex aa5c23026..8c3f90801 100644--- a/frontend/lib/url-utils.ts+++ b/frontend/lib/url-utils.ts@@ -1,3 +1,5 @@+import { RUN_MODE, type RunMode } from "@/lib/constants";+export interface LangflowEditUrlParams {/** Flow ID to open directly (e.g. settings.ingest_flow_id). */flowId?: string | null;@@ -9,8 +11,8 @@ export interface LangflowEditUrlParams {langflowPort?: number | string | null;/** Whether the deployment is in IBM auth mode. */isIbmAuthMode: boolean;- /** Backend run mode ("oss" | "saas" | "on_prem"), used to pick the IBM URL derivation. */- runMode: string | null;+ /** Backend run mode, used to pick the IBM URL derivation. */+ runMode: RunMode | null;/** Current origin; defaults to window.location.origin in the browser. */locationOrigin?: string;}@@ -35,7 +37,7 @@ export function resolveLangflowEditUrl({}: LangflowEditUrlParams): string {const ibmLangflowUrl =isIbmAuthMode && locationOrigin- ? runMode === "on_prem"+ ? runMode === RUN_MODE.ON_PREM? deriveOnPremLangflowUrl(locationOrigin): deriveCloudLangflowUrl(locationOrigin): null;