import React from 'react'; import { useSelector, useDispatch } from 'react-redux'; import Prompts from './Prompts'; import { useDarkTheme } from '../hooks'; import Dropdown from '../components/Dropdown'; import { selectPrompt, setPrompt, setChunks, selectChunks, setTokenLimit, selectTokenLimit, setModalStateDeleteConv, } from '../preferences/preferenceSlice'; const apiHost = import.meta.env.VITE_API_HOST || 'https://docsapi.arc53.com'; const General: React.FC = () => { const themes = ['Light', 'Dark']; const languages = ['English']; const chunks = ['0', '2', '4', '6', '8', '10']; const token_limits = new Map([ [0, 'None'], [100, 'Low'], [1000, 'Medium'], [2000, 'Default'], [4000, 'High'], [1e9, 'Unlimited'], ]); const [prompts, setPrompts] = React.useState< { name: string; id: string; type: string }[] >([]); const selectedChunks = useSelector(selectChunks); const selectedTokenLimit = useSelector(selectTokenLimit); const [isDarkTheme, toggleTheme] = useDarkTheme(); const [selectedTheme, setSelectedTheme] = React.useState( isDarkTheme ? 'Dark' : 'Light', ); const dispatch = useDispatch(); const [selectedLanguage, setSelectedLanguage] = React.useState(languages[0]); const selectedPrompt = useSelector(selectPrompt); React.useEffect(() => { const fetchPrompts = async () => { try { const response = await fetch(`${apiHost}/api/get_prompts`); if (!response.ok) { throw new Error('Failed to fetch prompts'); } const promptsData = await response.json(); setPrompts(promptsData); } catch (error) { console.error(error); } }; fetchPrompts(); }, []); return (
Select Theme
Select Language
Chunks processed per query
Conversational history
Delete all conversations