Skip to content

Commit 7168672

Browse files
committed
feat: reactagent with llminputkey
Signed-off-by: zhouyou <zhouyou9505@gmail.com>
1 parent 80f1cd2 commit 7168672

File tree

2 files changed

+308
-328
lines changed

2 files changed

+308
-328
lines changed

spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/agent/ReactAgent.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,22 @@ private StateGraph initGraph() throws GraphStateException {
207207
if (keyStrategyFactory == null) {
208208
this.keyStrategyFactory = () -> {
209209
HashMap<String, KeyStrategy> keyStrategyHashMap = new HashMap<>();
210-
if (llmInputMessagesKey != null){
210+
if (llmInputMessagesKey != null) {
211211
keyStrategyHashMap.put(llmInputMessagesKey, new ReplaceStrategy());
212212
}
213213
keyStrategyHashMap.put("messages", new AppendStrategy());
214214
return keyStrategyHashMap;
215215
};
216-
} else {
216+
}
217+
else {
217218
KeyStrategyFactory originalFactory = this.keyStrategyFactory;
218219
this.keyStrategyFactory = () -> {
219220
HashMap<String, KeyStrategy> keyStrategyHashMap = new HashMap<>(originalFactory.apply());
220221
keyStrategyHashMap.put("messages", new AppendStrategy());
221222
return keyStrategyHashMap;
222223
};
223224
}
224-
225+
225226
StateGraph graph = new StateGraph(name, this.keyStrategyFactory);
226227

227228
if (preLlmHook != null) {

0 commit comments

Comments
 (0)