Skip to content

Conversation

Vidit-Ostwal
Copy link
Contributor

This fixes the tool input console formatting
Fixes #3474

@Vidit-Ostwal
Copy link
Contributor Author

Before
Screenshot 2025-09-07 at 12 16 04

After

Screenshot 2025-09-07 at 12 16 41

agent_role = agent_role.partition("\n")[0]

if isinstance(formatted_answer, AgentAction):
thought = re.sub(r"\n+", "\n", formatted_answer.thought)
formatted_json = json.dumps(
formatted_answer.tool_input,
json.loads(formatted_answer.tool_input),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only change done, rest are the linting changes

Comment on lines +1592 to +1606
sources_branch = None

# Try to find an existing "Sources Used" branch
for sub_child in child.children:
if "Sources Used" in str(sub_child.label):
sources_branch = sub_child
break
else:
sources_branch = child.add("Sources Used")
sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
break

# If not found, create it under this child
if sources_branch is None:
sources_branch = child.add("🧠 Sources Used")

sources_branch.add(f"✅ {memory_type} ({query_time_ms:.2f}ms)")
break

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is was a logic change done, because of linter.

Comment on lines +1631 to +1645
sources_branch = None

# Try to find an existing "Sources Used" branch
for sub_child in child.children:
if "Sources Used" in str(sub_child.label):
sources_branch = sub_child
break
else:

# If not found, create it under this child
if sources_branch is None:
sources_branch = child.add("🧠 Sources Used")
sources_branch.add(f"❌ {memory_type} - Error: {error}")
break

sources_branch.add(f"❌ {memory_type} - Error: {error}")
break

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one as well

@Vidit-Ostwal
Copy link
Contributor Author

Requesting @lorenzejay for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] JSON console formatting for tool input
1 participant