Skip to content

Commit

Permalink
hotfix for cache & drawer bug (#2538)
Browse files Browse the repository at this point in the history
  • Loading branch information
yk committed Apr 15, 2023
1 parent a2a0850 commit c457b9a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions website/src/components/Chat/ChatSection.tsx
Expand Up @@ -16,12 +16,21 @@ export const ChatSection = ({ chatId }: { chatId: string | null }) => {

console.assert(modelInfos.length > 0, "No model config was found");

const form = useForm<ChatConfigFormData>({
defaultValues: getConfigCache() ?? {
let defaultValues = getConfigCache();
if (defaultValues) {
const model = modelInfos.find((model) => model.name === defaultValues.model_config_name);
if (!model) {
defaultValues = null;
}
}
if (!defaultValues) {
defaultValues = {
...modelInfos[0].parameter_configs[0].sampling_parameters,
model_config_name: modelInfos[0].name,
},
});
};
}

const form = useForm<ChatConfigFormData>({ defaultValues });
return (
<FormProvider {...form}>
<Card className="mx-auto" maxW={{ base: "min(64rem, 90vw)", lg: "36rem", xl: "3xl", "2xl": "5xl" }}>
Expand Down

0 comments on commit c457b9a

Please sign in to comment.