Skip to content

Commit

Permalink
chore: simplify app config model, rename function
Browse files Browse the repository at this point in the history
  • Loading branch information
emcelroy committed Jan 1, 2025
1 parent da12a3c commit e9de612
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/components/developer-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const DeveloperOptionsComponent = observer(function DeveloperOptions({ass
fetchAssistants();
}, [apiConnection.beta.assistants]);

const handleSetSelectedAssistant = (e: React.ChangeEvent<HTMLSelectElement>) => {
const handleSelectAssistant = (e: React.ChangeEvent<HTMLSelectElement>) => {
const id = e.target.value;
onSelectAssistant(id);
};
Expand All @@ -52,7 +52,7 @@ export const DeveloperOptionsComponent = observer(function DeveloperOptions({ass
id="assistant-select"
data-testid="assistant-select"
value={selectedAssistant}
onChange={handleSetSelectedAssistant}
onChange={handleSelectAssistant}
>
<option value="mock">Mock Assistant</option>
{Array.from(assistantOptions?.entries() || []).map(([assistantId, assistantName]) => (
Expand Down
4 changes: 1 addition & 3 deletions src/models/app-config-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,16 @@ export const AppConfigModel = types.model("AppConfigModel", {
width: types.number,
height: types.number,
}),
mockAssistant: types.maybe(types.boolean),
mode: types.enumeration<AppMode>("Mode", AppModeValues),
})
.volatile((self) => ({
isAssistantMocked: self.mode === "development" && self.mockAssistant,
isAssistantMocked: self.assistantId === "mock",
}))
.actions((self) => ({
setAssistantId(assistantId: string) {
self.assistantId = assistantId;
},
setMockAssistant(mockAssistant: boolean) {
self.mockAssistant = mockAssistant;
self.isAssistantMocked = self.mode === "development" && mockAssistant;
}
}));
Expand Down

0 comments on commit e9de612

Please sign in to comment.