()
| 16 | const origin = window.location.origin; |
| 17 | import IconComponent from '@/commonComponent/iconComponent/index.jsx'; |
| 18 | function 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) { |
nothing calls this directly
no test coverage detected