Skip to content

Commit

Permalink
refactor: new desire
Browse files Browse the repository at this point in the history
  • Loading branch information
yan-elena committed Jun 4, 2024
1 parent 1ea56d4 commit 57b7cbc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
9 changes: 6 additions & 3 deletions src/component/event/design/BDIGoalCreated.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import NewDesire from "./NewDesire";
function BDIGoalCreated(props) {
return (
<div>
<NewDesire log={props.log} event={props.event} filter={props.filter} level={props.level}/>
<div className={"mb-5"}/>
<DesireCommitted log={props.log} event={props.event} filter={props.filter} level={props.level}/>
<li className="timeline-item mb-5" key={props.event.timestamp + "_" + props.key}>
<NewDesire log={props.log} event={props.event} filter={props.filter} level={props.level}/>
</li>
<li className="timeline-item mb-5" key={props.event.timestamp + "_" + props.key + 1}>
<DesireCommitted log={props.log} event={props.event} filter={props.filter} level={props.level}/>
</li>
</div>
)
}
Expand Down
3 changes: 1 addition & 2 deletions src/component/event/design/DesireCommitted.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ function DesireCommitted(props) {

if (source && source.includes("self")) {
if (intention && intention.intendedMeansInfo.length > 0) {
console.log(intention.intendedMeansInfo)
parentDesire = "Goal " + goal + " is a goal created from " + intention.intendedMeansInfo[0].trigger
parentDesire = "Goal " + goal + " is a goal created from " + intention.intendedMeansInfo[0].plan.trigger
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/component/event/design/NewDesire.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ function NewDesire(props) {
if (intention) {
let im = intention.intendedMeansInfo
if (im.length > 0) {
const parent = im[0].trigger
const parent = im[0].plan.trigger
const type = im[0].type

if (type === "belief") {
reason = " because I believe " + parent
} else if (type === "achieve") {
explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.intention.value && e.message.event.goalInfo.intention.value.id === intention.id)
explanation = props.log.slice(0, props.log.indexOf(props.event)).findLast(e => e.message.type === "GoalCreated" && e.message.event.goalInfo.goalFunctor.includes(im[0].trigger))
reason = " because it is created from " + parent
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/AgentEventsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function AgentEventsPage(props) {
<MDBContainer xs={12} className="my-5">
<ul className="timeline">
{props.agent && props.agent.log.map((event, i) => (
<li className="timeline-item mb-5" key={event.timestamp + "_" + i}>
<li className="timeline-item mb-5" key={event.timestamp + "_" + i + 1}>
{React.cloneElement(EventMapping[event.message.type][selectedLevel], {log: props.agent.log, event: event, filter: filter, level: selectedLevel})}
</li>
))}
Expand Down

0 comments on commit 57b7cbc

Please sign in to comment.