Skip to content

Commit c2e0aad

Browse files
committed
add reset to default function to settings
1 parent d268f95 commit c2e0aad

File tree

5 files changed

+11
-7
lines changed

5 files changed

+11
-7
lines changed

src/client/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
77
import { fi } from 'date-fns/locale'
88
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'
99
import { Box, Button, CssBaseline, Snackbar } from '@mui/material'
10-
import { AppContext } from './util/context'
10+
import { AppContext } from './util/AppContext'
1111

1212
import { PUBLIC_URL } from '../config'
1313
import { User } from './types'

src/client/components/ChatV2/ChatV2.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom'
33
import useCourse from '../../hooks/useCourse'
44
import useUserStatus from '../../hooks/useUserStatus'
55
import useLocalStorageState from '../../hooks/useLocalStorageState'
6-
import { DEFAULT_MODEL } from '../../../config'
6+
import { DEFAULT_MODEL, DEFAULT_ASSISTANT_INSTRUCTIONS, DEFAULT_MODEL_TEMPERATURE } from '../../../config'
77
import useInfoTexts from '../../hooks/useInfoTexts'
88
import { Message } from '../../types'
99
import { FileSearchResult, ResponseStreamEventData } from '../../../shared/types'
@@ -28,7 +28,7 @@ import { useRagIndices } from '../../hooks/useRagIndices'
2828
import CourseOption from './generics/CourseOption'
2929
import SettingsButton from './generics/SettingsButton'
3030

31-
import { AppContext } from '../../util/context'
31+
import { AppContext } from '../../util/AppContext'
3232

3333
export const ChatV2 = () => {
3434
const { courseId } = useParams()
@@ -44,12 +44,11 @@ export const ChatV2 = () => {
4444
name: DEFAULT_MODEL,
4545
})
4646
// TODO: Do translation
47-
const defaultInstructions = 'Olet avulias avustaja'
4847
const [assistantInstructions, setAssistantInstructions] = useLocalStorageState<{ content: string }>(`${localStoragePrefix}-chat-instructions`, {
49-
content: defaultInstructions,
48+
content: DEFAULT_ASSISTANT_INSTRUCTIONS,
5049
})
5150
const [modelTemperature, setModelTemperature] = useLocalStorageState<{ value: number }>(`${localStoragePrefix}-chat-model-temperature`, {
52-
value: 0.5,
51+
value: DEFAULT_MODEL_TEMPERATURE,
5352
})
5453
const [message, setMessage] = useLocalStorageState<{ content: string }>(`${localStoragePrefix}-chat-current`, { content: '' })
5554
const [messages, setMessages] = useLocalStorageState<Message[]>(`${localStoragePrefix}-chat-messages`, [])

src/client/components/ChatV2/SettingsModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Close } from '@mui/icons-material'
22
import { Box, IconButton, Modal, Slider, TextField, Typography } from '@mui/material'
3+
import { DEFAULT_MODEL, DEFAULT_ASSISTANT_INSTRUCTIONS, DEFAULT_MODEL_TEMPERATURE } from '../../../config'
34
import ModelSelector from './ModelSelector'
45
import { validModels } from '../../../config'
56
import React from 'react'
@@ -35,7 +36,8 @@ export const SettingsModal: React.FC<SettingsModalProps> = ({
3536
currentRagIndex,
3637
}) => {
3738
const resetSettings = () => {
38-
alert('resetting')
39+
setAssistantInstructions(DEFAULT_ASSISTANT_INSTRUCTIONS)
40+
setModelTemperature(DEFAULT_MODEL_TEMPERATURE)
3941
}
4042

4143
return (
File renamed without changes.

src/config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ export const validModels = [
6161
console.log(`Valid models: ${JSON.stringify(validModels, null, 2)}`)
6262

6363
export const DEFAULT_MODEL_ON_ENABLE = 'gpt-4o'
64+
65+
export const DEFAULT_ASSISTANT_INSTRUCTIONS = 'Olet avulias avustaja'
66+
export const DEFAULT_MODEL_TEMPERATURE = 0.5

0 commit comments

Comments
 (0)