MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / PlaygroundModel

Function PlaygroundModel

frontend/src/components/playgroundModel/index.tsx:18–494  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16const origin = window.location.origin;
17import IconComponent from '@/commonComponent/iconComponent/index.jsx';
18function PlaygroundModel() {
19 const [loading, setLoading] = useState(false)
20 const { search, pathname } = useLocation();
21 const [selectedModel, setSelectedModel] = useState<any>([{
22 id: '',
23 name: ''
24 }])
25 const navigation = useNavigate();
26 const { modelReduxId } = useSelector((state: any) => state.modelId)
27 const {temperatureRedux,maxTokenRedux,topPValueRedux,topKValueRedux,stopSequenceValueRedux }= useSelector((state: any) => state.playgroundModelRedux)
28 const dispatch = useDispatch();
29 const [systemContent, setSystemContent] = useState('')
30 const [temperatureValue, setTemperatureValue] = useState(0.8)
31 const [maxTokenValue, setMaxTokenValue] = useState(4096)
32 const [topValue, setTopValue] = useState(0.1)
33 const [topkValue, setTopkValue] = useState(5)
34 const [providerId, setProviderId] = useState('')
35 const [generateLoading, setGenerateLoading] = useState(false)
36 const [streamSwitch, setStreamSwitch] = useState(true)
37 const [open, setOpen] = useState(false)
38 const [stopSequences, setStopSequences] = useState<any>()
39 const [allowedConfigs, setAllowedConfigs] = useState<any>([])
40 const [selectedData, setSelectedData] = useState<any>([])
41 const [streamShow, setStreamShow] = useState(false)
42 const contentListRef = useRef(null);
43 const [temperatureCheckbox, setTemperatureCheckbox] = useState(false)
44 const [maxTokenCheckbox, setMaxTokenCheckbox] = useState(false)
45 const [stopSequencesCheckbox, setStopSequenceCheckbox] = useState(false)
46 const [topPCheckbox, setTopPCheckbox] = useState(false)
47 const [topKCheckbox, setTopKCheckbox] = useState(false)
48 const [modelSchemaId, setModelSchemaId] = useState('')
49 const [contentList, setContentList] = useState([{
50 role: 'user',
51 content: ''
52 }])
53 useEffect(() => {
54 const list: any = contentListRef.current;
55 if (list) {
56 setTimeout(() => {
57 list.scrollTop = list.scrollHeight;
58 list.scrollTo({
59 top: list.scrollHeight,
60 behavior: 'smooth'
61 });
62 }, 0);
63 }
64 }, [contentList]);
65 useEffect(() => {
66 const fetchData = async () => {
67 setLoading(true)
68 const queryParams = new URLSearchParams(search);
69 const modelSchemaId = localStorage.getItem('modelSchemaId')
70 const providerId = localStorage.getItem('providerId')
71 if (modelSchemaId && providerId) {
72 setModelSchemaId(modelSchemaId)
73 setProviderId(providerId)
74 const modelId = queryParams.get('model_id');
75 if (modelReduxId === modelId && modelId) {

Callers

nothing calls this directly

Calls 9

setPlaygroundModelIdFunction · 0.90
setPlaygroundModelNameFunction · 0.90
handleStreamSwitchFunction · 0.85
handleChangeContentValueFunction · 0.85
handleRoleChangeFunction · 0.85
handleChangeValueFunction · 0.85
handleDeletedataFunction · 0.85
fetchDataFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected