mirror of
https://github.com/GH05TCREW/pentestagent.git
synced 2026-03-07 22:33:38 +00:00
feat: hide tool outputs from chat display
This commit is contained in:
@@ -869,10 +869,9 @@ class GhostCrewTUI(App):
|
||||
|
||||
def _add_tool_result(self, name: str, result: str) -> None:
|
||||
"""Display tool execution result"""
|
||||
# Truncate long results
|
||||
if len(result) > 2000:
|
||||
result = result[:2000] + "\n... (truncated)"
|
||||
self._add_message(ToolResultMessage(name, result))
|
||||
# Hide tool output - LLM will synthesize it in its response
|
||||
# This prevents duplication and keeps the chat clean
|
||||
pass
|
||||
|
||||
def _show_system_prompt(self) -> None:
|
||||
"""Display the current system prompt"""
|
||||
|
||||
@@ -74,30 +74,28 @@ async def web_search(arguments: dict, runtime: "Runtime") -> str:
|
||||
|
||||
|
||||
def _format_results(query: str, data: dict) -> str:
|
||||
"""Format Tavily results for LLM consumption."""
|
||||
"""
|
||||
Format Tavily results for LLM consumption.
|
||||
|
||||
Returns a lean format with summary + titles + URLs only.
|
||||
Content snippets are excluded to prevent LLM from regurgitating
|
||||
noisy web scrapes in its response.
|
||||
"""
|
||||
parts = [f"Search: {query}\n"]
|
||||
|
||||
# Include synthesized answer if available
|
||||
# Include synthesized answer if available (this is the valuable part)
|
||||
if answer := data.get("answer"):
|
||||
parts.append(f"Summary:\n{answer}\n")
|
||||
|
||||
# Include individual results
|
||||
# Include sources as title + URL only (no content snippets)
|
||||
results = data.get("results", [])
|
||||
if results:
|
||||
parts.append("Sources:")
|
||||
for i, result in enumerate(results, 1):
|
||||
title = result.get("title", "Untitled")
|
||||
url = result.get("url", "")
|
||||
content = result.get("content", "")
|
||||
|
||||
# Truncate content if too long
|
||||
if len(content) > 500:
|
||||
content = content[:500] + "..."
|
||||
|
||||
parts.append(f"\n[{i}] {title}")
|
||||
parts.append(f" URL: {url}")
|
||||
if content:
|
||||
parts.append(f" {content}")
|
||||
parts.append(f" [{i}] {title}")
|
||||
parts.append(f" {url}")
|
||||
else:
|
||||
parts.append("No results found")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user