Skip to content

Commit

Permalink
Merge pull request #494 from TransformerOptimus/marketplace_public_bugs
Browse files Browse the repository at this point in the history
Bugs resolved in public marketplace
  • Loading branch information
namansleeps authored Jun 26, 2023
2 parents 141b86d + ad315a0 commit 64617b4
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 18 deletions.
44 changes: 29 additions & 15 deletions gui/pages/Content/Marketplace/AgentTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'react-toastify/dist/ReactToastify.css';
import styles2 from "./Market.module.css"
import {fetchAgentTemplateConfig, installAgentTemplate} from "@/pages/api/DashboardService";
import {EventBus} from "@/utils/eventBus";
import axios from "axios";

export default function AgentTemplate({template}) {
const [tools, setTools] = useState([])
Expand All @@ -19,26 +20,39 @@ export default function AgentTemplate({template}) {
const [constraints, setConstraints] = useState([])

useEffect(() => {
setInstalled(template && template.is_installed? 'Installed' : 'Install');
if(window.location.href.toLowerCase().includes('marketplace')) {
setInstalled('Sign in to install')
axios.get(`https://app.superagi.com/api/agent_templates/marketplace/template_details/${template.id}`)
.then((response) => {
const data = response.data || [];
setValues(data)
})
.catch((error) => {
console.error('Error fetching agent templates:', error);
});
}
else {
setInstalled(template && template.is_installed? 'Installed' : 'Install');
fetchAgentTemplateConfig(template.id)
.then((response) => {
const data = response.data || [];
setValues(data)
})
.catch((error) => {
console.error('Error fetching template details:', error);
});
}

fetchAgentTemplateConfig(template.id)
.then((response) => {
const data = response.data || [];
setAgentType(data.configs.agent_type.value)
setTemplateModel(data.configs.model.value)
setGoals(data.configs.goal.value)
setConstraints(data.configs.constraints.value)
setTools(data.configs.tools.value)
setInstructions(data.configs.instructions.value)
})
.catch((error) => {
console.error('Error fetching template details:', error);
});
}, []);

function setValues(data){
setAgentType(data.configs.agent_type.value)
setTemplateModel(data.configs.model.value)
setGoals(data.configs.goal.value)
setConstraints(data.configs.constraints.value)
setTools(data.configs.tools.value)
setInstructions(data.configs.instructions.value)
}

function handleInstallClick(){
if(window.location.href.toLowerCase().includes('marketplace')) {
if (window.location.href.toLowerCase().includes('localhost')) {
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/Marketplace/Market.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@
width: 33% !important;
background-color: rgb(39, 35, 53);
border-radius: 8px;
margin: 4px 0 4px 0;
/*margin: 4px 0 4px 0;*/
}

.tool_description {
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/Marketplace/MarketAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function MarketAgent(){
}

return (
<div style={showMarketplace ? { marginLeft:'8px',marginRight:'8px' } : { marginLeft:'3px' }}>
<div style={showMarketplace ? { marginLeft:'8px' } : { marginLeft:'3px' }}>
<div className={styles.rowContainer} style={{maxHeight: '78vh',overflowY: 'auto'}}>
{!isLoading ? <div className={styles.resources}>
{agentTemplates.map((item, index) => (
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/Marketplace/MarketplacePublic.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function MarketplacePublic({env}) {
return (
<div style={{height:'100vh',width:'100%'}}>
<div className={styles.marketplace_public_container}>
<div className="superAgiLogo" style={{paddingLeft:'15px'}}><Image width={132} height={24} src="/images/sign-in-logo.svg" alt="super-agi-logo"/>
<div className="superAgiLogo" style={{paddingLeft:'15px'}}><Image width={132} height={24} style={{cursor:'pointer'}} onClick={handleSignupClick} src="/images/sign-in-logo.svg" alt="super-agi-logo"/>
<div className={styles.vertical_line} />
<div className={styles.topbar_heading}>&nbsp;marketplace</div>
</div>
Expand Down

0 comments on commit 64617b4

Please sign in to comment.