mirror of
https://gitee.com/agents-flex/agents-flex.git
synced 2024-11-29 18:38:17 +08:00
refactor: optimize Chain events name
This commit is contained in:
parent
a1be752d92
commit
ca6385776e
@ -139,7 +139,7 @@ public class Chain extends ChainNode {
|
||||
this.status = status;
|
||||
|
||||
if (before != status) {
|
||||
notifyEvent(new OnStatusChangeEvent(this.status, before));
|
||||
notifyEvent(new OnStatusChangeEvent(this, this.status, before));
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ public class Chain extends ChainNode {
|
||||
} finally {
|
||||
onNodeExecuteEnd(nodeContext);
|
||||
ChainContext.clearNode();
|
||||
notifyEvent(new OnNodeFinishedEvent(currentNode, executeResult));
|
||||
notifyEvent(new OnNodeEndEvent(currentNode, executeResult));
|
||||
}
|
||||
|
||||
if (executeResult != null && !executeResult.isEmpty()) {
|
||||
@ -371,7 +371,7 @@ public class Chain extends ChainNode {
|
||||
}
|
||||
try {
|
||||
ChainContext.setChain(this);
|
||||
notifyEvent(new OnStartEvent());
|
||||
notifyEvent(new OnChainStartEvent());
|
||||
try {
|
||||
setStatus(ChainStatus.RUNNING);
|
||||
runnable.run();
|
||||
@ -386,7 +386,7 @@ public class Chain extends ChainNode {
|
||||
}
|
||||
} finally {
|
||||
ChainContext.clearChain();
|
||||
notifyEvent(new OnFinishedEvent());
|
||||
notifyEvent(new OnChainEndEvent());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,6 @@ package com.agentsflex.core.chain.event;
|
||||
|
||||
import com.agentsflex.core.chain.ChainEvent;
|
||||
|
||||
public class OnFinishedEvent implements ChainEvent {
|
||||
public class OnChainEndEvent implements ChainEvent {
|
||||
|
||||
}
|
@ -17,6 +17,6 @@ package com.agentsflex.core.chain.event;
|
||||
|
||||
import com.agentsflex.core.chain.ChainEvent;
|
||||
|
||||
public class OnStartEvent implements ChainEvent {
|
||||
public class OnChainStartEvent implements ChainEvent {
|
||||
|
||||
}
|
@ -20,13 +20,13 @@ import com.agentsflex.core.chain.ChainNode;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OnNodeFinishedEvent implements ChainEvent {
|
||||
public class OnNodeEndEvent implements ChainEvent {
|
||||
|
||||
private ChainNode node;
|
||||
private Map<String, Object> result;
|
||||
|
||||
|
||||
public OnNodeFinishedEvent(ChainNode node, Map<String, Object> result) {
|
||||
public OnNodeEndEvent(ChainNode node, Map<String, Object> result) {
|
||||
this.node = node;
|
||||
this.result = result;
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class OnNodeFinishedEvent implements ChainEvent {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OnNodeFinishedEvent{" +
|
||||
return "OnNodeEndEvent{" +
|
||||
"node=" + node +
|
||||
", result=" + result +
|
||||
'}';
|
@ -15,19 +15,29 @@
|
||||
*/
|
||||
package com.agentsflex.core.chain.event;
|
||||
|
||||
import com.agentsflex.core.chain.Chain;
|
||||
import com.agentsflex.core.chain.ChainEvent;
|
||||
import com.agentsflex.core.chain.ChainStatus;
|
||||
|
||||
public class OnStatusChangeEvent implements ChainEvent {
|
||||
|
||||
private Chain chain;
|
||||
private ChainStatus status;
|
||||
private ChainStatus before;
|
||||
|
||||
public OnStatusChangeEvent(ChainStatus status, ChainStatus before) {
|
||||
public OnStatusChangeEvent(Chain chain,ChainStatus status, ChainStatus before) {
|
||||
this.status = status;
|
||||
this.before = before;
|
||||
}
|
||||
|
||||
public Chain getChain() {
|
||||
return chain;
|
||||
}
|
||||
|
||||
public void setChain(Chain chain) {
|
||||
this.chain = chain;
|
||||
}
|
||||
|
||||
public ChainStatus getStatus() {
|
||||
return status;
|
||||
}
|
||||
@ -47,7 +57,8 @@ public class OnStatusChangeEvent implements ChainEvent {
|
||||
@Override
|
||||
public String toString() {
|
||||
return "OnStatusChangeEvent{" +
|
||||
"status=" + status +
|
||||
"chain=" + chain +
|
||||
", status=" + status +
|
||||
", before=" + before +
|
||||
'}';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user