Skip to content

Commit

Permalink
Refactor ChatSettings component to use Object.entries instead of Obje…
Browse files Browse the repository at this point in the history
…ct.keys to iterate over AvailableModels and Mode objects
  • Loading branch information
Royal-lobster committed Nov 30, 2023
1 parent e2b4283 commit 8d40f8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/components/Settings/Sections/ChatSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ const ChatSettings = () => {
className="input cdx-w-44"
onChange={handleModalChange}
>
{Object.keys(AvailableModels).map((modal) => (
<option key={modal} value={modal}>
{Object.entries(AvailableModels).map(([modal, value]) => (
<option key={modal} value={value}>
{capitalizeText(
modal
.toLowerCase()
Expand All @@ -157,11 +157,11 @@ const ChatSettings = () => {
onChange={handleModeChange}
className="input cdx-w-36"
>
{Object.keys(Mode)
.filter((v) => Number.isNaN(Number(v)))
.map((value) => (
<option key={value} value={value}>
{capitalizeText(value.replace('_', ' ').toLowerCase())}
{Object.entries(Mode)
.filter(([, v]) => !Number.isNaN(Number(v)))
.map(([key, value]) => (
<option key={key} value={value}>
{capitalizeText(key.replace('_', ' ').toLowerCase())}
</option>
))}
</select>
Expand Down

0 comments on commit 8d40f8f

Please sign in to comment.