Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

Merge branch 'main' of github.com:langflow-ai/openrag into biome

Mike Fortman07a502690c67
diff --cc frontend/app/settings/_components/card-icon.tsx
index 000000000,90e2bb380..6f532b29d
mode 000000,100644..100644
--- a/frontend/app/settings/_components/card-icon.tsx
+++ b/frontend/app/settings/_components/card-icon.tsx
@@@ -1,0 -1,20 +1,26 @@@
+ import { cn } from "@/lib/utils";
+
+ interface CardIconProps {
- isActive: boolean;
- activeBgColor: string;
- children: React.ReactNode;
++ isActive: boolean;
++ activeBgColor: string;
++ children: React.ReactNode;
+ }
+
-export default function CardIcon({ isActive, activeBgColor, children }: CardIconProps) {
- return (
- <div
- className={cn(
- "w-8 h-8 rounded flex items-center justify-center border",
- isActive ? activeBgColor : "bg-muted grayscale group-hover:bg-background",
- )}
- >
- {children}
- </div>
- );
++export default function CardIcon({
++ isActive,
++ activeBgColor,
++ children,
++}: CardIconProps) {
++ return (
++ <div
++ className={cn(
++ "w-8 h-8 rounded flex items-center justify-center border",
++ isActive
++ ? activeBgColor
++ : "bg-muted grayscale group-hover:bg-background",
++ )}
++ >
++ {children}
++ </div>
++ );
+ }
diff --cc frontend/app/settings/_components/connector-card.tsx
index dad0cea59,49d0eb4ea..aa132d99d
--- a/frontend/app/settings/_components/connector-card.tsx
+++ b/frontend/app/settings/_components/connector-card.tsx
@@@ -1,25 -1,25 +1,25 @@@
"use client";
+import { Loader2, Plus, RefreshCcw, Trash2 } from "lucide-react";
+import Link from "next/link";
import { Button } from "@/components/ui/button";
import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
} from "@/components/ui/card";
- import { cn } from "@/lib/utils";
-import { Loader2, Plus, RefreshCcw, Trash2 } from "lucide-react";
-import Link from "next/link";
+ import CardIcon from "./card-icon";
export interface Connector {
- id: string;
- name: string;
- type: string;
- icon: React.ReactNode;
- available?: boolean;
- status?: string;
- connectionId?: string;
+ id: string;
+ name: string;
+ type: string;
+ icon: React.ReactNode;
+ available?: boolean;
+ status?: string;
+ connectionId?: string;
}
interface ConnectorCardProps {
@@@ -32,129 -32,125 +32,127 @@@
}
export default function ConnectorCard({
- connector,
- isConnecting,
- isDisconnecting,
- onConnect,
- onDisconnect,
- onNavigateToKnowledge,
+ connector,
+ isConnecting,
+ isDisconnecting,
+ onConnect,
+ onDisconnect,
+ onNavigateToKnowledge,
}: ConnectorCardProps) {
- console.log(connector)
- const isConnected = connector?.name === "Google Drive" || connector?.status === "connected" && connector?.connectionId;
+ console.log(connector);
+ const isConnected =
+ connector?.name === "Google Drive" ||
+ (connector?.status === "connected" && connector?.connectionId);
- return (
- <Card className="group relative flex flex-col hover:bg-secondary-hover hover:border-muted-foreground transition-colors">
- <CardHeader className="pb-2">
- <div className="flex flex-col items-start justify-between">
- <div className="flex flex-col gap-4 mb-2 w-full">
- <div className="flex items-center justify-between mb-1">
- <CardIcon
- isActive={!!(connector?.available && isConnected)}
- activeBgColor="bg-white"
- >
- {connector.icon}
- </CardIcon>
- {isConnected ? (
- <div className="flex items-center gap-1.5 rounded-full bg-foreground px-2.5 py-1 text-xs font-medium text-muted">
- <span className="h-2 w-2 rounded-full bg-green-500" />
- Active
- </div>
- ) : null}
- </div>
- <div>
- <CardTitle className="flex flex-row items-center">
- {connector.name}
- </CardTitle>
- <CardDescription className="text-sm">
- {connector?.available
- ? `${connector.name} is configured.`
- : "Not configured."}
- </CardDescription>
- </div>
- </div>
+ return (
+ <Card className="group relative flex flex-col hover:bg-secondary-hover hover:border-muted-foreground transition-colors">
+ <CardHeader className="pb-2">
+ <div className="flex flex-col items-start justify-between">
+ <div className="flex flex-col gap-4 mb-2 w-full">
+ <div className="flex items-center justify-between mb-1">
- <div
- className={cn(
- "w-8 h-8 rounded flex items-center justify-center border",
- connector?.available ? "bg-white" : "bg-muted grayscale",
- )}
++ <CardIcon
++ isActive={!!(connector?.available && isConnected)}
++ activeBgColor="bg-white"
+ >
+ {connector.icon}
- </div>
++ </CardIcon>
+ {isConnected ? (
+ <div className="flex items-center gap-1.5 rounded-full bg-foreground px-2.5 py-1 text-xs font-medium text-muted">
+ <span className="h-2 w-2 rounded-full bg-green-500" />
+ Active
</div>
- </CardHeader>
- <CardContent className="flex-1 flex flex-col justify-end space-y-4">
- {connector?.available ? (
- <div className="space-y-3">
- {isConnected ? (
- <div className="flex gap-2 overflow-hidden w-full">
- <Button
- variant="default"
- onClick={() => onNavigateToKnowledge(connector)}
- disabled={isDisconnecting || isConnecting}
- className="cursor-pointer !text-sm truncate rounded-md"
- size="md"
- >
- <Plus className="h-4 w-4" />
- <span className="text-mmd truncate">Add Knowledge</span>
- </Button>
- <Button
- variant="outline"
- onClick={() => onConnect(connector)}
- disabled={isConnecting || isDisconnecting}
- className="cursor-pointer"
- size="iconMd"
- >
- {isConnecting ? (
- <RefreshCcw className="h-4 w-4 animate-spin" />
- ) : (
- <RefreshCcw className="h-4 w-4" />
- )}
- </Button>
- <Button
- variant="outline"
- onClick={() => onDisconnect(connector)}
- disabled={isDisconnecting || isConnecting}
- className="cursor-pointer text-destructive hover:text-destructive"
- size="iconMd"
- >
- {isDisconnecting ? (
- <Loader2 className="h-4 w-4 animate-spin" />
- ) : (
- <Trash2 className="h-4 w-4" />
- )}
- </Button>
- </div>
- ) : (
- <Button
- onClick={() => onConnect(connector)}
- disabled={isConnecting}
- className="w-full cursor-pointer group-hover:bg-background group-hover:border-zinc-700 group-hover:text-primary"
- size="sm"
- >
- {isConnecting ? (
- <>
- <Loader2 className="h-4 w-4 animate-spin" />
- Connecting...
- </>
- ) : (
- <>Connect</>
- )}
- </Button>
- )}
- </div>
+ ) : null}
+ </div>
+ <div>
+ <CardTitle className="flex flex-row items-center">
+ {connector.name}
+ </CardTitle>
+ <CardDescription className="text-sm">
+ {connector?.available
+ ? `${connector.name} is configured.`
+ : "Not configured."}
+ </CardDescription>
+ </div>
+ </div>
+ </div>
+ </CardHeader>
+ <CardContent className="flex-1 flex flex-col justify-end space-y-4">
+ {connector?.available ? (
+ <div className="space-y-3">
+ {isConnected ? (
+ <div className="flex gap-2 overflow-hidden w-full">
+ <Button
+ variant="default"
+ onClick={() => onNavigateToKnowledge(connector)}
+ disabled={isDisconnecting || isConnecting}
+ className="cursor-pointer !text-sm truncate rounded-md"
+ size="md"
+ >
+ <Plus className="h-4 w-4" />
+ <span className="text-mmd truncate">Add Knowledge</span>
+ </Button>
+ <Button
+ variant="outline"
+ onClick={() => onConnect(connector)}
+ disabled={isConnecting || isDisconnecting}
+ className="cursor-pointer"
+ size="iconMd"
+ >
+ {isConnecting ? (
+ <RefreshCcw className="h-4 w-4 animate-spin" />
+ ) : (
+ <RefreshCcw className="h-4 w-4" />
+ )}
+ </Button>
+ <Button
+ variant="outline"
+ onClick={() => onDisconnect(connector)}
+ disabled={isDisconnecting || isConnecting}
+ className="cursor-pointer text-destructive hover:text-destructive"
+ size="iconMd"
+ >
+ {isDisconnecting ? (
+ <Loader2 className="h-4 w-4 animate-spin" />
+ ) : (
+ <Trash2 className="h-4 w-4" />
+ )}
+ </Button>
+ </div>
+ ) : (
+ <Button
+ onClick={() => onConnect(connector)}
+ disabled={isConnecting}
+ className="w-full cursor-pointer group-hover:bg-background group-hover:border-zinc-700 group-hover:text-primary"
+ size="sm"
+ >
+ {isConnecting ? (
+ <>
+ <Loader2 className="h-4 w-4 animate-spin" />
+ Connecting...
+ </>
) : (
- <div className="text-sm text-muted-foreground">
- <p>
- See our{" "}
- <Link
- className="text-accent-pink-foreground"
- href="https://docs.openr.ag/knowledge#oauth-ingestion"
- target="_blank"
- rel="noopener noreferrer"
- >
- Cloud Connectors installation guide
- </Link>{" "}
- for more detail.
- </p>
- </div>
+ <>Connect</>
)}
- </CardContent>
- </Card>
- );
+ </Button>
+ )}
+ </div>
+ ) : (
+ <div className="text-sm text-muted-foreground">
+ <p>
+ See our{" "}
+ <Link
+ className="text-accent-pink-foreground"
+ href="https://docs.openr.ag/knowledge#oauth-ingestion"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ Cloud Connectors installation guide
+ </Link>{" "}
+ for more detail.
+ </p>
+ </div>
+ )}
+ </CardContent>
+ </Card>
+ );
}
diff --cc frontend/app/settings/_components/model-provider-card.tsx
index 000000000,b5897ead4..8495fe9a9
mode 000000,100644..100644
--- a/frontend/app/settings/_components/model-provider-card.tsx
+++ b/frontend/app/settings/_components/model-provider-card.tsx
@@@ -1,0 -1,81 +1,77 @@@
+ "use client";
+
+ import { Button } from "@/components/ui/button";
+ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
+ import { cn } from "@/lib/utils";
+ import type { ModelProvider } from "../_helpers/model-helpers";
+ import CardIcon from "./card-icon";
+
+ export interface ModelProviderCardData {
- providerKey: ModelProvider;
- name: string;
- logo: (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;
- logoColor: string;
- logoBgColor: string;
++ providerKey: ModelProvider;
++ name: string;
++ logo: (props: React.SVGProps<SVGSVGElement>) => React.ReactNode;
++ logoColor: string;
++ logoBgColor: string;
+ }
+
+ interface ModelProviderCardProps {
- provider: ModelProviderCardData;
- isConfigured: boolean;
- isUnhealthy: boolean;
- onConfigure: (providerKey: ModelProvider) => void;
++ provider: ModelProviderCardData;
++ isConfigured: boolean;
++ isUnhealthy: boolean;
++ onConfigure: (providerKey: ModelProvider) => void;
+ }
+
+ export default function ModelProviderCard({
- provider,
- isConfigured,
- isUnhealthy,
- onConfigure,
++ provider,
++ isConfigured,
++ isUnhealthy,
++ onConfigure,
+ }: ModelProviderCardProps) {
- const { providerKey, name, logo: Logo, logoColor, logoBgColor } = provider;
++ const { providerKey, name, logo: Logo, logoColor, logoBgColor } = provider;
+
- return (
- <Card
- className={cn(
- "group relative flex flex-col hover:bg-secondary-hover hover:border-muted-foreground transition-colors",
- !isConfigured && "text-muted-foreground",
- isUnhealthy && "border-destructive",
- )}
++ return (
++ <Card
++ className={cn(
++ "group relative flex flex-col hover:bg-secondary-hover hover:border-muted-foreground transition-colors",
++ !isConfigured && "text-muted-foreground",
++ isUnhealthy && "border-destructive",
++ )}
++ >
++ <CardHeader>
++ <div className="flex flex-col items-start justify-between">
++ <div className="flex flex-col gap-3">
++ <div className="mb-1">
++ <CardIcon isActive={isConfigured} activeBgColor={logoBgColor}>
++ <Logo
++ className={isConfigured ? logoColor : "text-muted-foreground"}
++ />
++ </CardIcon>
++ </div>
++ <CardTitle className="flex flex-row items-center gap-2">
++ {name}
++ {isUnhealthy && (
++ <span className="h-2 w-2 rounded-full bg-destructive" />
++ )}
++ </CardTitle>
++ </div>
++ </div>
++ </CardHeader>
++ <CardContent className="flex-1 flex flex-col justify-end space-y-4">
++ <Button
++ className={cn(
++ "group-hover:bg-background",
++ isConfigured && "border-primary",
++ )}
++ variant={isUnhealthy ? "default" : "outline"}
++ onClick={() => onConfigure(providerKey)}
+ >
- <CardHeader>
- <div className="flex flex-col items-start justify-between">
- <div className="flex flex-col gap-3">
- <div className="mb-1">
- <CardIcon
- isActive={isConfigured}
- activeBgColor={logoBgColor}
- >
- <Logo
- className={
- isConfigured
- ? logoColor
- : "text-muted-foreground"
- }
- />
- </CardIcon>
- </div>
- <CardTitle className="flex flex-row items-center gap-2">
- {name}
- {isUnhealthy && (
- <span className="h-2 w-2 rounded-full bg-destructive" />
- )}
- </CardTitle>
- </div>
- </div>
- </CardHeader>
- <CardContent className="flex-1 flex flex-col justify-end space-y-4">
- <Button
- className={cn("group-hover:bg-background", isConfigured && "border-primary")}
- variant={isUnhealthy ? "default" : "outline"}
- onClick={() => onConfigure(providerKey)}
- >
- {isUnhealthy
- ? "Fix Setup"
- : isConfigured
- ? "Edit Setup"
- : "Configure"}
- </Button>
- </CardContent>
- </Card>
- );
++ {isUnhealthy
++ ? "Fix Setup"
++ : isConfigured
++ ? "Edit Setup"
++ : "Configure"}
++ </Button>
++ </CardContent>
++ </Card>
++ );
+ }