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 fixes #869

Merged
merged 6 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
40 changes: 32 additions & 8 deletions gui/pages/Content/APM/ApmDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ export default function ApmDashboard(key) {
<tbody>
{toolsUsed.map((tool, index) => (
<tr key={index}>
<td className="table_data" style={{width: '100%', display:'flex', alignItems:'center'}}>
<Image className="image_class" style={{background: 'black'}} width={20} height={20} src={returnToolkitIcon(tool.toolkit)} alt="tool-icon"/>
<td className="table_data" style={{width: '100%', display: 'flex', alignItems: 'center'}}>
<Image className="image_class" style={{background: 'black'}} width={20} height={20}
src={returnToolkitIcon(tool.toolkit)} alt="tool-icon"/>
<span>{tool.tool_name}</span>
</td>
<td className="table_data text_align_right" style={{width: '22%'}}>{tool.unique_agents}</td>
Expand All @@ -248,14 +249,37 @@ export default function ApmDashboard(key) {
<thead>
<tr style={{borderTop: 'none'}}>
<th className="table_header" style={{width: '20%'}}>Agent Name</th>
<th className="table_header text_align_right" style={{width: '10%'}}>Model <img width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '12%'}}>Tokens Consumed <img width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '6%'}}>Runs <img width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '10%'}}>Model <img width={14}
height={14}
src="/images/arrow_downward.svg"
alt="arrow_down"/>
</th>
<th className="table_header text_align_right" style={{width: '12%'}}>Tokens Consumed <img width={14}
height={14}
src="/images/arrow_downward.svg"
alt="arrow_down"/>
</th>
<th className="table_header text_align_right" style={{width: '6%'}}>Runs <img width={14} height={14}
src="/images/arrow_downward.svg"
alt="arrow_down"/>
</th>
<th className="table_header text_align_right" style={{width: '12%'}}>Avg tokens per run <img
width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '20%'}}>Tools <img width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '10%'}}>Calls <img width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '10%'}}>Avg Run Time <img width={14} height={14} src="/images/arrow_downward.svg" alt="arrow_down"/></th>
<th className="table_header text_align_right" style={{width: '20%'}}>Tools <img width={14}
height={14}
src="/images/arrow_downward.svg"
alt="arrow_down"/>
</th>
<th className="table_header text_align_right" style={{width: '10%'}}>Calls <img width={14}
height={14}
src="/images/arrow_downward.svg"
alt="arrow_down"/>
</th>
<th className="table_header text_align_right" style={{width: '10%'}}>Avg Run Time <img width={14}
height={14}
src="/images/arrow_downward.svg"
alt="arrow_down"/>
</th>
</tr>
</thead>
</table>
Expand Down
21 changes: 15 additions & 6 deletions gui/pages/Content/Agents/ActivityFeed.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {getExecutionFeeds, getDateTime} from "@/pages/api/DashboardService";
import Image from "next/image";
import {loadingTextEffect, formatTimeDifference} from "@/utils/utils";
import {EventBus} from "@/utils/eventBus";
import { ClipLoader } from 'react-spinners';
import {ClipLoader} from 'react-spinners';

export default function ActivityFeed({selectedRunId, selectedView, setFetchedData, agent}) {
const [loadingText, setLoadingText] = useState("Thinking");
Expand Down Expand Up @@ -121,7 +121,8 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
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'}}>
{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>}
Expand Down Expand Up @@ -165,11 +166,19 @@ export default function ActivityFeed({selectedRunId, selectedView, setFetchedDat
</div>
}
{feeds.length < 1 && !agent?.is_running && !agent?.is_scheduled ?
(isLoading ?
(isLoading ?
<div style={{display: 'flex', justifyContent: 'center', alignItems: 'center', height: '100vh'}}>
<ClipLoader/>
</div>
: <div style={{color: 'white', fontSize: '14px', display: 'flex', flexDirection: 'column', alignItems: 'center', textAlign: 'center', width: '100%'}}>The Agent is not scheduled</div>): null
<ClipLoader/>
</div>
: <div style={{
color: 'white',
fontSize: '14px',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
textAlign: 'center',
width: '100%'
}}>The Agent is not scheduled</div>) : null
}
</div>
{feedContainerRef.current && feedContainerRef.current.scrollTop >= 1200 &&
Expand Down
38 changes: 24 additions & 14 deletions gui/pages/Content/Agents/AgentCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
openNewTab,
removeTab,
setLocalStorageValue,
setLocalStorageArray, returnResourceIcon, getUserTimezone, createInternalId,preventDefault,excludedToolkits
setLocalStorageArray, returnResourceIcon, getUserTimezone, createInternalId, preventDefault, excludedToolkits
} from "@/utils/utils";
import {EventBus} from "@/utils/eventBus";
import styles from "@/pages/Content/Agents/Agents.module.css";
Expand Down Expand Up @@ -146,7 +146,7 @@ export default function AgentCreate({
const models = response.data || [];
const selected_model = localStorage.getItem("agent_model_" + String(internalId)) || '';
setModelsArray(models);
if(models.length > 0 && !selected_model) {
if (models.length > 0 && !selected_model) {
setLocalStorageValue("agent_model_" + String(internalId), models[0], setModel);
} else {
setModel(selected_model);
Expand Down Expand Up @@ -424,7 +424,7 @@ export default function AgentCreate({
return false;
}

if(!modelsArray.includes(model)) {
if (!modelsArray.includes(model)) {
toast.error("Your key does not have access to the selected model", {autoClose: 1800});
return false;
}
Expand Down Expand Up @@ -466,7 +466,7 @@ export default function AgentCreate({
"permission_type": permission_type,
"LTM_DB": longTermMemory ? database : null,
"user_timezone": getUserTimezone(),
"knowledge" : toolNames.includes('Knowledge Search') ? selectedKnowledgeId : null,
"knowledge": toolNames.includes('Knowledge Search') ? selectedKnowledgeId : null,
};

const scheduleAgentData = {
Expand Down Expand Up @@ -859,16 +859,23 @@ export default function AgentCreate({
style={{width: '100%', alignItems: 'flex-start'}}>
<div style={{display: 'flex', flexWrap: 'wrap', width: '100%', alignItems: 'start'}}>
{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_light.svg' alt="close-icon"
style={{margin: '-2px -5px 0 2px'}} onClick={() => removeTool(index)}/></div>
</div>
<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"
style={{margin: '-2px -5px 0 2px'}} onClick={() => removeTool(index)}/></div>
</div>
))}
<input type="text" className="dropdown_search_text" value={searchValue} style={{flexGrow: 1}} onChange={(e) => setSearchValue(e.target.value)}
onFocus={() => {setToolkitDropdown(true);setShowPlaceholder(false);}} onBlur={() => {setShowPlaceholder(true);}}
onClick={(e) => e.stopPropagation()}/>
{toolNames && toolNames.length === 0 && showPlaceholder && searchValue.length ===0 && <div style={{color: '#666666',position:'absolute'}}>Select Tools</div>}
<input type="text" className="dropdown_search_text" value={searchValue} style={{flexGrow: 1}}
onChange={(e) => setSearchValue(e.target.value)}
onFocus={() => {
setToolkitDropdown(true);
setShowPlaceholder(false);
}} onBlur={() => {
setShowPlaceholder(true);
}}
onClick={(e) => e.stopPropagation()}/>
{toolNames && toolNames.length === 0 && showPlaceholder && searchValue.length === 0 &&
<div style={{color: '#666666', position: 'absolute'}}>Select Tools</div>}
</div>
<div style={{display: 'inline-flex'}}>
<Image width={20} height={21} onClick={(e) => clearTools(e)} src='/images/clear_input.svg'
Expand Down Expand Up @@ -1202,7 +1209,10 @@ export default function AgentCreate({
</button>
)}
<div style={{display: 'flex', position: 'relative'}}>
{createDropdown && (<div className="create_agent_dropdown_options" onClick={() => {setCreateModal(true);setCreateDropdown(false);}}>Create & Schedule Run
{createDropdown && (<div className="create_agent_dropdown_options" onClick={() => {
setCreateModal(true);
setCreateDropdown(false);
}}>Create & Schedule Run
</div>)}
<div className="primary_button"
style={{backgroundColor: 'white', marginBottom: '4px', paddingLeft: '0', paddingRight: '5px'}}>
Expand Down
10 changes: 9 additions & 1 deletion gui/pages/Content/Agents/AgentSchedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import {agentScheduleComponent, createAndScheduleRun, updateSchedule} from "@/pa
import {EventBus} from "@/utils/eventBus";
import moment from 'moment';

export default function AgentSchedule({internalId, closeCreateModal, type, agentId, setCreateModal, setCreateEditModal, env}) {
export default function AgentSchedule({
internalId,
closeCreateModal,
type,
agentId,
setCreateModal,
setCreateEditModal,
env
}) {
const [isRecurring, setIsRecurring] = useState(false);
const [timeDropdown, setTimeDropdown] = useState(false);
const [expiryDropdown, setExpiryDropdown] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion gui/pages/Content/Agents/AgentTemplatesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export default function AgentTemplatesList({
</div> : <AgentCreate sendKnowledgeData={sendKnowledgeData} knowledge={knowledge} internalId={internalId}
organisationId={organisationId} sendAgentData={sendAgentData}
selectedProjectId={selectedProjectId} fetchAgents={fetchAgents} toolkits={toolkits}
template={sendTemplate} env={env} />}
template={sendTemplate} env={env}/>}
</div>
)
};
14 changes: 11 additions & 3 deletions gui/pages/Content/Agents/AgentWorkspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,25 @@ export default function AgentWorkspace({env, agentId, agentName, selectedView, a
<li className="dropdown_item" onClick={handleStopScheduleClick}>Stop Schedule</li>
</div>) : (<div>
{agent && !agent?.is_running && !agent?.is_scheduled &&
<li className="dropdown_item" onClick={() => {setDropdown(false);setCreateModal(true)}}>Schedule Run</li>}
<li className="dropdown_item" onClick={() => {
setDropdown(false);
setCreateModal(true)
}}>Schedule Run</li>}
</div>)}
<li className="dropdown_item" onClick={() => {setDropdown(false);setDeleteModal(true)}}>Delete Agent</li>
<li className="dropdown_item" onClick={() => {
setDropdown(false);
setDeleteModal(true)
}}>Delete Agent
</li>
</ul>
</div>}

{createModal &&
<AgentSchedule env={env} internalId={internalId} closeCreateModal={closeCreateModal} type="schedule_agent"
agentId={agentId} setCreateModal={() => setCreateModal(false)}/>}
{createEditModal &&
<AgentSchedule env={env} internalId={internalId} closeCreateModal={closeCreateModal} type="edit_schedule_agent"
<AgentSchedule env={env} internalId={internalId} closeCreateModal={closeCreateModal}
type="edit_schedule_agent"
agentId={agentId} setCreateEditModal={() => setCreateEditModal(false)}/>}
{createStopModal && (
<div className="modal" onClick={closeCreateModal}>
Expand Down
32 changes: 16 additions & 16 deletions gui/pages/Content/Agents/Details.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@ export default function Details({agentDetails, runCount, goals, instructions, ag
const [filteredInstructions, setFilteredInstructions] = useState(false);
const [scheduleText, setScheduleText] = useState('Agent is not Scheduled');

const info_text = {
marginLeft: '7px',
};

const info_text_secondary = {
marginLeft: '3px',
marginTop: '2px',
color: '#888888',
lineHeight: '13px',
fontSize: '11px'
};

const openToolkitTab = (toolId) => {
EventBus.emit('openToolkitTab', {toolId: toolId});
}

useEffect(() => {
setFilteredInstructions(instructions?.filter(instruction => instruction.trim() !== ''));
}, [instructions]);
Expand Down Expand Up @@ -46,22 +62,6 @@ export default function Details({agentDetails, runCount, goals, instructions, ag
}
}, [agentScheduleDetails]);

const info_text = {
marginLeft: '7px',
};

const info_text_secondary = {
marginLeft: '3px',
marginTop: '2px',
color: '#888888',
lineHeight: '13px',
fontSize: '11px'
};

const openToolkitTab = (toolId) => {
EventBus.emit('openToolkitTab', {toolId: toolId});
}

return (<>
<div className={styles.history_box} style={{background: '#272335', padding: '15px', cursor: 'default'}}>
<div className={styles.detail_name}>{agentDetails?.name || ''}</div>
Expand Down
Loading