Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow to change model bro brain settings tab #1590

Merged
merged 1 commit into from
Nov 6, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export const GeneralInformation = (
<Radio
items={brainStatusOptions}
label={t("brain_status_label", { ns: "brain" })}
value={status}
className="flex-1 justify-between w-[50%]"
{...register("status")}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@ export const ModelSelection = (props: ModelSelectionProps): JSX.Element => {
<select
id="model"
disabled={!hasEditRights}
{...register("model")}
{...register("model", {
onChange: () => {
void handleSubmit(false);
},
})}
className="px-5 py-2 dark:bg-gray-700 bg-gray-200 rounded-md"
onChange={() => {
void handleSubmit(false); // Trigger form submission
}}
>
{accessibleModels.map((availableModel) => (
<option value={availableModel} key={availableModel}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const useSettingsTab = ({ brainId }: UseSettingsTabProps) => {
}

setTimeout(() => {
if (brain.model !== undefined) {
if (brain.model !== undefined && brain.model !== null) {
setValue("model", brain.model);
}
}, 50);
Expand Down
4 changes: 2 additions & 2 deletions frontend/lib/context/BrainProvider/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export type Brain = {
name: string;
documents?: Document[];
status?: BrainAccessStatus;
model?: Model;
model?: Model | null;
max_tokens?: number;
temperature?: number;
openai_api_key?: string;
openai_api_key?: string | null;
description?: string;
prompt_id?: string | null;
};
Expand Down
Loading