import React, { useContext, useEffect } from 'react'; import { ModalContext } from '../context/ModalContext'; export const PromptSelect = () => { const context = useContext(ModalContext); const changePrompt = (e: any) => { const newPrompt = context!.objectPrompts.find((val) => val.id == e.target.value)!; context?.updateState({ promptId: newPrompt.id, title: newPrompt.title }); }; useEffect(() => { (window as any).styleFormInputs('.llm-select'); }, []); useEffect(() => { $('.llm-select .selecter').trigger('chosen:updated'); }); useEffect(() => { const $select = $('.llm-select'); $select.on('change', changePrompt); return () => { $select.off('change', changePrompt); }; }, [context?.objectPrompts]); return ( <>
Nastavení
); };