Skip to content

Commit

Permalink
Merge pull request #375 from TransformerOptimus/marketplace_bug
Browse files Browse the repository at this point in the history
fixing of marketplace bug
  • Loading branch information
I’m authored Jun 14, 2023
2 parents a13760c + 3536e53 commit 3284c01
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
4 changes: 2 additions & 2 deletions gui/pages/Content/Agents/AgentCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Image from "next/image";
import {ToastContainer, toast} from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import styles from './Agents.module.css';
import {createAgent, fetchAgentTemplateConfig, getOrganisationConfig, uploadFile} from "@/pages/api/DashboardService";
import {createAgent, fetchAgentTemplateConfig, fetchAgentTemplateConfigLocal, getOrganisationConfig, uploadFile} from "@/pages/api/DashboardService";
import {formatBytes} from "@/utils/utils";
import {EventBus} from "@/utils/eventBus";

Expand Down Expand Up @@ -107,7 +107,7 @@ export default function AgentCreate({sendAgentData, selectedProjectId, fetchAgen
setAgentName(template.name)
setAgentDescription(template.description)
setAdvancedOptions(true)
fetchAgentTemplateConfig(template.id)
fetchAgentTemplateConfigLocal(template.id)
.then((response) => {
const data = response.data || [];
setGoals(data.goal)
Expand Down
16 changes: 9 additions & 7 deletions gui/pages/Content/Marketplace/AgentTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {EventBus} from "@/utils/eventBus";

export default function AgentTemplate({template}) {
const [tools, setTools] = useState([])
const [templateConfigs, setTemplateConfigs] = useState([])
const [agentType, setAgentType] = useState('')
const [templateModel, setTemplateModel] = useState('')
const [rightPanel, setRightPanel] = useState('overview')
const [goals, setGoals] = useState([])
const [installed, setInstalled] = useState('')
Expand All @@ -25,10 +26,11 @@ export default function AgentTemplate({template}) {
fetchAgentTemplateConfig(template.id)
.then((response) => {
const data = response.data || [];
setTemplateConfigs(data)
setGoals(data.goal)
setConstraints(data.constraints)
setTools(data.tools)
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)
})
.catch((error) => {
console.error('Error fetching template details:', error);
Expand Down Expand Up @@ -76,11 +78,11 @@ export default function AgentTemplate({template}) {
</div><br />
<span style={{fontSize: '12px'}} className={styles.tool_publisher}>Agent Type</span>
<div className="tool_container" style={{marginTop:'10px',width: 'fit-content'}}>
<div className={styles1.tool_text}>{templateConfigs.agent_type}</div>
<div className={styles1.tool_text}>{agentType}</div>
</div><br />
<span style={{fontSize: '12px'}} className={styles.tool_publisher}>Model(s)</span>
<div className="tool_container" style={{marginTop:'10px',width: 'fit-content'}}>
<div className={styles1.tool_text}>{templateConfigs.model}</div>
<div className={styles1.tool_text}>{templateModel}</div>
</div>
</div>
<div className={styles2.left_container} style={{marginTop:'0.7%'}}>
Expand Down
4 changes: 4 additions & 0 deletions gui/pages/api/DashboardService.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ export const saveAgentAsTemplate = (agentId) => {
}

export const fetchAgentTemplateConfig = (templateId) => {
return api.get(`agent_templates/get/${templateId}?template_source=marketplace`);
}

export const fetchAgentTemplateConfigLocal = (templateId) => {
return api.get(`agent_templates/agent_config?agent_template_id=${templateId}`);
}

This comment has been minimized.

Copy link
@Abhishek16011

Abhishek16011 Jun 15, 2023

import


Expand Down

0 comments on commit 3284c01

Please sign in to comment.