Skip to content

Commit

Permalink
making it non optional
Browse files Browse the repository at this point in the history
  • Loading branch information
malhotra5 committed Dec 24, 2024
1 parent 99fdc47 commit b3ad9df
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
3 changes: 2 additions & 1 deletion frontend/__tests__/services/settings.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { describe, expect, it, vi, Mock, afterEach } from "vitest";
import {
DEFAULT_SETTINGS,
Settings,
getSettings,
saveSettings,
} from "../../src/services/settings";
import { Settings } from "#/api/open-hands.types";

Storage.prototype.getItem = vi.fn();
Storage.prototype.setItem = vi.fn();
Expand Down Expand Up @@ -68,6 +68,7 @@ describe("saveSettings", () => {
LLM_MODEL: "llm_value",
LLM_BASE_URL: "base_url",
AGENT: "agent_value",
MAX_ITERATIONS: 100,
LANGUAGE: "language_value",
LLM_API_KEY: "some_key",
CONFIRMATION_MODE: true,
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/api/open-hands.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ export interface AuthenticateResponse {
}

export interface Settings {
LANGUAGE?: string;
AGENT?: string;
MAX_ITERATIONS?: number;
SECURITY_ANALYZER?: string;
CONFIRMATION_MODE?: boolean;
LLM_MODEL?: string;
LLM_API_KEY?: string;
LLM_BASE_URL?: string;
LANGUAGE: string;
AGENT: string;
MAX_ITERATIONS: number;
SECURITY_ANALYZER: string;
CONFIRMATION_MODE: boolean;
LLM_MODEL: string;
LLM_API_KEY: string;
LLM_BASE_URL: string;
}
12 changes: 6 additions & 6 deletions frontend/src/components/shared/modals/settings/settings-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ export function SettingsForm({
<>
<CustomModelInput
isDisabled={!!disabled}
defaultValue={settings.LLM_MODEL || ""}
defaultValue={settings.LLM_MODEL}
/>

<BaseUrlInput
isDisabled={!!disabled}
defaultValue={settings.LLM_BASE_URL || ""}
defaultValue={settings.LLM_BASE_URL}
/>
</>
)}
Expand All @@ -197,13 +197,13 @@ export function SettingsForm({

<APIKeyInput
isDisabled={!!disabled}
defaultValue={settings.LLM_API_KEY || ""}
defaultValue={settings.LLM_API_KEY}
/>

{showAdvancedOptions && (
<AgentInput
isDisabled={!!disabled}
defaultValue={settings.AGENT || ""}
defaultValue={settings.AGENT}
agents={agents}
/>
)}
Expand All @@ -212,13 +212,13 @@ export function SettingsForm({
<>
<SecurityAnalyzerInput
isDisabled={!!disabled}
defaultValue={settings.SECURITY_ANALYZER || ""}
defaultValue={settings.SECURITY_ANALYZER}
securityAnalyzers={securityAnalyzers}
/>

<ConfirmationModeSwitch
isDisabled={!!disabled}
defaultSelected={settings.CONFIRMATION_MODE || false}
defaultSelected={settings.CONFIRMATION_MODE}
/>
</>
)}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/services/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const DEFAULT_SETTINGS: Settings = {
LLM_MODEL: "anthropic/claude-3-5-sonnet-20241022",
LLM_BASE_URL: "",
AGENT: "CodeActAgent",
MAX_ITERATIONS: 100,
LANGUAGE: "en",
LLM_API_KEY: "",
CONFIRMATION_MODE: false,
Expand Down

0 comments on commit b3ad9df

Please sign in to comment.