OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
first pass at chat view: Ross K
rossdkiser379b7fc0d71b
diff --git a/frontend/app/chat/_components/assistant-message.tsx b/frontend/app/chat/_components/assistant-message.tsxindex f2d717dfa..a08f86661 100644--- a/frontend/app/chat/_components/assistant-message.tsx+++ b/frontend/app/chat/_components/assistant-message.tsx@@ -2,6 +2,7 @@ import { GitBranch } from "lucide-react";import { motion } from "motion/react";import DogIcon from "@/components/icons/dog-icon";import { MarkdownRenderer } from "@/components/markdown-renderer";+import { useIsCloudBrand } from "@/contexts/brand-context";import { cn } from "@/lib/utils";import type {FunctionCall,@@ -44,6 +45,8 @@ export function AssistantMessage({isInitialGreeting = false,usage,}: AssistantMessageProps) {+ const isCloudBrand = useIsCloudBrand();+return (<motion.divinitial={animate ? { opacity: 0, y: -20 } : { opacity: 1, y: 0 }}@@ -82,6 +85,11 @@ export function AssistantMessage({<DogIconclassName="h-6 w-6 transition-colors duration-300"disabled={isCompleted || isInactive}+ disabledFill={+ isCloudBrand && (isCompleted || isInactive)+ ? "#525252"+ : undefined+ }/></motion.div></div>diff --git a/frontend/app/chat/_components/chat-input.tsx b/frontend/app/chat/_components/chat-input.tsxindex a52678186..d92c02f63 100644--- a/frontend/app/chat/_components/chat-input.tsx+++ b/frontend/app/chat/_components/chat-input.tsx@@ -22,6 +22,7 @@ import {PopoverAnchor,PopoverContent,} from "@/components/ui/popover";+import { useIsCloudBrand } from "@/contexts/brand-context";import { useFileDrag } from "@/hooks/use-file-drag";import { cn } from "@/lib/utils";import { useGetAllFiltersQuery } from "../../api/queries/useGetAllFiltersQuery";@@ -78,6 +79,7 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(const [isWrapped, setIsWrapped] = useState(false);const isMultiline = input.includes("\n") || isWrapped;const isDragging = useFileDrag();+ const isCloudBrand = useIsCloudBrand();// Internal state for filter dropdownconst [isFilterDropdownOpen, setIsFilterDropdownOpen] = useState(false);@@ -356,9 +358,15 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(<div{...getRootProps()}className={cn(- "flex flex-col w-full p-2 rounded-xl border border-input transition-all",+ "flex flex-col w-full p-2 rounded-xl border transition-all",+ isCloudBrand+ ? "border-[color:var(--chat-input-border)]"+ : "border-input",+ isCloudBrand ? "bg-[var(--chat-prompt-bg)]" : "bg-transparent",!isDragging &&- "hover:[&:not(:focus-within)]:border-muted-foreground focus-within:border-foreground",+ (isCloudBrand+ ? "hover:[&:not(:focus-within)]:border-muted-foreground focus-within:border-[color:var(--chat-input-border)]"+ : "hover:[&:not(:focus-within)]:border-muted-foreground focus-within:border-foreground"),isDragging && "border-dashed",)}>@@ -426,7 +434,12 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(type="button"variant="ghost"size="iconSm"- className="h-8 w-8 p-0 rounded-md hover:bg-muted/50"+ className={cn(+ "h-8 w-8 p-0 rounded-md",+ isCloudBrand+ ? "hover:bg-[var(--layered-select-bg)]"+ : "hover:bg-muted/50",+ )}onMouseDown={(e) => {e.preventDefault();}}@@ -472,7 +485,12 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(type="button"variant="ghost"size="iconSm"- className="h-8 w-8 p-0 rounded-md hover:bg-muted/50"+ className={cn(+ "h-8 w-8 p-0 rounded-md",+ isCloudBrand+ ? "hover:bg-[var(--layered-select-bg)]"+ : "hover:bg-muted/50",+ )}onMouseDown={(e) => {e.preventDefault();}}@@ -489,7 +507,12 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(size="iconSm"onClick={onFilePickerClick}disabled={isUploading}- className="h-8 w-8 p-0 !rounded-md hover:bg-muted/50"+ className={cn(+ "h-8 w-8 p-0 !rounded-md",+ isCloudBrand+ ? "hover:bg-[var(--layered-select-bg)]"+ : "hover:bg-muted/50",+ )}><Plus className="h-4 w-4" /></Button>@@ -567,9 +590,16 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(<buttontype="button"onClick={() => handleFilterSelect(null)}- className={`w-full text-left px-2 py-2 text-sm rounded hover:bg-muted/50 flex items-center justify-between ${- selectedFilterIndex === -1 ? "bg-muted/50" : ""- }`}+ className={cn(+ "w-full text-left px-2 py-2 text-sm rounded flex items-center justify-between",+ isCloudBrand+ ? "hover:bg-[var(--layered-select-bg)]"+ : "hover:bg-muted/50",+ selectedFilterIndex === -1 &&+ (isCloudBrand+ ? "bg-[var(--layered-select-bg)]"+ : "bg-muted/50"),+ )}><span>No knowledge filter</span>{!selectedFilter && (@@ -582,9 +612,16 @@ export const ChatInput = forwardRef<ChatInputHandle, ChatInputProps>(key={filter.id}type="button"onClick={() => handleFilterSelect(filter)}- className={`w-full overflow-hidden text-left px-2 py-2 gap-2 text-sm rounded hover:bg-muted/50 flex items-center justify-between ${- index === selectedFilterIndex ? "bg-muted/50" : ""- }`}+ className={cn(+ "w-full overflow-hidden text-left px-2 py-2 gap-2 text-sm rounded flex items-center justify-between",+ isCloudBrand+ ? "hover:bg-[var(--layered-select-bg)]"+ : "hover:bg-muted/50",+ index === selectedFilterIndex &&+ (isCloudBrand+ ? "bg-[var(--layered-select-bg)]"+ : "bg-muted/50"),+ )}><div className="overflow-hidden"><div className="font-medium truncate">diff --git a/frontend/app/chat/_components/nudges.tsx b/frontend/app/chat/_components/nudges.tsxindex 3528e47db..22174ad7b 100644--- a/frontend/app/chat/_components/nudges.tsx+++ b/frontend/app/chat/_components/nudges.tsx@@ -1,4 +1,7 @@+"use client";+import { AnimatePresence, motion } from "motion/react";+import { useIsCloudBrand } from "@/contexts/brand-context";import { cn } from "@/lib/utils";export default function Nudges({@@ -10,6 +13,8 @@ export default function Nudges({onboarding?: boolean;handleSuggestionClick: (suggestion: string) => void;}) {+ const isCloudBrand = useIsCloudBrand();+return (<div className="flex-shrink-0 h-12 w-full overflow-hidden"><AnimatePresence>@@ -31,10 +36,10 @@ export default function Nudges({key={index}onClick={() => handleSuggestionClick(suggestion)}className={cn(- onboarding+ onboarding || isCloudBrand? "text-foreground": "text-placeholder-foreground hover:text-foreground",- "bg-background border hover:bg-background/50 px-2 py-1.5 rounded-lg text-sm transition-colors whitespace-nowrap",+ "ibm-chat-bubble bg-background border hover:bg-background/50 px-2 py-1.5 rounded-lg text-sm transition-colors whitespace-nowrap",)}>{suggestion}diff --git a/frontend/app/chat/page.tsx b/frontend/app/chat/page.tsxindex 54d482dbd..c5bb60a4f 100644--- a/frontend/app/chat/page.tsx+++ b/frontend/app/chat/page.tsx@@ -5,11 +5,13 @@ import { useEffect, useMemo, useRef, useState } from "react";import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";import { ProtectedRoute } from "@/components/protected-route";import { Button } from "@/components/ui/button";+import { useIsCloudBrand } from "@/contexts/brand-context";import { type EndpointType, useChat } from "@/contexts/chat-context";import { useTask } from "@/contexts/task-context";import { useChatStreaming } from "@/hooks/useChatStreaming";import { FILE_CONFIRMATION, FILES_REGEX } from "@/lib/constants";import { buildSearchPayloadFilters } from "@/lib/filter-normalization";+import { cn } from "@/lib/utils";import { useLoadingStore } from "@/stores/loadingStore";import { useGetConversationsQuery } from "../api/queries/useGetConversationsQuery";import { useGetNudgesQuery } from "../api/queries/useGetNudgesQuery";@@ -29,6 +31,7 @@ import type {function ChatPage() {const isDebugMode = process.env.NEXT_PUBLIC_OPENRAG_DEBUG === "true";+ const isCloudBrand = useIsCloudBrand();const {endpoint,setEndpoint,@@ -1039,7 +1042,9 @@ function ChatPage() {</div>)}- <StickToBottom.Content className="flex flex-col min-h-full overflow-x-hidden p-6">+ <StickToBottom.Content+ className={cn("flex flex-col min-h-full overflow-x-hidden p-6")}+ ><div className="flex flex-col place-self-center space-y-6 max-w-content w-full mx-auto">{messages.length === 0 && !streamingMessage ? (<div className="flex items-center justify-center h-full text-muted-foreground">@@ -1223,9 +1228,16 @@ function ChatPage() {}export default function ProtectedChatPage() {+ const isCloudBrand = useIsCloudBrand();return (<ProtectedRoute>- <div className="flex w-full h-full overflow-hidden">+ <div+ className={cn(+ "flex w-full h-full overflow-hidden",+ isCloudBrand &&+ "bg-[var(--chat-surface-bg)] [background-image:linear-gradient(0deg,var(--chat-surface-gradient),transparent_280px)]",+ )}+ ><StickToBottomclassName="flex h-full flex-1 flex-col"resize="smooth"diff --git a/frontend/app/globals.css b/frontend/app/globals.cssindex a30af3a12..3d92b053e 100644--- a/frontend/app/globals.css+++ b/frontend/app/globals.css@@ -30,6 +30,12 @@--ring: 0 0% 0%;--placeholder-foreground: 240 5% 65%;+ /* App-level UI tokens (safe defaults, override per brand/theme) */+ --layered-select-bg: hsl(var(--muted) / 0.5);+ --chat-surface-gradient: rgba(69, 137, 255, 0.16);+ --chat-input-border: hsl(var(--input));+ --icon-disabled: #71717a;+--accent-amber: 48 96% 89%; /* amber-100 #fef3c7 */--accent-amber-foreground: 26 90% 37%; /* amber-700 #b45309 */--brand-amber: 37 100% 50%; /* amber-500 #FE9A00 */@@ -94,6 +100,12 @@--ring: 0 0% 100%;--placeholder-foreground: 240 4% 46%;+ /* App-level UI tokens (safe defaults, override per brand/theme) */+ --layered-select-bg: hsl(var(--muted) / 0.5);+ --chat-surface-gradient: rgba(69, 137, 255, 0.16);+ --chat-input-border: hsl(var(--input));+ --icon-disabled: #71717a;+--accent-amber: 22 78% 26%; /* amber-900 #78350f */--accent-amber-foreground: 46 97% 65%; /* amber-300 #fcd34d */--brand-amber: 37 100% 50%; /* amber-500 #FE9A00 */@@ -143,7 +155,9 @@--border: 240 5% 96%; /* same as --muted from :root (240 5% 96%) */--input: 0 0% 82%;--ring: 217 100% 45%;- --placeholder-foreground: 0 0% 56%; /* IBM Gray 50 #8d8d8d */+ --placeholder-foreground: var(+ --input+ ); /* placeholder uses shadcn input token */--accent-amber: 39 100% 88%;--accent-amber-foreground: 26 90% 37%;@@ -168,6 +182,11 @@--radius: 0rem; /* IBM uses sharp corners */+ /* Chat (IBM) */+ --chat-surface-bg: hsl(var(--background));+ --chat-surface-border: hsl(var(--muted));+ --chat-prompt-bg: hsl(var(--background));+--sidebar-background: 0 0% 90%; /* IBM Gray 20 */--sidebar-foreground: 0 0% 15%;--sidebar-primary: 217 100% 45%;@@ -176,19 +195,24 @@--sidebar-accent-foreground: 0 0% 15%;--sidebar-border: 0 0% 82%;--sidebar-ring: 217 100% 45%;++ /* IBM-only UI tokens */+ --layered-select-bg: rgba(131, 131, 131, 0.24);+ --chat-input-border: #f4f4f4;+ --icon-disabled: #525252;}/* IBM Dark */[data-theme="ibm"].dark {- --background: 0 0% 9%; /* IBM Gray 100 #161616 */+ --background: 0 0% 8.6%; /* IBM Gray 100 #161616 */--foreground: 0 0% 97%; /* IBM Gray 10 #f4f4f4 */--card: 0 0% 12%; /* IBM Gray 90 #1c1c1c → ~#262626 */--card-foreground: 0 0% 97%;--popover: 0 0% 12%;--popover-foreground: 0 0% 97%;- --primary: 217 100% 62%; /* IBM Blue 40 #4589ff */+ --primary: 217 100% 45%; /* IBM Blue 60 #0f62fe */--primary-foreground: 0 0% 9%;- --primary-hover: 217 100% 72%; /* IBM Blue 30 #78a9ff */+ --primary-hover: 217 100% 35%; /* IBM Blue 70 #0043ce */--secondary: 0 0% 12%;--secondary-foreground: 0 0% 97%;--secondary-hover: 0 0% 18%; /* IBM Gray 80 #393939 */@@ -196,10 +220,12 @@--muted-foreground: 0 0% 32%; /* IBM Gray 70 #525252 - Secondary text IBM */--accent: 0 0% 18%;--accent-foreground: 0 0% 97%;- --border: 0 0% 22%; /* IBM Gray 80 #393939 - Ui-border 3 */+ --border: 0 0% 22.4%; /* IBM Gray 80 #393939 - Ui-border 3 */--input: 0 0% 26%;--ring: 217 100% 62%;- --placeholder-foreground: 0 0% 38%; /* IBM Gray 60 */+ --placeholder-foreground: var(+ --input+ ); /* placeholder uses shadcn input token */--accent-amber: 22 78% 26%;--accent-amber-foreground: 46 97% 65%;@@ -224,6 +250,11 @@--radius: 0rem;+ /* Chat (IBM) */+ --chat-surface-bg: hsl(var(--background));+ --chat-surface-border: #393939;+ --chat-prompt-bg: #161616;+--sidebar-background: 0 0% 12%;--sidebar-foreground: 0 0% 97%;--sidebar-primary: 217 100% 62%;@@ -232,6 +263,20 @@--sidebar-accent-foreground: 0 0% 97%;--sidebar-border: 0 0% 26%;--sidebar-ring: 217 100% 62%;++ /* IBM-only UI tokens */+ --layered-select-bg: rgba(131, 131, 131, 0.24);+ --chat-input-border: #262626;+ --icon-disabled: #525252;+ }++ /* IBM chat nudges / quick actions */+ [data-theme="ibm"] .ibm-chat-bubble {+ border-color: var(--chat-surface-border);+ }++ [data-theme="ibm"].dark .ibm-chat-bubble {+ background-color: #262626;}* {diff --git a/frontend/components/header.tsx b/frontend/components/header.tsxindex 29407bd35..dfaa3a1ed 100644--- a/frontend/components/header.tsx+++ b/frontend/components/header.tsx@@ -4,10 +4,12 @@ import { Bell } from "lucide-react";import { BrandSwitcher } from "@/components/brand-switcher";import Logo from "@/components/icons/openrag-logo";import { UserNav } from "@/components/user-nav";+import { useIsCloudBrand } from "@/contexts/brand-context";import { useTask } from "@/contexts/task-context";import { cn } from "@/lib/utils";export function Header() {+ const isCloudBrand = useIsCloudBrand();const { tasks, toggleMenu } = useTask();// Calculate active tasks for the bell icon@@ -57,7 +59,12 @@ export function Header() {data-testid="task-menu-toggle"className="relative h-8 w-8 hover:bg-muted rounded-lg flex items-center justify-center">- <Bell size={16} className="text-muted-foreground" />+ <Bell+ size={16}+ className={+ isCloudBrand ? "text-foreground" : "text-muted-foreground"+ }+ />{activeTasks.length > 0 && <div className="header-notifications" />}</button>diff --git a/frontend/components/icons/dog-icon.tsx b/frontend/components/icons/dog-icon.tsxindex 541561bb0..20004e8c5 100644--- a/frontend/components/icons/dog-icon.tsx+++ b/frontend/components/icons/dog-icon.tsx@@ -1,9 +1,17 @@interface DogIconProps extends React.SVGProps<SVGSVGElement> {disabled?: boolean;+ disabledFill?: string;}-const DogIcon = ({ disabled = false, stroke, ...props }: DogIconProps) => {- const fillColor = disabled ? "#71717A" : stroke || "#773EFF";+const DogIcon = ({+ disabled = false,+ disabledFill,+ stroke,+ ...props+}: DogIconProps) => {+ const fillColor = disabled+ ? (disabledFill ?? "#71717A")+ : stroke || "#773EFF";// CSS for the stepped animation statesconst animationCSS = `diff --git a/frontend/components/layout-wrapper.tsx b/frontend/components/layout-wrapper.tsxindex 1882f4661..0e27824fd 100644--- a/frontend/components/layout-wrapper.tsx+++ b/frontend/components/layout-wrapper.tsx@@ -16,6 +16,7 @@ import {} from "@/components/provider-health-banner";import { TaskNotificationMenu } from "@/components/task-notification-menu";import { useAuth } from "@/contexts/auth-context";+import { useIsCloudBrand } from "@/contexts/brand-context";import { useChat } from "@/contexts/chat-context";import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context";import { useTask } from "@/contexts/task-context";@@ -31,6 +32,7 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) {const pathname = usePathname();const router = useRouter();const { tasks, isMenuOpen } = useTask();+ const isCloudBrand = useIsCloudBrand();const { isPanelOpen, panelMode, closePanelOnly } = useKnowledgeFilter();const failedTasks = tasks.filter(isFailureLikeTask);@@ -88,7 +90,12 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) {isMenuOpen || (isPanelOpen && isOnKnowledgePage && !isMenuOpen);return (- <div className="h-screen w-screen flex flex-col bg-muted dark:bg-black relative">+ <div+ className={cn(+ "h-screen w-screen flex flex-col relative",+ isCloudBrand ? "bg-background" : "bg-muted dark:bg-black",+ )}+ >{/* Banner — full width */}<div className="w-full z-10 bg-background"><AnimatedConditionaldiff --git a/frontend/components/navigation.tsx b/frontend/components/navigation.tsxindex f25b7cfc0..5ba58e758 100644--- a/frontend/components/navigation.tsx+++ b/frontend/components/navigation.tsx@@ -20,6 +20,7 @@ import {DropdownMenuItem,DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";+import { useIsCloudBrand } from "@/contexts/brand-context";import { type EndpointType, useChat } from "@/contexts/chat-context";import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context";import { FILES_REGEX } from "@/lib/constants";@@ -74,6 +75,7 @@ export function Navigation({isConversationsLoading = false,onNewConversation,}: NavigationProps = {}) {+ const isCloudBrand = useIsCloudBrand();const pathname = usePathname();const {endpoint,@@ -318,19 +320,28 @@ export function Navigation({<Linkhref={route.href}className={cn(- "text-[13px] group flex p-3 w-full justify-start font-medium cursor-pointer hover:bg-accent hover:text-accent-foreground rounded-lg transition-all",- route.active- ? "bg-accent text-accent-foreground shadow-sm"- : "text-foreground hover:text-accent-foreground",+ "text-[13px] group flex p-3 w-full justify-start font-medium cursor-pointer transition-all",+ isCloudBrand+ ? route.active+ ? "border-l-[3px] border-l-primary bg-[var(--layered-select-bg)] text-foreground rounded-r-lg"+ : "border-l-[3px] border-l-transparent text-foreground hover:bg-accent hover:text-accent-foreground rounded-lg"+ : cn(+ "hover:bg-accent hover:text-accent-foreground rounded-lg",+ route.active+ ? "bg-accent text-accent-foreground shadow-sm"+ : "text-foreground hover:text-accent-foreground",+ ),)}><div className="flex items-center flex-1"><route.iconclassName={cn("h-[18px] w-[18px] mr-2 shrink-0",- route.active- ? "text-muted-foreground"- : "text-muted-foreground group-hover:text-muted-foreground",+ isCloudBrand+ ? "text-foreground"+ : route.active+ ? "text-muted-foreground"+ : "text-muted-foreground group-hover:text-muted-foreground",)}/>{route.label}@@ -367,7 +378,12 @@ export function Navigation({title="Start new conversation"disabled={loading}>- <Plus className="h-4 w-4 text-muted-foreground" />+ <Plus+ className={cn(+ "h-4 w-4",+ isCloudBrand ? "text-foreground" : "text-muted-foreground",+ )}+ /></button></div></div>diff --git a/frontend/components/user-nav.tsx b/frontend/components/user-nav.tsxindex 19a983600..3f38b307b 100644--- a/frontend/components/user-nav.tsx+++ b/frontend/components/user-nav.tsx@@ -11,9 +11,12 @@ import {DropdownMenuTrigger,} from "@/components/ui/dropdown-menu";import { useAuth } from "@/contexts/auth-context";+import { useIsCloudBrand } from "@/contexts/brand-context";+import { cn } from "@/lib/utils";import ThemeButtons from "./theme-switcher-buttons";export function UserNav() {+ const isCloudBrand = useIsCloudBrand();const { user, isLoading, isAuthenticated, isNoAuthMode, login, logout } =useAuth();const { theme, setTheme } = useTheme();@@ -31,9 +34,19 @@ export function UserNav() {className="flex justify-center items-center gap-2 h-8 w-8 mr-2 rounded-md hover:bg-muted rounded-lg ">{theme === "dark" ? (- <Sun size={16} className="text-muted-foreground" />+ <Sun+ size={16}+ className={+ isCloudBrand ? "text-foreground" : "text-muted-foreground"+ }+ />) : (- <Moon size={16} className="text-muted-foreground" />+ <Moon+ size={16}+ className={+ isCloudBrand ? "text-foreground" : "text-muted-foreground"+ }+ />)}</button>);@@ -74,7 +87,13 @@ export function UserNav() {)}</AvatarFallback></Avatar>- <ChevronsUpDown size={16} className="text-muted-foreground mx-2" />+ <ChevronsUpDown+ size={16}+ className={cn(+ "mx-2",+ isCloudBrand ? "text-foreground" : "text-muted-foreground",+ )}+ /></button></DropdownMenuTrigger><DropdownMenuContent className="w-56 p-0" align="end" forceMount>@@ -97,7 +116,12 @@ export function UserNav() {onClick={logout}className="flex items-center hover:bg-muted w-full h-9 px-3">- <LogOut className="mr-2 h-4 w-4 text-muted-foreground" />+ <LogOut+ className={cn(+ "mr-2 h-4 w-4",+ isCloudBrand ? "text-foreground" : "text-muted-foreground",+ )}+ /><span className="text-sm">Logout</span></button></DropdownMenuContent>