fix: 🚑 class_name hotfix

This commit is contained in:
Nate Sesti 2023-09-26 12:33:15 -07:00
parent 23b095a9c2
commit 83b0417f6c
4 changed files with 11 additions and 11 deletions

View file

@ -184,8 +184,8 @@ const Layout = () => {
/>
)}
<ModelSelect />
{defaultModel.class_name === "OpenAIFreeTrial" &&
defaultModel.api_key === "" &&
{defaultModel?.class_name === "OpenAIFreeTrial" &&
defaultModel?.api_key === "" &&
(location.pathname === "/settings" ||
parseInt(localStorage.getItem("ftc") || "0") >= 125) && (
<ProgressBar

View file

@ -144,14 +144,14 @@ const NewProviderDiv = styled.div`
`;
function modelSelectTitle(model: any): string {
if (model.title) return model.title;
if (model.model !== undefined && model.model.trim() !== "") {
if (model.class_name) {
return `${model.class_name} - ${model.model}`;
if (model?.title) return model?.title;
if (model?.model !== undefined && model?.model.trim() !== "") {
if (model?.class_name) {
return `${model?.class_name} - ${model?.model}`;
}
return model.model;
return model?.model;
}
return model.class_name;
return model?.class_name;
}
function ModelSelect(props: {}) {

View file

@ -53,7 +53,7 @@ function ModelSettings(props: { llm: any | undefined; role: string }) {
<Div dashed={typeof props.llm === undefined}>
{props.llm ? (
<>
<b>{props.role}</b>: <b> {props.llm.class_name || "gpt-4"}</b>
<b>{props.role}</b>: <b> {props.llm?.class_name || "gpt-4"}</b>
<form>
{typeof modelOptions.api_key !== undefined && (
<>

View file

@ -288,8 +288,8 @@ function GUI(props: GUIProps) {
}
if (
defaultModel.class_name === "OpenAIFreeTrial" &&
defaultModel.api_key === "" &&
defaultModel?.class_name === "OpenAIFreeTrial" &&
defaultModel?.api_key === "" &&
(!input.startsWith("/") || input.startsWith("/edit"))
) {
const ftc = localStorage.getItem("ftc");