diff --git a/frontend/src/components/TreeOfThoughtVisual.js b/frontend/src/components/TreeOfThoughtVisual.js index ca1a9e6..d722019 100644 --- a/frontend/src/components/TreeOfThoughtVisual.js +++ b/frontend/src/components/TreeOfThoughtVisual.js @@ -49,7 +49,7 @@ const TreeOfThoughtVisual = ({ data }) => { }, [data]); - return ; + return ; }; export default TreeOfThoughtVisual; \ No newline at end of file diff --git a/src/main/java/com/ioa/agent/AgentInfo.java b/src/main/java/com/ioa/agent/AgentInfo.java index 96628b1..f33d372 100644 --- a/src/main/java/com/ioa/agent/AgentInfo.java +++ b/src/main/java/com/ioa/agent/AgentInfo.java @@ -20,4 +20,9 @@ public class AgentInfo { public List getCapabilities() { return this.capabilities; } + + @Override + public String toString() { + return "AgentInfo{id='" + id + "', name='" + name + "'}"; + } } \ No newline at end of file diff --git a/src/main/java/com/ioa/team/TeamFormation.java b/src/main/java/com/ioa/team/TeamFormation.java index 99f73a4..8456b90 100644 --- a/src/main/java/com/ioa/team/TeamFormation.java +++ b/src/main/java/com/ioa/team/TeamFormation.java @@ -63,25 +63,34 @@ public class TeamFormation { String[] lines = reasoning.split("\n"); String selectedTeamLine = ""; for (String line : lines) { - if (line.startsWith("Final Team Selection:")) { - selectedTeamLine = line.substring("Final Team Selection:".length()).trim(); + if (line.toLowerCase().contains("final team selection")) { + selectedTeamLine = line.substring(line.indexOf(":") + 1).trim(); break; } } - + + System.out.println("DEBUG: Selected team line: " + selectedTeamLine); + if (selectedTeamLine.isEmpty()) { System.out.println("DEBUG: No team selection found in the response."); return List.of(); } - - List selectedIds = Arrays.asList(selectedTeamLine.split(",\\s*")); + + List selectedIds = Arrays.asList(selectedTeamLine.split("[,\\s]+")); System.out.println("DEBUG: Parsed agent IDs: " + selectedIds); - + List team = potentialAgents.stream() .filter(agent -> selectedIds.contains(agent.getId().trim())) .collect(Collectors.toList()); - + System.out.println("DEBUG: Final team: " + team); + + if (team.isEmpty() && !selectedIds.isEmpty()) { + // If no agents were matched but we did find IDs, add the first potential agent as a fallback + team = potentialAgents.stream().limit(1).collect(Collectors.toList()); + System.out.println("DEBUG: No agents matched IDs. Using fallback: " + team); + } + return team; } } \ No newline at end of file diff --git a/target/classes/com/ioa/agent/AgentInfo.class b/target/classes/com/ioa/agent/AgentInfo.class index 2431e20..a534888 100644 Binary files a/target/classes/com/ioa/agent/AgentInfo.class and b/target/classes/com/ioa/agent/AgentInfo.class differ diff --git a/target/classes/com/ioa/team/TeamFormation.class b/target/classes/com/ioa/team/TeamFormation.class index dd08096..193eabe 100644 Binary files a/target/classes/com/ioa/team/TeamFormation.class and b/target/classes/com/ioa/team/TeamFormation.class differ