Skip to content

Commit e3e8f4b

Browse files
committed
Remove 'truncated' subtitle in panels
1 parent 68fe337 commit e3e8f4b

File tree

1 file changed

+5
-42
lines changed

1 file changed

+5
-42
lines changed

weco/panels.py

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from rich.panel import Panel
66
from rich.syntax import Syntax
77
from typing import Dict, List, Optional, Union, Tuple
8-
from .utils import format_number, truncate_text
8+
from .utils import format_number
99

1010

1111
class SummaryPanel:
@@ -67,7 +67,6 @@ class PlanPanel:
6767

6868
def __init__(self):
6969
self.plan = ""
70-
self.max_lines = 3 # Approximate number of lines that can fit in the panel
7170

7271
def update(self, plan: str):
7372
"""Update the plan text."""
@@ -79,15 +78,7 @@ def clear(self):
7978

8079
def get_display(self) -> Panel:
8180
"""Create a panel displaying the plan with truncation if needed."""
82-
display_text = truncate_text(text=self.plan, max_lines=self.max_lines)
83-
return Panel(
84-
display_text,
85-
title="[bold]📝 Thinking...",
86-
border_style="cyan",
87-
expand=True,
88-
padding=(0, 1),
89-
subtitle="[cyan]↓ truncated ↓[/]" if len(self.plan) > self.max_lines else None,
90-
)
81+
return Panel(self.plan, title="[bold]📝 Thinking...", border_style="cyan", expand=True, padding=(0, 1))
9182

9283

9384
class Node:
@@ -238,7 +229,6 @@ class EvaluationOutputPanel:
238229

239230
def __init__(self):
240231
self.output = ""
241-
self.max_lines = 25 # Approximate number of lines that can fit in the panel
242232

243233
def update(self, output: str) -> None:
244234
"""Update the evaluation output."""
@@ -250,13 +240,7 @@ def clear(self) -> None:
250240

251241
def get_display(self) -> Panel:
252242
"""Create a panel displaying the evaluation output with truncation if needed."""
253-
display_text = truncate_text(text=self.output, max_lines=self.max_lines)
254-
255-
title = "[bold]📋 Evaluation Output"
256-
if len(self.output) == len(display_text):
257-
title += " (truncated)[/]"
258-
259-
return Panel(display_text, title=title, border_style="red", expand=True, padding=(0, 1))
243+
return Panel(self.output, title="[bold]📋 Evaluation Output", border_style="red", expand=True, padding=(0, 1))
260244

261245

262246
class SolutionPanels:
@@ -267,7 +251,6 @@ def __init__(self):
267251
self.current_node = None
268252
# Best solution
269253
self.best_node = None
270-
self.max_lines = 30 # Approximate number of lines that can fit in each panel
271254

272255
def update(self, current_node: Union[Node, None], best_node: Union[Node, None]):
273256
"""Update the current and best solutions."""
@@ -282,44 +265,24 @@ def get_display(self, current_step: int) -> Tuple[Panel, Panel]:
282265
best_code = self.best_node.code if self.best_node is not None else ""
283266
best_score = self.best_node.metric if self.best_node is not None else None
284267

285-
# Determine if code is too long (approximate)
286-
current_lines = current_code.count("\n") + 1
287-
best_lines = best_code.count("\n") + 1
288-
289268
# Current solution (without score)
290269
current_title = f"[bold]💡 Current Solution (Step {current_step})"
291270
current_panel = Panel(
292-
Syntax(
293-
str(current_code),
294-
"python",
295-
theme="monokai",
296-
line_numbers=True,
297-
word_wrap=False,
298-
line_range=(0, self.max_lines), # Only show first max_lines lines
299-
),
271+
Syntax(str(current_code), "python", theme="monokai", line_numbers=True, word_wrap=False),
300272
title=current_title,
301273
border_style="yellow",
302274
expand=True,
303275
padding=(0, 1),
304-
subtitle="[yellow]↓ truncated ↓[/]" if current_lines > self.max_lines else None,
305276
)
306277

307278
# Best solution
308279
best_title = f"[bold]🏆 Best Solution ([green]Score: {f'{best_score:.4f}' if best_score is not None else 'N/A'}[/])"
309280
best_panel = Panel(
310-
Syntax(
311-
str(best_code),
312-
"python",
313-
theme="monokai",
314-
line_numbers=True,
315-
word_wrap=False,
316-
line_range=(0, self.max_lines), # Only show first max_lines lines
317-
),
281+
Syntax(str(best_code), "python", theme="monokai", line_numbers=True, word_wrap=False),
318282
title=best_title,
319283
border_style="green",
320284
expand=True,
321285
padding=(0, 1),
322-
subtitle="[yellow]↓ truncated ↓[/]" if best_lines > self.max_lines else None,
323286
)
324287

325288
return current_panel, best_panel

0 commit comments

Comments
 (0)