Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
namansleeps committed Oct 10, 2023
1 parent f1879a2 commit 3d73a47
Showing 1 changed file with 27 additions and 23 deletions.
50 changes: 27 additions & 23 deletions gui/pages/Content/Models/MarketModels.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,43 @@ export default function MarketModels(){
const [loadingText, setLoadingText] = useState("Loading Models");
const [modelTemplates, setModelTemplates] = useState([]);

useEffect(() => {
loadingTextEffect('Loading Models', setLoadingText, 500);
setIsLoading(true)
if (window.location.href.toLowerCase().includes('marketplace')) {
axios.get('https://app.superagi.com/api/models_controller/get/models_details')
.then((response) => {
setModelTemplates(response.data)
})
}
else {
fetchMarketPlaceModel().then((response) => {
setModelTemplates(response.data)
})
}
},[])
// useEffect(() => {
// loadingTextEffect('Loading Models', setLoadingText, 500);
// setIsLoading(true)
// if (window.location.href.toLowerCase().includes('marketplace')) {
// axios.get('https://app.superagi.com/api/models_controller/get/models_details')
// .then((response) => {
// setModelTemplates(response.data)
// })
// }
// else {
// fetchMarketPlaceModel().then((response) => {
// setModelTemplates(response.data)
// })
// }
// },[])

useEffect(() => {
if(modelTemplates.length > 0)
setIsLoading(true)
else
setIsLoading(false)
}, [modelTemplates])
// useEffect(() => {
// if(modelTemplates.length > 0)
// setIsLoading(true)
// else
// setIsLoading(false)
// }, [modelTemplates])

function handleTemplateClick(item) {
const contentType = 'model_template';
EventBus.emit('openTemplateDetails', {item, contentType});
}

useEffect(() => {
loadingTextEffect('Loading Models', setLoadingText, 500);
setIsLoading(true)
const iframe = document.getElementById('marketplace_models');

const handleIframeLoad = () => {
setIsLoading(false)
setTimeout(() => {
setIsLoading(false)
}, 2000);
};

if (iframe) {
Expand All @@ -62,7 +66,7 @@ export default function MarketModels(){
<div className="h_calc_sub_60 w_99vw">
{isLoading ? <iframe
id="marketplace_models"
src="http://localhost:3001/marketplace"
src="https://models.superagi.com/marketplace"
width="100%"
height="100%"
frameBorder="0"
Expand Down

0 comments on commit 3d73a47

Please sign in to comment.