1
1
import React , { useState } from 'react'
2
- import { TextField , Button , Box , Typography , Table , TableHead , TableBody , TableRow , TableCell , Paper , Link , Container } from '@mui/material'
2
+ import {
3
+ TextField ,
4
+ Button ,
5
+ Box ,
6
+ Typography ,
7
+ Table ,
8
+ TableHead ,
9
+ TableBody ,
10
+ TableRow ,
11
+ TableCell ,
12
+ Paper ,
13
+ Link ,
14
+ Container ,
15
+ FormControl ,
16
+ Select ,
17
+ MenuItem ,
18
+ InputLabel ,
19
+ } from '@mui/material'
3
20
import { useNavigate , Link as RouterLink , useParams } from 'react-router-dom'
4
21
import { useCourseRagIndices , useRagIndices } from '../../hooks/useRagIndices'
5
22
import { useCreateRagIndexMutation } from './api'
@@ -12,6 +29,7 @@ const Rag: React.FC = () => {
12
29
const { ragIndices } = useCourseRagIndices ( chatInstance ?. id , true )
13
30
const createIndexMutation = useCreateRagIndexMutation ( )
14
31
const [ indexName , setIndexName ] = useState ( '' )
32
+ const [ language , setLanguage ] = useState < 'Finnish' | 'English' > ( 'English' )
15
33
16
34
return (
17
35
< Container sx = { { display : 'flex' , gap : 2 , mt : '4rem' , mb : '10rem' } } maxWidth = "xl" >
@@ -29,13 +47,21 @@ const Rag: React.FC = () => {
29
47
onChange = { ( e ) => setIndexName ( e . target . value ) }
30
48
fullWidth
31
49
/>
50
+ < FormControl fullWidth >
51
+ < InputLabel id = "language-label" > Language</ InputLabel >
52
+ < Select labelId = "language-label" id = "language-select" value = { language } onChange = { ( e ) => setLanguage ( e . target . value as 'Finnish' | 'English' ) } >
53
+ < MenuItem value = { 'Finnish' } > Finnish</ MenuItem >
54
+ < MenuItem value = { 'English' } > English</ MenuItem >
55
+ </ Select >
56
+ </ FormControl >
32
57
< Button
33
58
variant = "contained"
34
59
color = "primary"
35
60
onClick = { async ( ) => {
36
61
const newIndex = await createIndexMutation . mutateAsync ( {
37
62
chatInstanceId : chatInstance ?. id ,
38
63
indexName,
64
+ language,
39
65
} )
40
66
setIndexName ( '' )
41
67
navigate ( `/rag/${ newIndex . id } ` )
0 commit comments