Skip to content

Commit

Permalink
Update chat settings form input handling logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Royal-lobster committed Oct 26, 2024
1 parent 62bf580 commit 8df3cc0
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/components/Settings/Sections/ChatSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as Switch from '@radix-ui/react-switch'
import React, { useState } from 'react'
import { AiOutlineEye, AiOutlineEyeInvisible } from 'react-icons/ai'
import { useSettings } from '../../../hooks/useSettings'
import { Mode } from '../../../config/settings'
import { useChatModels } from '../../../hooks/useChatModels'
import { useSettings } from '../../../hooks/useSettings'
import { capitalizeText } from '../../../lib/capitalizeText'
import { validateApiKey } from '../../../lib/validApiKey'
import FieldWrapper from '../Elements/FieldWrapper'
import SectionHeading from '../Elements/SectionHeading'
import { Mode } from '../../../config/settings'

const ChatSettings = () => {
const [settings, setSettings] = useSettings()
Expand All @@ -22,10 +21,8 @@ const ChatSettings = () => {
event: React.FormEvent<HTMLFormElement>,
) => {
event.preventDefault()
const target = event.target as HTMLFormElement

const apiKeyValue = target.openAiApiKey.value
const baseurlValue = target.openAiBaseUrl.value
const apiKeyValue = OpenAiApiKeyInputRef.current?.value || ''
const baseurlValue = OpenAiBaseUrlInputRef.current?.value || ''

if (OpenAiApiKeyInputRef.current) {
const isOpenAiKeyValid: boolean = await validateApiKey(
Expand Down

0 comments on commit 8df3cc0

Please sign in to comment.