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

Maintaining dev #1244

Merged
merged 7 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
11 changes: 4 additions & 7 deletions gui/pages/Content/Agents/ActivityFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
const [scheduleTime, setScheduleTime] = useState(null);
const [isLoading, setIsLoading] = useState(true);
const [waitingPeriod, setWaitingPeriod] = useState(null);
const [waitingPeriodOver, setWaitingPeriodOver] = useState(null);
const [errorMsg, setErrorMsg] = useState('');

useEffect(() => {
const interval = window.setInterval(function () {
if (selectedRunStatus === "RUNNING") {
if (selectedRunStatus !== "ERROR_PAUSED") {
fetchFeeds();
}
}, 5000);
Expand Down Expand Up @@ -78,16 +77,14 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
EventBus.emit('reFetchAgents', {});
}, [runStatus])

useEffect(() => {
setWaitingPeriodOver(updateDateBasedOnValue(convertWaitingPeriod(waitingPeriod)))
}, [waitingPeriod]);

function fetchFeeds() {
if (selectedRunId !== null) {
setIsLoading(true);
getExecutionFeeds(selectedRunId)
.then((response) => {
const data = response.data;
console.log(data)
console.log(data.status)
setFeeds(data.feeds);
setErrorMsg(data.errors)
setRunStatus(data.status);
Expand Down Expand Up @@ -157,7 +154,7 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
<div className="history_box padding_20 cursor_default bg_secondary">
<div style={{display: 'flex'}}>
<div className="fs_20 lh_24">⏳</div>
<div className={styles.feed_title}>Waiting Block Initiated. The Agent will wait for {convertWaitingPeriod(waitingPeriod) || null} and continue on {waitingPeriodOver || 'soon'}</div>
<div className={styles.feed_title}>Waiting Block Initiated. The Agent will wait for {convertWaitingPeriod(waitingPeriod) || null}</div>
</div>
</div>}
{runStatus === 'RUNNING' &&
Expand Down
40 changes: 20 additions & 20 deletions gui/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,23 +523,23 @@ export const convertWaitingPeriod = (waitingPeriod) => {
return convertedValue + ' ' + unit;
}

export const updateDateBasedOnValue = (convertedValue, inputDate = new Date()) => {
const [value, unit] = convertedValue.split(' ');
const unitConversion = {
'seconds': 1000,
'minutes': 1000 * 60,
'hours': 1000 * 60 * 60,
'days': 1000 * 60 * 60 * 24,
'weeks': 1000 * 60 * 60 * 24 * 7
};

const updatedDate = new Date(inputDate.getTime() + parseInt(value, 10) * unitConversion[unit]);

return updatedDate.toLocaleString('en-US', {
day: 'numeric',
month: 'long',
year: 'numeric',
hour: 'numeric',
minute: 'numeric'
});
}
// export const updateDateBasedOnValue = (convertedValue, inputDate = new Date()) => {
// const [value, unit] = convertedValue.split(' ');
// const unitConversion = {
// 'seconds': 1000,
// 'minutes': 1000 * 60,
// 'hours': 1000 * 60 * 60,
// 'days': 1000 * 60 * 60 * 24,
// 'weeks': 1000 * 60 * 60 * 24 * 7
// };
//
// const updatedDate = new Date(inputDate.getTime() + parseInt(value, 10) * unitConversion[unit]);
//
// return updatedDate.toLocaleString('en-US', {
// day: 'numeric',
// month: 'long',
// year: 'numeric',
// hour: 'numeric',
// minute: 'numeric'
// });
// }
3 changes: 2 additions & 1 deletion superagi/agent/agent_iteration_step_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@
print("Decoding JSON has failed")
tool_name = ''

CallLogHelper(session=self.session, organisation_id=organisation.id).create_call_log(execution.name,agent_config['agent_id'],total_tokens, tool_name,agent_config['model'])
CallLogHelper(session=self.session, organisation_id=organisation.id).create_call_log(execution.name,

Check warning on line 93 in superagi/agent/agent_iteration_step_handler.py

View check run for this annotation

Codecov / codecov/patch

superagi/agent/agent_iteration_step_handler.py#L93

Added line #L93 was not covered by tests
agent_config['agent_id'], total_tokens, tool_name, agent_config['model'])

assistant_reply = response['content']
output_handler = get_output_handler(iteration_workflow_step.output_type,
Expand Down