Merge pull request #289 from langflow-ai/fix/provider-design
fix: adds new provider design, fixes issues with auth mode
This commit is contained in:
commit
883877b4e7
7 changed files with 343 additions and 359 deletions
|
|
@ -14,7 +14,7 @@ const AccordionItem = React.forwardRef<
|
||||||
>(({ className, ...props }, ref) => (
|
>(({ className, ...props }, ref) => (
|
||||||
<AccordionPrimitive.Item
|
<AccordionPrimitive.Item
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn("border rounded-md", className)}
|
className={cn("border rounded-xl", className)}
|
||||||
{...props}
|
{...props}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ const TabsList = React.forwardRef<
|
||||||
<TabsPrimitive.List
|
<TabsPrimitive.List
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex h-12 gap-3 items-center justify-center p-0 text-muted-foreground w-full",
|
"inline-flex h-fit gap-3 items-center justify-center p-0 text-muted-foreground w-full",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
@ -28,7 +28,7 @@ const TabsTrigger = React.forwardRef<
|
||||||
<TabsPrimitive.Trigger
|
<TabsPrimitive.Trigger
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={cn(
|
className={cn(
|
||||||
"inline-flex w-full h-full border border-border gap-1.5 items-center justify-center whitespace-nowrap rounded-lg px-3 py-1.5 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-accent-pink-foreground data-[state=active]:text-foreground",
|
"flex flex-col items-start justify-between p-5 gap-4 w-full h-full border border-border whitespace-nowrap rounded-lg text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-muted-foreground data-[state=active]:text-foreground",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
{...props}
|
{...props}
|
||||||
|
|
|
||||||
|
|
@ -75,20 +75,6 @@ export function AdvancedOnboarding({
|
||||||
/>
|
/>
|
||||||
</LabelWrapper>
|
</LabelWrapper>
|
||||||
)}
|
)}
|
||||||
{(hasLanguageModels || hasEmbeddingModels) && !updatedOnboarding && <Separator />}
|
|
||||||
{!updatedOnboarding && (
|
|
||||||
<LabelWrapper
|
|
||||||
label="Sample dataset"
|
|
||||||
description="Load sample data to chat with immediately."
|
|
||||||
id="sample-dataset"
|
|
||||||
flex
|
|
||||||
>
|
|
||||||
<Switch
|
|
||||||
checked={sampleDataset}
|
|
||||||
onCheckedChange={setSampleDataset}
|
|
||||||
/>
|
|
||||||
</LabelWrapper>
|
|
||||||
)}
|
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import type { OnboardingVariables } from "../../api/mutations/useOnboardingMutat
|
||||||
import { useGetOllamaModelsQuery } from "../../api/queries/useGetModelsQuery";
|
import { useGetOllamaModelsQuery } from "../../api/queries/useGetModelsQuery";
|
||||||
import { useModelSelection } from "../hooks/useModelSelection";
|
import { useModelSelection } from "../hooks/useModelSelection";
|
||||||
import { useUpdateSettings } from "../hooks/useUpdateSettings";
|
import { useUpdateSettings } from "../hooks/useUpdateSettings";
|
||||||
import { AdvancedOnboarding } from "./advanced";
|
|
||||||
import { ModelSelector } from "./model-selector";
|
import { ModelSelector } from "./model-selector";
|
||||||
|
|
||||||
export function OllamaOnboarding({
|
export function OllamaOnboarding({
|
||||||
|
|
@ -61,10 +60,6 @@ export function OllamaOnboarding({
|
||||||
};
|
};
|
||||||
}, [debouncedEndpoint, isLoadingModels]);
|
}, [debouncedEndpoint, isLoadingModels]);
|
||||||
|
|
||||||
const handleSampleDatasetChange = (dataset: boolean) => {
|
|
||||||
setSampleDataset(dataset);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Update settings when values change
|
// Update settings when values change
|
||||||
useUpdateSettings(
|
useUpdateSettings(
|
||||||
"ollama",
|
"ollama",
|
||||||
|
|
@ -84,7 +79,6 @@ export function OllamaOnboarding({
|
||||||
!modelsData.embedding_models?.length;
|
!modelsData.embedding_models?.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="space-y-1">
|
<div className="space-y-1">
|
||||||
<LabelInput
|
<LabelInput
|
||||||
|
|
@ -151,10 +145,5 @@ export function OllamaOnboarding({
|
||||||
/>
|
/>
|
||||||
</LabelWrapper>
|
</LabelWrapper>
|
||||||
</div>
|
</div>
|
||||||
<AdvancedOnboarding
|
|
||||||
sampleDataset={sampleDataset}
|
|
||||||
setSampleDataset={handleSampleDatasetChange}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ import {
|
||||||
TooltipContent,
|
TooltipContent,
|
||||||
TooltipTrigger,
|
TooltipTrigger,
|
||||||
} from "@/components/ui/tooltip";
|
} from "@/components/ui/tooltip";
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
import { AnimatedProviderSteps } from "./animated-provider-steps";
|
import { AnimatedProviderSteps } from "./animated-provider-steps";
|
||||||
import { IBMOnboarding } from "./ibm-onboarding";
|
import { IBMOnboarding } from "./ibm-onboarding";
|
||||||
import { OllamaOnboarding } from "./ollama-onboarding";
|
import { OllamaOnboarding } from "./ollama-onboarding";
|
||||||
|
|
@ -165,32 +166,42 @@ const OnboardingCard = ({ onComplete }: OnboardingCardProps) => {
|
||||||
exit={{ opacity: 0, y: -24 }}
|
exit={{ opacity: 0, y: -24 }}
|
||||||
transition={{ duration: 0.4, ease: "easeInOut" }}
|
transition={{ duration: 0.4, ease: "easeInOut" }}
|
||||||
>
|
>
|
||||||
<Card
|
<div className={`w-full max-w-[600px] flex flex-col gap-6`}>
|
||||||
className={`w-full max-w-[600px] ${
|
|
||||||
updatedOnboarding ? "border-none" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
<Tabs
|
<Tabs
|
||||||
defaultValue={modelProvider}
|
defaultValue={modelProvider}
|
||||||
onValueChange={handleSetModelProvider}
|
onValueChange={handleSetModelProvider}
|
||||||
>
|
>
|
||||||
<CardHeader className={`${updatedOnboarding ? "px-0" : ""}`}>
|
<TabsList className="mb-4">
|
||||||
<TabsList>
|
<TabsTrigger
|
||||||
<TabsTrigger value="openai">
|
value="openai"
|
||||||
<OpenAILogo className="w-4 h-4" />
|
>
|
||||||
|
<div className={cn("flex items-center justify-center gap-2 w-8 h-8 rounded-md", modelProvider === "openai" ? "bg-white" : "bg-muted")}>
|
||||||
|
<OpenAILogo className={cn("w-4 h-4 shrink-0", modelProvider === "openai" ? "text-black" : "text-muted-foreground")} />
|
||||||
|
</div>
|
||||||
OpenAI
|
OpenAI
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="watsonx">
|
<TabsTrigger
|
||||||
<IBMLogo className="w-4 h-4" />
|
value="watsonx"
|
||||||
|
>
|
||||||
|
<div className={cn("flex items-center justify-center gap-2 w-8 h-8 rounded-md", modelProvider === "watsonx" ? "bg-[#1063FE]" : "bg-muted")}>
|
||||||
|
<IBMLogo className={cn("w-4 h-4 shrink-0", modelProvider === "watsonx" ? "text-white" : "text-muted-foreground")} />
|
||||||
|
</div>
|
||||||
IBM watsonx.ai
|
IBM watsonx.ai
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
<TabsTrigger value="ollama">
|
<TabsTrigger
|
||||||
<OllamaLogo className="w-4 h-4" />
|
value="ollama"
|
||||||
|
>
|
||||||
|
<div className={cn("flex items-center justify-center gap-2 w-8 h-8 rounded-md", modelProvider === "ollama" ? "bg-white" : "bg-muted")}>
|
||||||
|
<OllamaLogo
|
||||||
|
className={cn(
|
||||||
|
"w-4 h-4 shrink-0",
|
||||||
|
modelProvider === "ollama" ? "text-black" : "text-muted-foreground",
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
Ollama
|
Ollama
|
||||||
</TabsTrigger>
|
</TabsTrigger>
|
||||||
</TabsList>
|
</TabsList>
|
||||||
</CardHeader>
|
|
||||||
<CardContent className={`${updatedOnboarding ? "px-0" : ""}`}>
|
|
||||||
<TabsContent value="openai">
|
<TabsContent value="openai">
|
||||||
<OpenAIOnboarding
|
<OpenAIOnboarding
|
||||||
setSettings={setSettings}
|
setSettings={setSettings}
|
||||||
|
|
@ -212,11 +223,8 @@ const OnboardingCard = ({ onComplete }: OnboardingCardProps) => {
|
||||||
setSampleDataset={setSampleDataset}
|
setSampleDataset={setSampleDataset}
|
||||||
/>
|
/>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
</CardContent>
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<CardFooter
|
|
||||||
className={`flex ${updatedOnboarding ? "px-0" : "justify-end"}`}
|
|
||||||
>
|
|
||||||
<Tooltip>
|
<Tooltip>
|
||||||
<TooltipTrigger asChild>
|
<TooltipTrigger asChild>
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -240,8 +248,7 @@ const OnboardingCard = ({ onComplete }: OnboardingCardProps) => {
|
||||||
</TooltipContent>
|
</TooltipContent>
|
||||||
)}
|
)}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</CardFooter>
|
</div>
|
||||||
</Card>
|
|
||||||
</motion.div>
|
</motion.div>
|
||||||
) : (
|
) : (
|
||||||
<motion.div
|
<motion.div
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export function ChatRenderer({
|
||||||
settings,
|
settings,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
settings: Settings;
|
settings: Settings | undefined;
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}) {
|
}) {
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
@ -51,7 +51,8 @@ export function ChatRenderer({
|
||||||
if (typeof window === "undefined") return false;
|
if (typeof window === "undefined") return false;
|
||||||
const savedStep = localStorage.getItem(ONBOARDING_STEP_KEY);
|
const savedStep = localStorage.getItem(ONBOARDING_STEP_KEY);
|
||||||
// Show layout if settings.edited is true and if no onboarding step is saved
|
// Show layout if settings.edited is true and if no onboarding step is saved
|
||||||
return !!settings?.edited && savedStep === null;
|
const isEdited = settings?.edited ?? true;
|
||||||
|
return isEdited ? savedStep === null : false;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only fetch conversations on chat page
|
// Only fetch conversations on chat page
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,10 @@ export function LayoutWrapper({ children }: { children: React.ReactNode }) {
|
||||||
|
|
||||||
const isUnhealthy = health?.status === "unhealthy" || isError;
|
const isUnhealthy = health?.status === "unhealthy" || isError;
|
||||||
const isBannerVisible = !isHealthLoading && isUnhealthy;
|
const isBannerVisible = !isHealthLoading && isUnhealthy;
|
||||||
|
const isSettingsLoadingOrError = isSettingsLoading || !settings;
|
||||||
|
|
||||||
// Show loading state when backend isn't ready
|
// Show loading state when backend isn't ready
|
||||||
if (isLoading || isSettingsLoading || !settings) {
|
if (isLoading || (isSettingsLoadingOrError && (isNoAuthMode || isAuthenticated))) {
|
||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center bg-background">
|
<div className="min-h-screen flex items-center justify-center bg-background">
|
||||||
<div className="flex flex-col items-center gap-4">
|
<div className="flex flex-col items-center gap-4">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue