Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion site/src/api/queries/aiProviders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {

const aiProvidersListKey = ["ai", "providers"] as const;

const aiProviderKeyFor = (idOrName: string) =>
export const aiProviderKeyFor = (idOrName: string) =>
[...aiProvidersListKey, idOrName] as const;

export const aiProvidersList = () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { toast } from "sonner";
import { getErrorMessage } from "#/api/errors";
import {
aiProvider,
aiProviderKeyFor,
deleteAIProviderMutation,
updateAIProviderMutation,
} from "#/api/queries/aiProviders";
Expand Down Expand Up @@ -171,6 +172,10 @@ const UpdateProviderPageView: React.FC = () => {
{ enabled: checked },
{
onSuccess: (updated) => {
queryClient.setQueryData(
aiProviderKeyFor(providerId),
updated,
);
toast.success(
`Provider "${updated.display_name || updated.name}" ${checked ? "enabled" : "disabled"}.`,
);
Expand Down Expand Up @@ -200,6 +205,7 @@ const UpdateProviderPageView: React.FC = () => {
const request = providerFormValuesToUpdate(values, provider);
try {
const updated = await updateMutation.mutateAsync(request);
queryClient.setQueryData(aiProviderKeyFor(providerId), updated);
toast.success(
`Provider "${updated.display_name || updated.name}" updated.`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type CredentialFieldProps = {
placeholder?: string;
description?: React.ReactNode;
required?: boolean;
onBlur?: () => void;
onFocus?: () => void;
};

Expand All @@ -20,6 +21,7 @@ export const CredentialField: React.FC<CredentialFieldProps> = ({
placeholder,
description,
required = false,
onBlur,
onFocus,
}) => {
const inputId = useId();
Expand Down Expand Up @@ -62,9 +64,13 @@ export const CredentialField: React.FC<CredentialFieldProps> = ({
<Input
id={inputId}
name={helpers.name}
className="font-mono text-[13px]"
value={helpers.value}
onChange={helpers.onChange}
onBlur={helpers.onBlur}
onBlur={(event) => {
helpers.onBlur(event);
onBlur?.();
}}
onFocus={onFocus}
autoComplete={autoComplete}
placeholder={placeholder}
Expand Down
Loading
Loading