Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev -> Main #447

Merged
merged 80 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
4e60148
action console null checks
NishantBorthakur Jun 20, 2023
3605022
optimizing action console
NishantBorthakur Jun 20, 2023
5805f2c
dropdown css fix
NishantBorthakur Jun 20, 2023
31adf5f
code cleanup
NishantBorthakur Jun 20, 2023
4f10be5
loading text as utils function
NishantBorthakur Jun 20, 2023
18ddf11
Merge pull request #426 from TransformerOptimus/frontend_cleanup
nborthy Jun 20, 2023
b8e58f7
public marketplace fixes
NishantBorthakur Jun 20, 2023
0e6f992
public marketplace fixes 2
NishantBorthakur Jun 20, 2023
f00cf67
public marketplace fixes 3
NishantBorthakur Jun 20, 2023
b69d73c
public marketplace fixes 4
NishantBorthakur Jun 20, 2023
8357e12
Merge pull request #427 from TransformerOptimus/frontend_cleanup
nborthy Jun 20, 2023
c0a310e
empty task queue condition
NishantBorthakur Jun 20, 2023
7fd00ae
flex issues
NishantBorthakur Jun 20, 2023
05b0d3c
Modified the coding tool
COLONAYUSH Jun 20, 2023
a54d72a
Added write spec tool for the coding tool
COLONAYUSH Jun 20, 2023
2fd1794
Added write test tool for the coding tool
COLONAYUSH Jun 20, 2023
bbc9020
ui changes
jedan2506 Jun 20, 2023
c37d0dd
minor fixes
NishantBorthakur Jun 20, 2023
d1b3a45
Merge pull request #429 from TransformerOptimus/frontend_cleanup
nborthy Jun 20, 2023
0f62ab3
updated json reponse
COLONAYUSH Jun 20, 2023
7ed8672
adding email tests and fixing json cleaner test
Jun 21, 2023
e185097
adding email tests and fixing json cleaner test
Jun 21, 2023
f716aeb
ui changes
jedan2506 Jun 21, 2023
5271c4f
small change
Fluder-Paradyne Jun 21, 2023
7dc952f
small change
Fluder-Paradyne Jun 21, 2023
c469a82
test
Fluder-Paradyne Jun 21, 2023
883e020
refactoring resource manager
Jun 21, 2023
9aaba15
Added Add to file logic in all file
COLONAYUSH Jun 21, 2023
6fd8c5d
Delete tt.py
jedan2506 Jun 21, 2023
2076862
minor changes
Jun 21, 2023
cf16323
Update stable_diffusion_image_gen.py
jedan2506 Jun 21, 2023
262896f
Update super_agi.py
jedan2506 Jun 21, 2023
dd7d8cf
fixing stable diffusion and dalle unit tests
Jun 21, 2023
4503260
adding coverage package
Jun 21, 2023
d882c5a
Merge pull request #435 from TransformerOptimus/resource_manager_refa…
Jun 21, 2023
1413281
adding cu cd flow
Jun 21, 2023
2103ff4
Update ci.yml
Jun 21, 2023
d23a784
fixing config bug in running tests
Jun 21, 2023
2b767c2
fixing unit tests
Jun 21, 2023
7f37b15
minor fixes
Jun 21, 2023
93d92be
moving send email test to tools
Jun 21, 2023
aaf9ffa
fixing issues
Jun 21, 2023
003e8f4
fixing issues
Jun 21, 2023
dc975ce
fixing issues
Jun 21, 2023
60edbbb
Merge pull request #442 from TransformerOptimus/resource_manager_refa…
Jun 21, 2023
256d9c3
Merge branch 'dev' into pylint
Jun 21, 2023
8d90da2
Merge pull request #430 from TransformerOptimus/pylint
Jun 21, 2023
d1a160f
Modified write code file
COLONAYUSH Jun 21, 2023
5b3305d
Added write_test file logic
COLONAYUSH Jun 21, 2023
4d95340
Changes the file name
COLONAYUSH Jun 21, 2023
c9f4749
Modified the coding tool
COLONAYUSH Jun 20, 2023
1e37431
Added write spec tool for the coding tool
COLONAYUSH Jun 20, 2023
3af6fe0
Added write test tool for the coding tool
COLONAYUSH Jun 20, 2023
d8f6e42
updated json reponse
COLONAYUSH Jun 20, 2023
05aa3fc
Added Add to file logic in all file
COLONAYUSH Jun 21, 2023
0858642
Modified write code file
COLONAYUSH Jun 21, 2023
f695664
Added write_test file logic
COLONAYUSH Jun 21, 2023
559e00a
Added write code file
COLONAYUSH Jun 21, 2023
06423d0
Updated name
COLONAYUSH Jun 21, 2023
7853014
refactoring the resource manager
Jun 21, 2023
535ced6
fixing resource manager tests
Jun 21, 2023
0757d1c
Fixing issues on code and spec. Adding unit test for write test
Jun 21, 2023
ce14194
fixing the resource manager issues
Jun 22, 2023
7151ed0
fixing tests and flows
Jun 22, 2023
2d39774
Added __init__ file
COLONAYUSH Jun 22, 2023
a52f8d3
Merge branch 'supercoder' of github.com:TransformerOptimus/SuperAGI i…
COLONAYUSH Jun 22, 2023
8c82b38
increasing the tokens for code, spec generation
Jun 22, 2023
b38f7ca
fixing the spec->code issue
Jun 22, 2023
df9b8aa
fixing issues
Jun 22, 2023
47f468c
fixing issues
Jun 22, 2023
7ca8a62
fixing issues
Jun 22, 2023
3fde397
fixing write code and tests
Jun 22, 2023
f1befed
fixing binary file write issue
Jun 22, 2023
45db7d6
fixing coding issue
Jun 22, 2023
6ffaefe
Fixing write code prompt
Jun 22, 2023
71d5df3
fixing thinking tool response
Jun 22, 2023
bf0cdde
minor fix
Jun 22, 2023
3ac9699
adding agent execution feed tests
Jun 22, 2023
7060714
Merge pull request #446 from TransformerOptimus/supercoder
Jun 22, 2023
037c499
Adding readme for slack and stable diffusion
Jun 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python CI

on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]

permissions:
contents: read

jobs:
lint:

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

test:
# eliminate duplicate runs
if: github.event_name == 'push' || (github.event.pull_request.head.repo.fork == (github.event_name == 'pull_request_target'))

permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for pushing data to the
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.9"]

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true

- name: Configure git user SuperAGI-Bot
run: |
git config --global user.name "SuperAGI-Bot"
git config --global user.email "github-bot@superagi.com"

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi

- name: Test with pytest
run: |
pytest --cov=superagi --cov-branch --cov-report term-missing --cov-report xml \
tests/unit_tests -s
env:
CI: true
ENV: DEV
PLAIN_OUTPUT: True
REDIS_URL: "localhost:6379"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: local
hooks:
- id: pylint
name: pylint
entry: pylint
language: system
types: [python]
174 changes: 86 additions & 88 deletions gui/pages/Content/Agents/ActionConsole.js
Original file line number Diff line number Diff line change
@@ -1,116 +1,114 @@
import React, { useState, useEffect } from 'react';
import styles from './Agents.module.css';
import Image from "next/image";
import Image from 'next/image';
import { updatePermissions } from '@/pages/api/DashboardService';
import { formatTime } from '@/utils/utils';

function ActionBox({ action, index, denied, reasons, handleDeny, handleSelection, setReasons }) {
const isDenied = denied[index];

return (
<div key={action.id} className={styles.history_box} style={{ background: '#272335', padding: '16px', cursor: 'default' }}>
<div style={{ display: 'flex', flexDirection: 'column' }}>
<div>Tool <b>{action.tool_name}</b> is seeking for Permissions</div>
{isDenied && (
<div style={{ marginTop: '26px' }}>
<div>Provide Feedback <span style={{ color: '#888888' }}>(Optional)</span></div>
<input style={{ marginTop: '6px' }} type="text" value={reasons[index]} placeholder="Enter your input here" className="input_medium"
onChange={(e) => {
const newReasons = [...reasons];
newReasons[index] = e.target.value;
setReasons(newReasons);
}}/>
</div>
)}
{isDenied ? (
<div style={{ display: 'inline-flex', marginTop: '16px', gap: '8px' }}>
<button onClick={() => handleDeny(index)} className="secondary_button" style={{ paddingLeft: '10px', paddingTop: '2px' }}>
<Image style={{ marginTop: '2px' }} width={12} height={12} src="/images/undo.svg" alt="check-icon" />
<span className={styles.text_12_n}>Go Back</span>
</button>
<button onClick={() => handleSelection(index, false, action.id)} className="secondary_button" style={{ paddingLeft: '10px', paddingTop: '2px', background: 'transparent', border: 'none' }}>
<span className={styles.text_12_n}>Proceed to Deny</span>
</button>
</div>
) : (
<div style={{ display: 'inline-flex', marginTop: '16px', gap: '8px' }}>
<button onClick={() => handleSelection(index, true, action.id)} className="secondary_button" style={{ paddingLeft: '10px', paddingTop: '2px' }}>
<Image style={{ marginTop: '4px' }} width={12} height={12} src="/images/check.svg" alt="check-icon" />
<span className={styles.text_12_n}>Approve</span>
</button>
<button onClick={() => handleDeny(index)} className="secondary_button" style={{ paddingLeft: '10px', paddingTop: '2px', background: 'transparent', border: 'none' }}>
<Image style={{ marginTop: '4px' }} width={16} height={16} src="/images/close.svg" alt="close-icon" />
<span className={styles.text_12_n}>Deny</span>
</button>
</div>
)}
</div>
<div style={{ display: 'flex', alignItems: 'center', paddingLeft: '0', paddingBottom: '0' }} className={styles.tab_text}>
<div>
<Image width={12} height={12} src="/images/schedule.svg" alt="schedule-icon" />
</div>
<div className={styles.history_info}>{formatTime(action.created_at)}</div>
</div>
</div>
);
}

export default function ActionConsole({ actions }) {
const [hiddenActions, setHiddenActions] = useState([]);
const [reasons, setReasons] = useState(actions.map(() => ''));
const [localActions, setLocalActions] = useState(actions);
const [denied, setDenied] = useState([]);
const [reasons, setReasons] = useState([]);
const [localActionIds, setLocalActionIds] = useState([]);

useEffect(() => {
const updatedActions = actions.filter(
(action) => !localActionIds.includes(action.id)
);

if (updatedActions.length > 0) {
setLocalActions(
localActions.map((localAction) =>
updatedActions.find(({ id }) => id === localAction.id) || localAction
)
);

const updatedDenied = updatedActions.map(() => false);
const updatedReasons = updatedActions.map(() => '');
const updatedActions = actions?.filter((action) => !localActionIds.includes(action.id));

setDenied((prev) => prev.map((value, index) => updatedDenied[index] || value));
setReasons((prev) => prev.map((value, index) => updatedReasons[index] || value));
if (updatedActions && updatedActions.length > 0) {
setLocalActionIds((prevIds) => [...prevIds, ...updatedActions.map(({ id }) => id)]);

setLocalActionIds([...localActionIds, ...updatedActions.map(({ id }) => id)]);
setDenied((prevDenied) => prevDenied.map((value, index) => updatedActions[index] ? false : value));
setReasons((prevReasons) => prevReasons.map((value, index) => updatedActions[index] ? '' : value));
}
}, [actions]);

const handleDeny = index => {
const newDeniedState = [...denied];
newDeniedState[index] = !newDeniedState[index];
setDenied(newDeniedState);
};

const formatDate = (dateString) => {
const now = new Date();
const date = new Date(dateString);
const seconds = Math.floor((now - date) / 1000);
const minutes = Math.floor(seconds / 60);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
const weeks = Math.floor(days / 7);
const months = Math.floor(days / 30);
const years = Math.floor(days / 365);

if (years > 0) return `${years} yr${years === 1 ? '' : 's'}`;
if (months > 0) return `${months} mon${months === 1 ? '' : 's'}`;
if (weeks > 0) return `${weeks} wk${weeks === 1 ? '' : 's'}`;
if (days > 0) return `${days} day${days === 1 ? '' : 's'}`;
if (hours > 0) return `${hours} hr${hours === 1 ? '' : 's'}`;
if (minutes > 0) return `${minutes} min${minutes === 1 ? '' : 's'}`;

return `${seconds} sec${seconds === 1 ? '' : 's'}`;
const handleDeny = (index) => {
setDenied((prevDenied) => {
const newDeniedState = [...prevDenied];
newDeniedState[index] = !newDeniedState[index];
return newDeniedState;
});
};

const handleSelection = (index, status, permissionId) => {
setHiddenActions([...hiddenActions, index]);
setHiddenActions((prevHiddenActions) => [...prevHiddenActions, index]);

const data = {
status: status,
user_feedback: reasons[index],
};

updatePermissions(permissionId, data).then((response) => {
console.log("voila")
});
updatePermissions(permissionId, data).then((response) => {});
};

return (
<>
{actions.some(action => action.status === "PENDING") ? (<div className={styles.detail_body} style={{ height: "auto" }}>
{actions.map((action, index) => action.status === "PENDING" && !hiddenActions.includes(index) && (
<div key={index} className={styles.history_box} style={{ background: "#272335", padding: "16px", cursor: "default" }}>
<div style={{ display: "flex", flexDirection: 'column' }}>
<div>Tool <b>{action.tool_name}</b> is seeking for Permissions</div>
{denied[index] && (
<div style={{marginTop: '26px' }}>
<div>Provide Feedback <span style={{color: '#888888'}}>(Optional)</span></div>
<input style={{marginTop: '6px'}} type="text" value={reasons[index]} onChange={(e) => {const newReasons = [...reasons];newReasons[index] = e.target.value;setReasons(newReasons);}} placeholder="Enter your input here" className="input_medium" />
</div>
)}
{denied[index] ? (
<div style={{ display: "inline-flex", marginTop: '16px',gap: '8px' }}>
<button onClick={() => handleDeny(index)} className="secondary_button"><Image width={12} height={12} src="/images/undo.svg" alt="check-icon" /><span className={styles.text_12_n}>Go Back</span></button>
<button onClick={() => handleSelection(index, false, action.id)} className="secondary_button" style={{ marginLeft: "4px", padding: "5px", background: "transparent", border: "none" }}><span className={styles.text_12_n}>Proceed to Deny</span></button>
</div>
) : (
<div style={{ display: "inline-flex", marginTop: '16px',gap: '8px' }}>
<button onClick={() => handleSelection(index, true, action.id)} className="secondary_button"><Image width={12} height={12} src="/images/check.svg" alt="check-icon" /><span className={styles.text_12_n}>Approve</span></button>
<button onClick={() => handleDeny(index)} className="secondary_button" style={{ marginLeft: "4px", padding: "5px", background: "transparent", border: "none" }}><Image width={16} height={16} src="/images/close.svg" alt="close-icon" /><div className={styles.text_12_n}>Deny</div></button>
</div>
)}
</div>
<div style={{ display: "flex", alignItems: "center", paddingLeft: "0", paddingBottom: "0" }} className={styles.tab_text}>
<div>
<Image width={12} height={12} src="/images/schedule.svg" alt="schedule-icon" />
</div>
<div className={styles.history_info}>{formatDate(action.created_at)}</div>
</div>
</div>
))}
</div>):
(
<div style={{display:'flex',flexDirection:'column',alignItems:'center',marginTop:'40px'}}>
<Image width={150} height={60} src="/images/no_permissions.svg" alt="no permissions" />
<span className={styles.feed_title} style={{marginTop: '8px'}}>No Actions to Display!</span>
</div>)}
</>
<>
{actions?.some((action) => action.status === 'PENDING') ? (
<div className={styles.detail_body} style={{ height: 'auto' }}>
{actions.map((action, index) => {
if (action.status === 'PENDING' && !hiddenActions.includes(index)) {
return (<ActionBox key={action.id} action={action} index={index} denied={denied} setReasons={setReasons}
reasons={reasons} handleDeny={handleDeny} handleSelection={handleSelection}/>);
}
return null;
})}
</div>
) : (
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', marginTop: '40px' }}>
<Image width={150} height={60} src="/images/no_permissions.svg" alt="no-permissions" />
<span className={styles.feed_title} style={{ marginTop: '8px' }}>No Actions to Display!</span>
</div>
)}
</>
);
}
}
12 changes: 2 additions & 10 deletions gui/pages/Content/Agents/ActivityFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, {useEffect, useRef, useState} from 'react';
import styles from './Agents.module.css';
import {getExecutionFeeds} from "@/pages/api/DashboardService";
import Image from "next/image";
import {formatTime} from "@/utils/utils";
import {formatTime, loadingTextEffect} from "@/utils/utils";
import {EventBus} from "@/utils/eventBus";

export default function ActivityFeed({selectedRunId, selectedView, setFetchedData }) {
Expand All @@ -13,15 +13,7 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
const [prevFeedsLength, setPrevFeedsLength] = useState(0);

useEffect(() => {
const text = 'Thinking';
let dots = '';

const interval = setInterval(() => {
dots = dots.length < 3 ? dots + '.' : '';
setLoadingText(`${text}${dots}`);
}, 250);

return () => clearInterval(interval);
loadingTextEffect('Thinking', setLoadingText, 250);
}, []);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/Agents/AgentCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ export default function AgentCreate({sendAgentData, selectedProjectId, fetchAgen
<div className="custom_select_container" onClick={() => setPermissionDropdown(!permissionDropdown)} style={{width:'100%'}}>
{permission}<Image width={20} height={21} src={!permissionDropdown ? '/images/dropdown_down.svg' : '/images/dropdown_up.svg'} alt="expand-icon"/>
</div>
<div>
<div style={{marginBottom: '20px'}}>
{permissionDropdown && <div className="custom_select_options" ref={permissionRef} style={{width:'100%'}}>
{permissions.map((permit, index) => (<div key={index} className="custom_select_option" onClick={() => handlePermissionSelect(index)} style={{padding:'12px 14px',maxWidth:'100%'}}>
{permit}
Expand Down
6 changes: 3 additions & 3 deletions gui/pages/Content/Agents/AgentTemplatesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ export default function AgentTemplatesList({sendAgentData, selectedProjectId, fe
</div>
</div>
<div className={styles.rowContainer} style={{maxHeight: '78vh',overflowY: 'auto',marginTop:'10px',marginLeft:'3px'}}>
{agentTemplates.length > 0 ? <div className={styles.resources} style={agentTemplates.length === 1 ? {justifyContent:'flex-start',gap:'7px'} : {}}>
{agentTemplates.map((item, index) => (
{agentTemplates.length > 0 ? <div className={styles.resources}>
{agentTemplates.map((item) => (
<div className={styles.market_tool} key={item.id} style={{cursor: 'pointer',height:'90px'}}
onClick={() => handleTemplateClick(item)}>
<div style={{display: 'inline',overflow:'auto'}}>
Expand All @@ -61,7 +61,7 @@ export default function AgentTemplatesList({sendAgentData, selectedProjectId, fe
<div className={styles.market_tool} style={{cursor: 'pointer',height:'90px',background:'#413C4F'}}
onClick={openMarketplace}>
<div style={{display: 'inline',overflow:'auto'}}>
<div style={{display:'flex',justifyContent:'space-between'}}>
<div style={{display:'flex',justifyContent:'flex-start',gap:'0.3vw'}}>
<div style={{order:'0'}}><Image style={{marginTop:'-3px'}} width={16} height={16} src="/images/marketplace.svg" alt="arrow-outward"/>&nbsp;&nbsp;Browse templates from marketplace</div>
<div style={{order:'1'}}><Image style={{marginTop:'-3px'}} width={16} height={16} src="/images/arrow_outward.svg" alt="arrow-outward"/></div>
</div>
Expand Down
Loading