Skip to content

Commit 6f17a0b

Browse files
authored
fix modifications to PostActingEvent in Hook not taking effect as expected (#154)
1 parent 7c427d0 commit 6f17a0b

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

‎agentscope-core/src/main/java/io/agentscope/core/ReActAgent.java‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,16 @@ private Flux<Void> processToolResults(
501501
}
502502

503503
private Mono<Void> processSingleToolResult(ToolUseBlock toolCall, ToolResultBlock result) {
504-
Msg toolMsg = ToolResultMessageBuilder.buildToolResultMsg(result, toolCall, getName());
505-
memory.addMessage(toolMsg);
506-
507-
ToolResultBlock savedResult = (ToolResultBlock) toolMsg.getFirstContentBlock();
508-
return hookNotifier.notifyPostActing(toolCall, savedResult).then();
504+
return hookNotifier
505+
.notifyPostActing(toolCall, result)
506+
.doOnNext(
507+
processedResult -> {
508+
Msg toolMsg =
509+
ToolResultMessageBuilder.buildToolResultMsg(
510+
processedResult, toolCall, getName());
511+
memory.addMessage(toolMsg);
512+
})
513+
.then();
509514
}
510515
}
511516

0 commit comments

Comments
 (0)