Maybe we fixed bugs?

This commit is contained in:
Mahesh Kommareddi 2024-07-17 00:15:07 -04:00
parent be0ed8f22d
commit b91631f562
5 changed files with 22 additions and 8 deletions

View File

@ -49,7 +49,7 @@ const TreeOfThoughtVisual = ({ data }) => {
}, [data]); }, [data]);
return <svg ref={svgRef} width="800" height="600" />; return <svg ref={svgRef} width="1920" height="1080" />;
}; };
export default TreeOfThoughtVisual; export default TreeOfThoughtVisual;

View File

@ -20,4 +20,9 @@ public class AgentInfo {
public List<String> getCapabilities() { public List<String> getCapabilities() {
return this.capabilities; return this.capabilities;
} }
@Override
public String toString() {
return "AgentInfo{id='" + id + "', name='" + name + "'}";
}
} }

View File

@ -63,25 +63,34 @@ public class TeamFormation {
String[] lines = reasoning.split("\n"); String[] lines = reasoning.split("\n");
String selectedTeamLine = ""; String selectedTeamLine = "";
for (String line : lines) { for (String line : lines) {
if (line.startsWith("Final Team Selection:")) { if (line.toLowerCase().contains("final team selection")) {
selectedTeamLine = line.substring("Final Team Selection:".length()).trim(); selectedTeamLine = line.substring(line.indexOf(":") + 1).trim();
break; break;
} }
} }
System.out.println("DEBUG: Selected team line: " + selectedTeamLine);
if (selectedTeamLine.isEmpty()) { if (selectedTeamLine.isEmpty()) {
System.out.println("DEBUG: No team selection found in the response."); System.out.println("DEBUG: No team selection found in the response.");
return List.of(); return List.of();
} }
List<String> selectedIds = Arrays.asList(selectedTeamLine.split(",\\s*")); List<String> selectedIds = Arrays.asList(selectedTeamLine.split("[,\\s]+"));
System.out.println("DEBUG: Parsed agent IDs: " + selectedIds); System.out.println("DEBUG: Parsed agent IDs: " + selectedIds);
List<AgentInfo> team = potentialAgents.stream() List<AgentInfo> team = potentialAgents.stream()
.filter(agent -> selectedIds.contains(agent.getId().trim())) .filter(agent -> selectedIds.contains(agent.getId().trim()))
.collect(Collectors.toList()); .collect(Collectors.toList());
System.out.println("DEBUG: Final team: " + team); 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; return team;
} }
} }