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

Schedule #733

Merged
merged 75 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
3bf7302
done
Vibhusha22 Jun 30, 2023
6598563
m
Vibhusha22 Jun 30, 2023
fddd5bc
m
Vibhusha22 Jun 30, 2023
7631e19
css
Vibhusha22 Jun 30, 2023
b647209
conflict resolved
NishantBorthakur Jun 30, 2023
a8350bd
Merge branch 'Schedule' of https://github.com/TransformerOptimus/Supe…
Vibhusha22 Jun 30, 2023
43dd417
minor fixes
NishantBorthakur Jun 30, 2023
3eb3068
minor fixes
NishantBorthakur Jun 30, 2023
9e3e3d1
minor fixes
NishantBorthakur Jun 30, 2023
b149dd5
Merge branch 'Schedule' of github.com:TransformerOptimus/SuperAGI int…
NishantBorthakur Jul 3, 2023
8d11c77
local storage to schedule run
NishantBorthakur Jul 3, 2023
bd5898d
minor fix
NishantBorthakur Jul 3, 2023
3b38af3
Edit Schedule
Vibhusha22 Jul 3, 2023
908181e
EditSchedule
Vibhusha22 Jul 3, 2023
fd34037
stopsch
Vibhusha22 Jul 4, 2023
8c48fe7
m
Vibhusha22 Jul 4, 2023
dcc2053
resolved confilcts
NishantBorthakur Jul 4, 2023
fd9c1bc
m
Vibhusha22 Jul 4, 2023
d2a590b
m
Vibhusha22 Jul 4, 2023
a1f75ac
m
Vibhusha22 Jul 4, 2023
e81f32b
editsch
Vibhusha22 Jul 5, 2023
2869b82
m
Vibhusha22 Jul 5, 2023
2214dc5
editdone
Vibhusha22 Jul 5, 2023
348a392
is_scheduled
Vibhusha22 Jul 6, 2023
a728e4c
devpull
Vibhusha22 Jul 6, 2023
70f2fef
integration
Vibhusha22 Jul 6, 2023
b1ad7ea
m
Vibhusha22 Jul 6, 2023
7f27fbb
minor fix
NishantBorthakur Jul 6, 2023
ddf49a4
scheduledactivityfeed
Vibhusha22 Jul 7, 2023
46444df
calendar
Vibhusha22 Jul 7, 2023
35b9528
devpull
Vibhusha22 Jul 7, 2023
370bce9
schedulecard
Vibhusha22 Jul 8, 2023
b1036fc
merged with dev
CoffeeCoder16 Jul 10, 2023
87486cf
resolved errors
CoffeeCoder16 Jul 10, 2023
95c1b9b
fixed bug of schedule print
CoffeeCoder16 Jul 10, 2023
d985036
FInal Touches
Vibhusha22 Jul 11, 2023
b0c7e0a
m
Vibhusha22 Jul 12, 2023
0f027a3
m
Vibhusha22 Jul 12, 2023
b5c4a44
devpull
Vibhusha22 Jul 12, 2023
f4038ff
Making schedule agent a component
namansleeps2 Jul 12, 2023
5fdb0c7
testedbugs
Vibhusha22 Jul 12, 2023
6495aa5
component pull
Vibhusha22 Jul 12, 2023
1392fd6
m
Vibhusha22 Jul 12, 2023
6e95b5f
minor
Vibhusha22 Jul 12, 2023
6b9935f
Making schedule agent a component completing
namansleeps2 Jul 12, 2023
dc09ad1
git pull
namansleeps2 Jul 12, 2023
6d99007
final changes
namansleeps2 Jul 12, 2023
4070959
final changes2
namansleeps2 Jul 12, 2023
44c1c10
final changes last
namansleeps2 Jul 12, 2023
648ee24
Update docker-compose.yaml
namansleeps Jul 12, 2023
a51c53e
mergin with dev
namansleeps2 Jul 12, 2023
eaa274f
Merge remote-tracking branch 'origin/Schedule' into Schedule
namansleeps2 Jul 12, 2023
86b5029
minor changes
namansleeps2 Jul 12, 2023
0ce2bc3
minor changes
namansleeps2 Jul 12, 2023
212fe94
adding of schedule details to detials file
namansleeps2 Jul 12, 2023
d544ce5
final toches
namansleeps2 Jul 12, 2023
ee8bd9d
final touches
namansleeps2 Jul 12, 2023
cbd4171
merging with dev
namansleeps2 Jul 12, 2023
62d6076
displaying scheduling in details page
namansleeps2 Jul 13, 2023
5d95753
minor changes
namansleeps2 Jul 13, 2023
97d22a7
Merge branch 'dev' of github.com:TransformerOptimus/SuperAGI into Sch…
namansleeps2 Jul 13, 2023
fe2afcb
Fixed agent_config_detail
luciferlinx101 Jul 13, 2023
6d2be69
goal is coming now
namansleeps2 Jul 13, 2023
34369db
Merge remote-tracking branch 'origin/Schedule' into Schedule
namansleeps2 Jul 13, 2023
87a0404
code refactoring
NishantBorthakur Jul 13, 2023
8ee9aa4
reverted docker compose yaml change
NishantBorthakur Jul 13, 2023
13f1b09
reverted docker compose yaml change
NishantBorthakur Jul 13, 2023
2176444
code indentation issues
NishantBorthakur Jul 13, 2023
5c662d1
minor fix
NishantBorthakur Jul 13, 2023
fa7c1de
checking of expiry date
namansleeps2 Jul 13, 2023
f5023be
Merge remote-tracking branch 'origin/Schedule' into Schedule
namansleeps2 Jul 13, 2023
dc00298
checking of expiry date
namansleeps2 Jul 13, 2023
a25a530
minor date fixed
namansleeps2 Jul 13, 2023
39e7af0
merge with dev
namansleeps2 Jul 13, 2023
bbf3080
minor fix
NishantBorthakur Jul 13, 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
34 changes: 34 additions & 0 deletions gui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions gui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
"eslint-config-next": "13.4.2",
"jszip": "^3.10.1",
"mitt": "^3.0.0",
"moment": "^2.29.4",
"moment-timezone": "^0.5.43",
"next": "13.4.2",
"react": "18.2.0",
"react-datetime": "^3.2.0",
"react-dom": "18.2.0",
"react-markdown": "^8.0.7",
"react-toastify": "^9.1.3"
Expand Down
171 changes: 110 additions & 61 deletions gui/pages/Content/Agents/ActivityFeed.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,53 @@
import React, {useEffect, useRef, useState} from 'react';
import styles from './Agents.module.css';
import {getExecutionFeeds} from "@/pages/api/DashboardService";
import {getExecutionFeeds, getDateTime} from "@/pages/api/DashboardService";
import Image from "next/image";
import {loadingTextEffect, formatTimeDifference} from "@/utils/utils";
import {EventBus} from "@/utils/eventBus";

export default function ActivityFeed({selectedRunId, selectedView, setFetchedData, runModal }) {
export default function ActivityFeed({selectedRunId, selectedView, setFetchedData, agent}) {
const [loadingText, setLoadingText] = useState("Thinking");
const [feeds, setFeeds] = useState([]);
const feedContainerRef = useRef(null);
const [runStatus, setRunStatus] = useState("CREATED");
const [prevFeedsLength, setPrevFeedsLength] = useState(0);
const [scheduleDate, setScheduleDate] = useState(null);
const [scheduleTime, setScheduleTime] = useState(null);

useEffect(() => {
loadingTextEffect('Thinking', setLoadingText, 250);
}, []);

useEffect(() => {
const interval = window.setInterval(function(){
fetchFeeds();
const interval = window.setInterval(function () {
fetchFeeds();
}, 10000);

return () => clearInterval(interval);
}, [selectedRunId]);

function fetchDateTime() {
getDateTime(agent.id)
.then((response) => {
const {start_date, start_time} = response.data;
setScheduleDate(start_date);
setScheduleTime(start_time);
})
.catch((error) => {
console.error('Error fetching agent data:', error);
});
}

useEffect(() => {
loadingTextEffect('Thinking', setLoadingText, 250);

if (agent.is_scheduled && !agent.is_running) {
fetchDateTime();
}
}, []);

useEffect(() => {
if (feeds.length !== prevFeedsLength) {
if (feedContainerRef.current) {
setTimeout(() => {
if(feedContainerRef.current !== null) {
feedContainerRef.current.scrollTo({ top: feedContainerRef.current.scrollHeight, behavior: 'smooth' });
if (feedContainerRef.current !== null) {
feedContainerRef.current.scrollTo({top: feedContainerRef.current.scrollHeight, behavior: 'smooth'});
setPrevFeedsLength(feeds.length);
}
}, 100);
Expand All @@ -40,7 +58,7 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
function scrollToTop() {
if (feedContainerRef.current) {
setTimeout(() => {
feedContainerRef.current.scrollTo({ top: 0, behavior: 'smooth' });
feedContainerRef.current.scrollTo({top: 0, behavior: 'smooth'});
}, 100);
}
}
Expand All @@ -55,78 +73,109 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat

function fetchFeeds() {
getExecutionFeeds(selectedRunId)
.then((response) => {
const data = response.data;
setFeeds(data.feeds);
setRunStatus(data.status);
setFetchedData(data.permissions);
EventBus.emit('resetRunStatus', {executionId: selectedRunId, status: data.status});
})
.catch((error) => {
console.error('Error fetching execution feeds:', error);
});
.then((response) => {
const data = response.data;
setFeeds(data.feeds);
setRunStatus(data.status);
setFetchedData(data.permissions);
EventBus.emit('resetRunStatus', {executionId: selectedRunId, status: data.status});
})
.catch((error) => {
console.error('Error fetching execution feeds:', error);
});
}

useEffect(() => {
const updateRunStatus = (eventData) => {
if(eventData.selectedRunId === selectedRunId) {
if (eventData.selectedRunId === selectedRunId) {
setRunStatus(eventData.status);
}
};
const refreshDate = () => {
fetchDateTime();
};

EventBus.on('updateRunStatus', updateRunStatus);
EventBus.on('refreshDate', refreshDate);

return () => {
EventBus.off('updateRunStatus', updateRunStatus);
EventBus.off('refreshDate', refreshDate);
};
});

return (<>
<div style={{overflowY: "auto",maxHeight:'80vh',position:'relative'}} ref={feedContainerRef}>
<div style={{marginBottom:'55px'}}>
{feeds && feeds.map((f, index) => (<div key={index} className={styles.history_box} style={{background:'#272335',padding:'20px',cursor:'default'}}>
<div style={{display:'flex'}}>
{f.role === 'user' && <div className={styles.feed_icon}>💁</div>}
{f.role === 'system' && <div className={styles.feed_icon}>🛠️ </div>}
{f.role === 'assistant' && <div className={styles.feed_icon}>💡</div>}
<div className={styles.feed_title}>{f?.feed || ''}</div>
</div>
<div className={styles.more_details_wrapper}>
{f.time_difference && <div className={styles.more_details}>
<div style={{display: 'flex', alignItems: 'center'}}>
<div>
<Image width={12} height={12} src="/images/schedule.svg" alt="schedule-icon"/>
<div style={{overflowY: "auto", maxHeight: '80vh', position: 'relative'}} ref={feedContainerRef}>
<div style={{marginBottom: '55px'}}>
{agent.is_scheduled && !agent.is_running && !selectedRunId ?
<div style={{display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center'}}>
<Image width={72} height={72} src="/images/eventSchedule.png" alt="github"/>
<div style={{color: 'white', fontSize: '14px'}}>
This agent is scheduled to start on {scheduleDate}, at {scheduleTime}
</div>
</div> : <div>
{feeds && feeds.map((f, index) => (<div key={index} className={styles.history_box}
style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
{f.role === 'user' && <div className={styles.feed_icon}>💁</div>}
{f.role === 'system' && <div className={styles.feed_icon}>🛠️ </div>}
{f.role === 'assistant' && <div className={styles.feed_icon}>💡</div>}
<div className={styles.feed_title}>{f?.feed || ''}</div>
</div>
<div className={styles.more_details_wrapper}>
{f.time_difference && <div className={styles.more_details}>
<div style={{display: 'flex', alignItems: 'center'}}>
<div>
<Image width={12} height={12} src="/images/schedule.svg" alt="schedule-icon"/>
</div>
<div className={styles.history_info}>
{formatTimeDifference(f.time_difference)}
</div>
</div>
</div>}
</div>
</div>))}
{runStatus === 'RUNNING' &&
<div className={styles.history_box} style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
<div style={{fontSize: '20px'}}>🧠</div>
<div className={styles.feed_title}><i>{loadingText}</i></div>
</div>
<div className={styles.history_info}>
{formatTimeDifference(f.time_difference)}
</div>}
{runStatus === 'COMPLETED' &&
<div className={styles.history_box} style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
<div style={{fontSize: '20px'}}>🏁</div>
<div className={styles.feed_title}><i>All goals completed successfully!</i></div>
</div>
</div>
</div>}
</div>
</div>))}
{runStatus === 'RUNNING' && <div className={styles.history_box} style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
<div style={{fontSize: '20px'}}>🧠</div>
<div className={styles.feed_title}><i>{loadingText}</i></div>
</div>
</div>}
{runStatus === 'COMPLETED' && <div className={styles.history_box} style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
<div style={{fontSize: '20px'}}>🏁</div>
<div className={styles.feed_title}><i>All goals completed successfully!</i></div>
</div>}
{runStatus === 'ITERATION_LIMIT_EXCEEDED' &&
<div className={styles.history_box} style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
<div style={{fontSize: '20px'}}>⚠️</div>
<div className={styles.feed_title}><i>Stopped: Maximum iterations exceeded!</i></div>
</div>
</div>}
</div>
</div>}
{runStatus === 'ITERATION_LIMIT_EXCEEDED' && <div className={styles.history_box} style={{background: '#272335', padding: '20px', cursor: 'default'}}>
<div style={{display: 'flex'}}>
<div style={{fontSize: '20px'}}>⚠️</div>
<div className={styles.feed_title}><i>Stopped: Maximum iterations exceeded!</i></div>
}
{!agent.is_scheduled && !agent.is_running && feeds.length < 1 &&
<div style={{
color: 'white',
fontSize: '14px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
textAlign: 'center'
}}>
The Agent is not scheduled
</div>
</div>}
}
</div>
{feedContainerRef.current && feedContainerRef.current.scrollTop >= 1200 &&
<div className="back_to_top" onClick={scrollToTop} style={selectedView !== '' ? {right:'calc(39% - 5vw)'} : {right:'39%'}}>
<Image width={15} height={15} src="/images/backtotop.svg" alt="back-to-top"/>
</div>}
<div className="back_to_top" onClick={scrollToTop}
style={selectedView !== '' ? {right: 'calc(39% - 5vw)'} : {right: '39%'}}>
<Image width={15} height={15} src="/images/backtotop.svg" alt="back-to-top"/>
</div>}
</div>
</>)
}
Loading
Loading