Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into final_knowledge_backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluder-Paradyne committed Jul 26, 2023
2 parents 12a6d2e + 6eeb7f6 commit 77fc628
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ celerybeat-schedule
../bfg-report*
superagi/tools/marketplace_tools/
superagi/tools/external_tools/
tests/unit_tests/resource_manager/test_path
tests/unit_tests/resource_manager/test_path
tools.json
75 changes: 75 additions & 0 deletions docker-compose.image.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
version: '3.8'
services:
backend:
image: "superagidev/backend:dev"
depends_on:
- super__redis
- super__postgres
networks:
- super_network
env_file:
- config.yaml
command: ["/app/wait-for-it.sh", "super__postgres:5432","-t","60","--","/app/entrypoint.sh"]

celery:
image: "superagidev/backend:dev"
depends_on:
- super__redis
- super__postgres
networks:
- super_network
env_file:
- config.yaml
command: ["/app/entrypoint_celery.sh"]
volumes:
- "./workspace:/app/workspace"

gui:
image: "superagidev/gui:dev"
environment:
- NEXT_PUBLIC_API_BASE_URL=/api
networks:
- super_network

super__redis:
image: "redis/redis-stack-server:latest"
networks:
- super_network
# uncomment to expose redis port to host
# ports:
# - "6379:6379"
volumes:
- redis_data:/data

super__postgres:
image: "docker.io/library/postgres:latest"
environment:
- POSTGRES_USER=superagi
- POSTGRES_PASSWORD=password
- POSTGRES_DB=super_agi_main
volumes:
- superagi_postgres_data:/var/lib/postgresql/data/
networks:
- super_network
# uncomment to expose postgres port to host
# ports:
# - "5432:5432"

proxy:
image: nginx:stable-alpine
ports:
- "3000:80"
networks:
- super_network
depends_on:
- backend
- gui
volumes:
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf

networks:
super_network:
driver: bridge
volumes:
superagi_postgres_data:
redis_data:
2 changes: 1 addition & 1 deletion gui/pages/Content/Agents/AgentCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ export default function AgentCreate({
{toolNames && toolNames.length > 0 && toolNames.map((tool, index) => (
<div key={index} className="tool_container" style={{margin: '2px'}} onClick={preventDefault}>
<div className={styles.tool_text}>{tool}</div>
<div><Image width={12} height={12} src='/images/close.svg' alt="close-icon"
<div><Image width={12} height={12} src='/images/close_light.svg' alt="close-icon"
style={{margin: '-2px -5px 0 2px'}} onClick={() => removeTool(index)}/></div>
</div>
))}
Expand Down
10 changes: 6 additions & 4 deletions gui/pages/Content/Marketplace/AgentTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default function AgentTemplate({template, env}) {
const [installed, setInstalled] = useState('')
const [constraints, setConstraints] = useState([])
const [isLoading, setIsLoading] = useState(true)
const [loadingText, setLoadingText] = useState("Loading Template Details");
const [loadingText, setLoadingText] = useState("Loading Template Details")
const [isInstalled, setIsInstalled] = useState(false)

useEffect(() => {
loadingTextEffect('Loading Template Details', setLoadingText, 500);
Expand Down Expand Up @@ -58,6 +59,7 @@ export default function AgentTemplate({template, env}) {
}

function handleInstallClick() {
setIsInstalled(true)
if (window.location.href.toLowerCase().includes('marketplace')) {
localStorage.setItem('agent_to_install', template.id);
if (env === 'PROD') {
Expand Down Expand Up @@ -105,10 +107,10 @@ export default function AgentTemplate({template, env}) {
<button className="primary_button" style={{
marginTop: '15px',
width: '100%',
background: template && template.is_installed ? 'rgba(255, 255, 255, 0.14)' : '#FFF',
color: template && template.is_installed ? '#FFFFFF' : '#000'
background: isInstalled || (template && template.is_installed) ? 'rgba(255, 255, 255, 0.14)' : '#FFF',
color: isInstalled || (template && template.is_installed) ? '#FFFFFF' : '#000'
}} onClick={() => handleInstallClick()}>
{(template && template.is_installed) ?
{(isInstalled || (template && template.is_installed)) ?
<Image width={14} height={14} src="/images/tick.svg" alt="tick-icon"/> :
<Image width={14} height={14} src="/images/upload_icon_dark.svg"
alt="upload-icon"/>}&nbsp;{installed}</button>
Expand Down
8 changes: 8 additions & 0 deletions gui/public/images/close_light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions superagi/controllers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,15 @@ def create_and_schedule_agent(agent_config_schedule: AgentConfigSchedule,
if agent_schedule.id is None:
raise HTTPException(status_code=500, detail="Failed to schedule agent")

agent = db.session.query(Agent).filter(Agent.id == db_agent.id, ).first()
organisation = agent.get_agent_organisation(db.session)

EventHandler(session=db.session).create_event('agent_created', {'agent_name': agent_config.name,
'model': agent_config.model}, db_agent.id,
organisation.id if organisation else 0)

db.session.commit()

return {
"id": db_agent.id,
"name": db_agent.name,
Expand Down
1 change: 0 additions & 1 deletion superagi/jobs/scheduling_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ def execute_scheduled_agent(self, agent_id: int, name: str):
organisation = agent.get_agent_organisation(session)
model = session.query(AgentConfiguration.value).filter(AgentConfiguration.agent_id == agent_id).filter(AgentConfiguration.key == 'model').first()[0]
EventHandler(session=session).create_event('run_created', {'agent_execution_id': db_agent_execution.id,'agent_execution_name':db_agent_execution.name}, agent_id, organisation.id if organisation else 0),
EventHandler(session=session).create_event('agent_created', {'agent_name': agent.name, 'model': model}, agent_id, organisation.id if organisation else 0)

session.commit()

Expand Down

0 comments on commit 77fc628

Please sign in to comment.