Studio: stop the providers dialog from resetting custom provider form state (#6051)
* fix custom provider state * Address provider seeding review feedback --------- Co-authored-by: Lee Jackson <130007945+Imagineer99@users.noreply.github.com> Co-authored-by: imagineer99 <samleejackson0@gmail.com>
This commit is contained in:
parent
2554636ded
commit
436525d6de
1 changed files with 5 additions and 1 deletions
|
|
@ -212,6 +212,7 @@ export function ChatProvidersSettings({
|
|||
onProvidersChange,
|
||||
}: ChatProvidersSettingsProps) {
|
||||
const providersRef = useRef(providers);
|
||||
const seededProviderTypeRef = useRef<string | null>(null);
|
||||
const [page, setPage] = useState<"list" | "form">("list");
|
||||
const [providerType, setProviderType] = useState<string>("");
|
||||
const [apiKey, setApiKey] = useState("");
|
||||
|
|
@ -317,6 +318,8 @@ export function ChatProvidersSettings({
|
|||
|
||||
useEffect(() => {
|
||||
if (!providerType || editingProviderId) return;
|
||||
if (seededProviderTypeRef.current === providerType) return;
|
||||
seededProviderTypeRef.current = providerType;
|
||||
const entry = registryByType.get(providerType);
|
||||
if (!entry) {
|
||||
if (isCustomProviderType(providerType)) {
|
||||
|
|
@ -363,7 +366,8 @@ export function ChatProvidersSettings({
|
|||
setProviderType((current) => {
|
||||
if (
|
||||
current &&
|
||||
registryRows.some((entry) => entry.provider_type === current)
|
||||
(isCustomProviderType(current) ||
|
||||
registryRows.some((entry) => entry.provider_type === current))
|
||||
) {
|
||||
return current;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue