avoid null values in config.json
This commit is contained in:
parent
5fe26de771
commit
838c2f7369
4 changed files with 16 additions and 11 deletions
|
|
@ -4,9 +4,9 @@ import { useDispatch } from "react-redux";
|
|||
import { useNavigate } from "react-router-dom";
|
||||
import { Button, Input, SecondaryButton } from "../..";
|
||||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { providers } from "../../../pages/AddNewModel/configs/providers";
|
||||
import { setDefaultModel } from "../../../redux/slices/stateSlice";
|
||||
import { getLocalStorage } from "../../../util/localStorage";
|
||||
import { providers } from "../../../pages/AddNewModel/configs/providers";
|
||||
import { ftl } from "../../dialogs/FTCDialog";
|
||||
import QuickSetupListBox from "./QuickSetupListBox";
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Transition } from "@headlessui/react";
|
||||
import { CheckIcon, ChevronUpDownIcon } from "@heroicons/react/24/outline";
|
||||
import { Dispatch, Fragment, SetStateAction } from "react";
|
||||
import { DisplayInfo } from "../../../pages/ConfigureNewModel/modelProviders";
|
||||
|
||||
import {
|
||||
StyledListbox,
|
||||
StyledListboxButton,
|
||||
|
|
@ -9,6 +9,11 @@ import {
|
|||
StyledListboxOptions,
|
||||
} from "./StyledListbox";
|
||||
|
||||
interface DisplayInfo {
|
||||
title: string;
|
||||
icon?: string;
|
||||
}
|
||||
|
||||
interface QuickSetupListBoxProps {
|
||||
selectedProvider: DisplayInfo;
|
||||
setSelectedProvider: Dispatch<SetStateAction<DisplayInfo>>;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
|||
import _ from "lodash";
|
||||
import React, { useContext } from "react";
|
||||
import { useDispatch } from "react-redux";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
|
|
@ -14,10 +14,9 @@ import Toggle from "../../components/modelSelection/Toggle";
|
|||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
import { ModelPackage, models } from "./configs/models";
|
||||
import { providers } from "./configs/providers";
|
||||
import { CustomModelButton } from "./ConfigureProvider";
|
||||
import { ModelPackage, models } from "./configs/models";
|
||||
import { Link } from "react-router-dom";
|
||||
|
||||
const IntroDiv = styled.div`
|
||||
padding: 8px 12px;
|
||||
|
|
|
|||
|
|
@ -13,13 +13,13 @@ import {
|
|||
} from "../../components";
|
||||
import StyledMarkdownPreview from "../../components/markdown/StyledMarkdownPreview";
|
||||
import ModelCard from "../../components/modelSelection/ModelCard";
|
||||
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { setDefaultModel } from "../../redux/slices/stateSlice";
|
||||
import { updatedObj } from "../../util";
|
||||
import ModelProviderTag from "../../components/modelSelection/ModelProviderTag";
|
||||
import { providers } from "./configs/providers";
|
||||
import type { ProviderInfo } from "./configs/providers";
|
||||
import { providers } from "./configs/providers";
|
||||
|
||||
const GridDiv = styled.div`
|
||||
display: grid;
|
||||
|
|
@ -203,11 +203,12 @@ function ConfigureProvider() {
|
|||
if (disableModelCards()) return;
|
||||
let formParams: any = {};
|
||||
for (const d of modelInfo.collectInputFor || []) {
|
||||
const val = formMethods.watch(d.key);
|
||||
if (val === "" || val === undefined || val === null) {
|
||||
continue;
|
||||
}
|
||||
formParams = updatedObj(formParams, {
|
||||
[d.key]:
|
||||
d.inputType === "text"
|
||||
? formMethods.watch(d.key)
|
||||
: parseFloat(formMethods.watch(d.key)),
|
||||
[d.key]: d.inputType === "text" ? val : parseFloat(val),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue