Skip to content

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

Python

feat: Settings UX should let you remove a model provider

Mike Pawlowskicc9e953a1e77
diff --git a/frontend/app/settings/_components/anthropic-settings-dialog.tsx b/frontend/app/settings/_components/anthropic-settings-dialog.tsx
index 55bc4d9a2..f1b7e1542 100644
--- a/frontend/app/settings/_components/anthropic-settings-dialog.tsx
+++ b/frontend/app/settings/_components/anthropic-settings-dialog.tsx
@@ -1,7 +1,7 @@
import { useQueryClient } from "@tanstack/react-query";
import { AnimatePresence, motion } from "motion/react";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { toast } from "sonner";
import { useUpdateSettingsMutation } from "@/app/api/mutations/useUpdateSettingsMutation";
@@ -63,6 +63,11 @@ const AnthropicSettingsDialog = ({
},
});
+ useEffect(() => {
+ // Reset form state on dialog open
+ if (open) methods.reset();
+ }, [open]);
+
const { handleSubmit, watch } = methods;
const apiKey = watch("apiKey");
@@ -204,7 +209,7 @@ const AnthropicSettingsDialog = ({
removeMutation.mutate({ remove_anthropic_config: true })
}
>
- {removeMutation.isPending ? "Removing..." : "Confirm Remove"}
+ {removeMutation.isPending ? "Removing..." : "Remove"}
</Button>
</DialogFooter>
) : (
diff --git a/frontend/app/settings/_components/anthropic-settings-form.tsx b/frontend/app/settings/_components/anthropic-settings-form.tsx
index 60bdd3468..14d09e702 100644
--- a/frontend/app/settings/_components/anthropic-settings-form.tsx
+++ b/frontend/app/settings/_components/anthropic-settings-form.tsx
@@ -38,6 +38,7 @@ export function AnthropicSettingsForm({
className={apiKeyError ? "!border-destructive" : ""}
id="api-key"
type="password"
+ autoComplete="new-password"
placeholder="sk-ant-..."
/>
</LabelWrapper>
diff --git a/frontend/app/settings/_components/ollama-settings-dialog.tsx b/frontend/app/settings/_components/ollama-settings-dialog.tsx
index d079a0a9a..0437d796f 100644
--- a/frontend/app/settings/_components/ollama-settings-dialog.tsx
+++ b/frontend/app/settings/_components/ollama-settings-dialog.tsx
@@ -1,7 +1,7 @@
import { useQueryClient } from "@tanstack/react-query";
import { AnimatePresence, motion } from "motion/react";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { toast } from "sonner";
import { useUpdateSettingsMutation } from "@/app/api/mutations/useUpdateSettingsMutation";
@@ -65,6 +65,11 @@ const OllamaSettingsDialog = ({
},
});
+ useEffect(() => {
+ // Reset form state on dialog open
+ if (open) methods.reset();
+ }, [open]);
+
const { handleSubmit, watch } = methods;
const endpoint = watch("endpoint");
@@ -197,7 +202,7 @@ const OllamaSettingsDialog = ({
removeMutation.mutate({ remove_ollama_config: true })
}
>
- {removeMutation.isPending ? "Removing..." : "Confirm Remove"}
+ {removeMutation.isPending ? "Removing..." : "Remove"}
</Button>
</DialogFooter>
) : (
diff --git a/frontend/app/settings/_components/openai-settings-dialog.tsx b/frontend/app/settings/_components/openai-settings-dialog.tsx
index 5da4225d3..b0930e9d9 100644
--- a/frontend/app/settings/_components/openai-settings-dialog.tsx
+++ b/frontend/app/settings/_components/openai-settings-dialog.tsx
@@ -1,7 +1,7 @@
import { useQueryClient } from "@tanstack/react-query";
import { AnimatePresence, motion } from "motion/react";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { toast } from "sonner";
import { useUpdateSettingsMutation } from "@/app/api/mutations/useUpdateSettingsMutation";
@@ -62,6 +62,11 @@ const OpenAISettingsDialog = ({
},
});
+ useEffect(() => {
+ // Reset form state on dialog open
+ if (open) methods.reset();
+ }, [open]);
+
const { handleSubmit, watch } = methods;
const apiKey = watch("apiKey");
@@ -204,7 +209,7 @@ const OpenAISettingsDialog = ({
removeMutation.mutate({ remove_openai_config: true })
}
>
- {removeMutation.isPending ? "Removing..." : "Confirm Remove"}
+ {removeMutation.isPending ? "Removing..." : "Remove"}
</Button>
</DialogFooter>
) : (
diff --git a/frontend/app/settings/_components/openai-settings-form.tsx b/frontend/app/settings/_components/openai-settings-form.tsx
index acdc4bd3a..b47ecac98 100644
--- a/frontend/app/settings/_components/openai-settings-form.tsx
+++ b/frontend/app/settings/_components/openai-settings-form.tsx
@@ -38,6 +38,7 @@ export function OpenAISettingsForm({
className={apiKeyError ? "!border-destructive" : ""}
id="api-key"
type="password"
+ autoComplete="new-password"
placeholder="sk-..."
/>
</LabelWrapper>
diff --git a/frontend/app/settings/_components/watsonx-settings-dialog.tsx b/frontend/app/settings/_components/watsonx-settings-dialog.tsx
index 2c0e7d557..6c87e3385 100644
--- a/frontend/app/settings/_components/watsonx-settings-dialog.tsx
+++ b/frontend/app/settings/_components/watsonx-settings-dialog.tsx
@@ -1,7 +1,7 @@
import { useQueryClient } from "@tanstack/react-query";
import { AnimatePresence, motion } from "motion/react";
import { useRouter } from "next/navigation";
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { FormProvider, useForm } from "react-hook-form";
import { toast } from "sonner";
import { useUpdateSettingsMutation } from "@/app/api/mutations/useUpdateSettingsMutation";
@@ -64,6 +64,11 @@ const WatsonxSettingsDialog = ({
},
});
+ useEffect(() => {
+ // Reset form state on dialog open
+ if (open) methods.reset();
+ }, [open]);
+
const { handleSubmit, watch } = methods;
const endpoint = watch("endpoint");
const apiKey = watch("apiKey");
@@ -213,7 +218,7 @@ const WatsonxSettingsDialog = ({
removeMutation.mutate({ remove_watsonx_config: true })
}
>
- {removeMutation.isPending ? "Removing..." : "Confirm Remove"}
+ {removeMutation.isPending ? "Removing..." : "Remove"}
</Button>
</DialogFooter>
) : (
diff --git a/frontend/app/settings/_components/watsonx-settings-form.tsx b/frontend/app/settings/_components/watsonx-settings-form.tsx
index d07d2393c..a31004c07 100644
--- a/frontend/app/settings/_components/watsonx-settings-form.tsx
+++ b/frontend/app/settings/_components/watsonx-settings-form.tsx
@@ -122,6 +122,7 @@ export function WatsonxSettingsForm({
}
id="api-key"
type="password"
+ autoComplete="new-password"
placeholder="your-api-key"
/>
</LabelWrapper>