OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.
Python
adding search tool bar
Mrunal Salunke6314904112e3
diff --cc frontend/app/globals.cssindex b05af9a93,1d71c8ca0..4eeba0d10--- a/frontend/app/globals.css+++ b/frontend/app/globals.css@@@ -22,19 -22,19 +22,22 @@@--secondary-foreground: 240 4% 16%;--secondary-hover: 240 6% 90%;--muted: 240 5% 96%;-- --muted-foreground: 240 4% 46%;++ /* --muted-foreground: 240 4% 46%; */--accent: 240 5% 96%;--accent-foreground: 0 0% 0%;--border: 240 4.8% 95.9%;--input: 240 6% 90%;--ring: 0 0% 0%;--placeholder-foreground: 240 5% 65%;++ --placeholder: 0 0% 44%; /* #6F6F6F *//* 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;++ --icon-primary: #f4f4f4;++ --icon-secondary: #c6c6c6;--accent-amber: 48 96% 89%; /* amber-100 #fef3c7 */--accent-amber-foreground: 26 90% 37%; /* amber-700 #b45309 */@@@ -92,13 -92,13 +95,14 @@@--secondary-foreground: 240 6% 90%;--secondary-hover: 240 4% 16%;--muted: 240 4% 16%;-- --muted-foreground: 240 5% 65%;++ /* --muted-foreground: 240 5% 65%; */--accent: 240 4% 16%;--accent-foreground: 0 0% 100%;--border: 240 3.7% 15.9%;--input: 240 5% 34%;--ring: 0 0% 100%;--placeholder-foreground: 240 4% 46%;++ --placeholder: 0 0% 44%; /* #6F6F6F *//* App-level UI tokens (safe defaults, override per brand/theme) */--layered-select-bg: hsl(var(--muted) / 0.5);@@@ -291,18 -299,42 +295,53 @@@color: hsl(var(--link-primary));}+ [data-theme="ibm"] .ibm-settings-page a[href]:hover {+ text-decoration: underline;+ text-underline-offset: 2px;++ --layer-contextual: 0 0% 15%;++ --layer-contextual-foreground: 0 0% 95.7%;++ --text-text-01: 0 0% 95.7%;++ --link-primary: 217 100% 74%;++ --button-tertiary: 217 100% 74%;+ }+- /* IBM chat nudges / quick actions */- [data-theme="ibm"] .ibm-chat-bubble {- border-color: var(--chat-surface-border);++ /* IBM Settings: section titles (productive heading-04); beats CardTitle utilities */++ [data-theme="ibm"] .ibm-section-title {++ color: hsl(var(--text-text-01));++ font-family: inherit;++ font-size: 28px !important;++ font-weight: 400 !important;++ line-height: 36px !important;++ font-style: normal;++ letter-spacing: 0;+ }+- [data-theme="ibm"].dark .ibm-chat-bubble {- background-color: #262626;++ .text-placeholder {++ color: hsl(var(--placeholder));++ font-family: inherit;++ font-size: 14px;++ font-weight: 400;++ line-height: 18px;++ letter-spacing: 0.16px;+ }+- /*- * IBM chat page only: body copy #000 (light) / #fff (dark) via tokens.- * Scoped so OSS and non-chat IBM surfaces keep existing --foreground.- */- [data-theme="ibm"] .ibm-chat-page {- --ibm-chat-text: 0 0% 0%;- --foreground: var(--ibm-chat-text);- --muted-foreground: var(--ibm-chat-text);++ /* IBM Settings: inline links (Link/link-primary) */++ [data-theme="ibm"] .ibm-settings-page a[href] {++ color: hsl(var(--link-primary));+ }+- [data-theme="ibm"].dark .ibm-chat-page {- --ibm-chat-text: 0 0% 100%;- --foreground: var(--ibm-chat-text);- --muted-foreground: var(--ibm-chat-text);+ [data-theme="ibm"] .ibm-settings-page a[href]:hover {+ text-decoration: underline;+ text-underline-offset: 2px;}- [data-theme="ibm"] .ibm-chat-page .markdown.prose {- color: hsl(var(--ibm-chat-text));+ /* IBM chat nudges / quick actions */+ [data-theme="ibm"] .ibm-chat-bubble {+ border-color: var(--chat-surface-border);}- [data-theme="ibm"] .ibm-chat-page .markdown.prose a {- color: hsl(var(--primary));+ [data-theme="ibm"].dark .ibm-chat-bubble {+ background-color: #262626;}* {diff --cc frontend/app/knowledge/page.tsxindex ce4f15a74,9b88e855f..5bb7f1564--- a/frontend/app/knowledge/page.tsx+++ b/frontend/app/knowledge/page.tsx@@@ -22,6 -22,6 +22,7 @@@ import "@/components/AgGrid/registerAgGimport "@/components/AgGrid/agGridStyles.css";import { toast } from "sonner";import { KnowledgeActionsDropdown } from "@/components/knowledge-actions-dropdown";++import { KnowledgeSearchBar } from "@/components/knowledge-search-bar";import { KnowledgeSearchInput } from "@/components/knowledge-search-input";import { StatusBadge } from "@/components/ui/status-badge";import {@@@ -455,10 -451,10 +455,7 @@@ function SearchPage()if (showOpenragRefreshCue) {return (<div className="inline-flex items-center justify-center h-5 w-5">-- <RefreshCw-- className="h-4 w-4 text-primary animate-spin"-- aria-label="OpenRAG doc is refreshing"-- />++ <RefreshCw className="h-4 w-4 text-primary animate-spin" /></div>);}@@@ -606,12 -595,79 +603,60 @@@</div>{/* Search Input Area */}- <div className="flex-1 flex items-center flex-shrink-0 flex-wrap-reverse gap-3 mb-6">- <KnowledgeSearchInput />-- <Button- type="button"- variant="outline"- className="rounded-lg flex-shrink-0"- disabled={syncAllConnectorsMutation.isPending}- onClick={async () => {- try {- toast.info("Syncing all cloud connectors...");- const result = await syncAllConnectorsMutation.mutateAsync();- if (result.status === "no_files") {- toast.info(- result.message ||- "No cloud files to sync. Add files from cloud connectors first.",- );- } else if (- result.synced_connectors &&- result.synced_connectors.length > 0- ) {- toast.success(- `Sync started for ${result.synced_connectors.join(", ")}. Check task notifications for progress.`,- );- } else if (result.errors && result.errors.length > 0) {- toast.error("Some connectors failed to sync");- }- } catch (error) {- toast.error(- error instanceof Error- ? error.message- : "Failed to sync connectors",- );- }- }}- >- {syncAllConnectorsMutation.isPending ? (- <>- <RefreshCw className="h-4 w-4 mr-2 animate-spin" />- Syncing...- </>- ) : (- <>- <RefreshCw className="h-4 w-4 mr-2" />- Sync- </>- )}- </Button>- <Button- type="button"- variant="outline"- className="rounded-lg flex-shrink-0"- disabled={refreshOpenragDocsMutation.isPending}- onClick={async () => {- try {- toast.info("Refreshing OpenRAG docs...");- const result = await refreshOpenragDocsMutation.mutateAsync();- toast.success(result.message);- } catch (error) {- toast.error(- error instanceof Error- ? error.message- : "Failed to refresh OpenRAG docs",- );- }- }}- >- {refreshOpenragDocsMutation.isPending ? (- <>Refreshing docs...</>- ) : (- <>Fetch latest docs</>+ <div className="flex items-center gap-3 mb-6">+ <div className="flex-1 flex items-center gap-3">- <KnowledgeSearchInput />- <KnowledgeDropdown />++ <KnowledgeSearchBar />++ {/* <KnowledgeSearchInput />++ {isCloudBrand && (++ <Button++ type="button"++ variant="outline"++ className="flex-shrink-0"++ disabled={syncAllConnectorsMutation.isPending}++ onClick={async () => {++ try {++ toast.info("Syncing all cloud connectors...");++ const result =++ await syncAllConnectorsMutation.mutateAsync();++ if (result.status === "no_files") {++ toast.info(++ result.message ||++ "No cloud files to sync. Add files from cloud connectors first.",++ );++ } else if (++ result.synced_connectors &&++ result.synced_connectors.length > 0++ ) {++ toast.success(++ `Sync started for ${result.synced_connectors.join(", ")}. Check task notifications for progress.`,++ );++ } else if (result.errors && result.errors.length > 0) {++ toast.error("Some connectors failed to sync");++ }++ } catch (error) {++ toast.error(++ error instanceof Error++ ? error.message++ : "Failed to sync connectors",++ );++ }++ }}++ >++ {syncAllConnectorsMutation.isPending ? (++ <>++ <RefreshCw className="h-4 w-4 mr-2 animate-spin" />++ Syncing...++ </>++ ) : (++ <>++ <RefreshCw className="h-4 w-4" />++ </>++ )}++ </Button>+ )}- </Button>++ <KnowledgeDropdown /> */}+ </div>+{selectedRows.length > 0 && (<Buttontype="button"@@@ -622,77 -678,9 +667,81 @@@Delete</Button>)}-- <Button- type="button"- variant="outline"- className="rounded-lg flex-shrink-0"- disabled={syncAllConnectorsMutation.isPending}- onClick={async () => {- try {- toast.info("Syncing all cloud connectors...");- const result = await syncAllConnectorsMutation.mutateAsync();- if (result.status === "no_files") {- toast.info(- result.message ||- "No cloud files to sync. Add files from cloud connectors first.",- <div className="ml-auto">- <KnowledgeDropdown />- </div>++ {!isCloudBrand && (++ <Button++ type="button"++ variant="outline"++ className="rounded-lg flex-shrink-0"++ disabled={syncAllConnectorsMutation.isPending}++ onClick={async () => {++ try {++ toast.info("Syncing all cloud connectors...");++ const result = await syncAllConnectorsMutation.mutateAsync();++ if (result.status === "no_files") {++ toast.info(++ result.message ||++ "No cloud files to sync. Add files from cloud connectors first.",++ );++ } else if (++ result.synced_connectors &&++ result.synced_connectors.length > 0++ ) {++ toast.success(++ `Sync started for ${result.synced_connectors.join(", ")}. Check task notifications for progress.`,++ );++ } else if (result.errors && result.errors.length > 0) {++ toast.error("Some connectors failed to sync");++ }++ } catch (error) {++ toast.error(++ error instanceof Error++ ? error.message++ : "Failed to sync connectors",+ );- } else if (- result.synced_connectors &&- result.synced_connectors.length > 0- ) {- toast.success(- `Sync started for ${result.synced_connectors.join(", ")}. Check task notifications for progress.`,++ }++ }}++ >++ {syncAllConnectorsMutation.isPending ? (++ <>++ <RefreshCw className="h-4 w-4 mr-2 animate-spin" />++ Syncing...++ </>++ ) : (++ <>++ <RefreshCw className="h-4 w-4 mr-2" />++ Sync++ </>++ )}++ </Button>++ )}++++ {!isCloudBrand && (++ <Button++ type="button"++ variant="outline"++ className="rounded-lg flex-shrink-0"++ disabled={refreshOpenragDocsMutation.isPending}++ onClick={async () => {++ try {++ toast.info("Refreshing OpenRAG docs...");++ const result = await refreshOpenragDocsMutation.mutateAsync();++ toast.success(result.message);++ } catch (error) {++ toast.error(++ error instanceof Error++ ? error.message++ : "Failed to refresh OpenRAG docs",+ );- } else if (result.errors && result.errors.length > 0) {- toast.error("Some connectors failed to sync");+ }- } catch (error) {- toast.error(- error instanceof Error- ? error.message- : "Failed to sync connectors",- );- }- }}- >- {syncAllConnectorsMutation.isPending ? (- <>- <RefreshCw className="h-4 w-4 mr-2 animate-spin" />- Syncing...- </>- ) : (- <>- <RefreshCw className="h-4 w-4 mr-2" />- Sync- </>- )}- </Button>- <Button- type="button"- variant="outline"- className="rounded-lg flex-shrink-0"- disabled={refreshOpenragDocsMutation.isPending}- onClick={async () => {- try {- toast.info("Refreshing OpenRAG docs...");- const result = await refreshOpenragDocsMutation.mutateAsync();- toast.success(result.message);- } catch (error) {- toast.error(- error instanceof Error- ? error.message- : "Failed to refresh OpenRAG docs",- );- }- }}- >- {refreshOpenragDocsMutation.isPending ? (- <>Refreshing docs...</>- ) : (- <>Fetch latest docs</>- )}- </Button>++ }}++ >++ {refreshOpenragDocsMutation.isPending ? (++ <>Refreshing docs...</>++ ) : (++ <>Fetch latest docs</>++ )}++ </Button>++ )}</div><AgGridReactclassName="w-full overflow-auto"diff --cc frontend/app/settings/page.tsxindex 9ef69897b,eebc69663..0f5fe4290--- a/frontend/app/settings/page.tsx+++ b/frontend/app/settings/page.tsx@@@ -63,7 -65,14 +64,9 @@@ import { getModelLogo, type ModelProvidconst { MAX_SYSTEM_PROMPT_CHARS } = UI_CONSTANTS;-const ibmSettingsFont = IBM_Plex_Sans({- subsets: ["latin"],- weight: ["400", "500", "600", "700"],- display: "swap",-});-function KnowledgeSourcesPage() {+ const isCloudBrand = useIsCloudBrand();++const { isAuthenticated, isNoAuthMode } = useAuth();const { addTask, tasks } = useTask();const searchParams = useSearchParams();diff --cc frontend/components/knowledge-search-bar.tsxindex 000000000,000000000..c9bd509c1new file mode 100644--- /dev/null+++ b/frontend/components/knowledge-search-bar.tsx@@@ -1,0 -1,0 +1,171 @@@++import { ChevronDown, RefreshCw, RotateCcw, Search, X } from "lucide-react";++import {++ type ChangeEvent,++ type FormEvent,++ useCallback,++ useEffect,++ useState,++} from "react";++import { toast } from "sonner";++import { useSyncAllConnectors } from "@/app/api/mutations/useSyncConnector";++import { Button } from "@/components/ui/button";++import { useKnowledgeFilter } from "@/contexts/knowledge-filter-context";++import { cn } from "@/lib/utils";++import { filterAccentClasses } from "./knowledge-filter-panel";++++type KnowledgeSearchBarProps = {++ onAddKnowledge?: () => void;++ onAddKnowledgeMenuClick?: () => void;++ className?: string;++};++++export const KnowledgeSearchBar = ({++ onAddKnowledge,++ onAddKnowledgeMenuClick,++ className,++}: KnowledgeSearchBarProps) => {++ const {++ selectedFilter,++ setSelectedFilter,++ parsedFilterData,++ queryOverride,++ setQueryOverride,++ } = useKnowledgeFilter();++++ const [searchQueryInput, setSearchQueryInput] = useState(queryOverride || "");++++ const handleSearch = useCallback(++ (e?: FormEvent<HTMLFormElement>) => {++ if (e) e.preventDefault();++ setQueryOverride(searchQueryInput.trim());++ },++ [searchQueryInput, setQueryOverride],++ );++++ const handleReset = useCallback(() => {++ setSearchQueryInput("");++ setQueryOverride("");++ }, [setQueryOverride]);++++ useEffect(() => {++ setSearchQueryInput(queryOverride);++ }, [queryOverride]);++++ const syncAllConnectorsMutation = useSyncAllConnectors();++++ return (++ <form++ onSubmit={handleSearch}++ className={cn("relative flex w-full items-stretch", className)}++ >++ {!!selectedFilter?.name && (++ <div++ title={selectedFilter.name}++ className={cn(++ "absolute -top-3 left-0 z-10 flex h-8 max-w-[260px] items-center gap-2 rounded-md border border-primary/60 px-3 text-sm shadow-sm",++ filterAccentClasses[parsedFilterData?.color || "zinc"],++ )}++ >++ <span className="truncate font-medium">{selectedFilter.name}</span>++ <button++ type="button"++ aria-label="Remove filter"++ className="inline-flex h-4 w-4 flex-shrink-0 items-center justify-center opacity-80 transition-opacity hover:opacity-100"++ onClick={() => setSelectedFilter(null)}++ >++ <X className="h-3.5 w-3.5" />++ </button>++ </div>++ )}++++ <div className="flex h-12 w-full overflow-hidden border border-border bg-card">++ <div className="flex h-full flex-shrink-0 items-center justify-center">++ <Search++ className="h-4 w-4 m-4 text-[var(--icon-secondary)]"++ strokeWidth={1.75}++ />++ </div>++++ <div className="flex min-w-0 flex-1 items-center">++ <input++ id="search-query"++ name="search-query"++ type="text"++ placeholder="Search knowledge"++ value={searchQueryInput}++ onChange={(e: ChangeEvent<HTMLInputElement>) =>++ setSearchQueryInput(e.target.value)++ }++ className="h-full w-full bg-transparent text-sm text-[hsl(var(--placeholder))] placeholder:text-[hsl(var(--placeholder))]"++ />++ {searchQueryInput && (++ <button++ type="button"++ aria-label="Clear search"++ onClick={handleReset}++ className="mr-2 inline-flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"++ >++ <X className="h-4 w-4" />++ </button>++ )}++ </div>++ <Button++ type="button"++ variant="ghost"++ disabled={syncAllConnectorsMutation.isPending}++ size="icon"++ className="h-auto flex-shrink-0 rounded-none hover:bg-accent hover:text-foreground"++ aria-label="Sync"++ onClick={async () => {++ try {++ toast.info("Syncing all cloud connectors...");++ const result = await syncAllConnectorsMutation.mutateAsync();++ if (result.status === "no_files") {++ toast.info(++ result.message ||++ "No cloud files to sync. Add files from cloud connectors first.",++ );++ } else if (++ result.synced_connectors &&++ result.synced_connectors.length > 0++ ) {++ toast.success(++ `Sync started for ${result.synced_connectors.join(", ")}. Check task notifications for progress.`,++ );++ } else if (result.errors && result.errors.length > 0) {++ toast.error("Some connectors failed to sync");++ }++ } catch (error) {++ toast.error(++ error instanceof Error++ ? error.message++ : "Failed to sync connectors",++ );++ }++ }}++ >++ <RefreshCw className="h-4 w-4 m-4 text-[var(--icon-primary)]" />++ </Button>++++ <Button++ type="button"++ onClick={onAddKnowledge}++ className="h-auto rounded-none border-l border-border bg-blue-600 px-6 text-base font-medium text-white hover:bg-blue-700"++ >++ Add knowledge++ </Button>++++ <Button++ type="button"++ variant="default"++ size="icon"++ onClick={onAddKnowledgeMenuClick}++ className="h-auto w-16 flex-shrink-0 rounded-none border-l border-blue-500 bg-blue-600 text-white hover:bg-blue-700"++ aria-label="Open add knowledge menu"++ >++ <ChevronDown className="h-5 w-5" />++ </Button>++ </div>++ </form>++ );++};