codebind 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codebind-0.1.2 → codebind-0.1.3}/PKG-INFO +1 -1
- {codebind-0.1.2 → codebind-0.1.3}/pyproject.toml +1 -1
- {codebind-0.1.2 → codebind-0.1.3}/pyproject.toml.orig +1 -1
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/prompts.py +1 -0
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/rendering.py +3 -17
- {codebind-0.1.2 → codebind-0.1.3}/LICENSE +0 -0
- {codebind-0.1.2 → codebind-0.1.3}/README.md +0 -0
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/__init__.py +0 -0
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/cli.py +0 -0
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/execution.py +0 -0
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/py.typed +0 -0
- {codebind-0.1.2 → codebind-0.1.3}/src/codebind/session.py +0 -0
|
@@ -62,4 +62,5 @@ def render_output_prompt(shell: object, prompts: CellPrompts) -> None:
|
|
|
62
62
|
"""Render an output prompt with IPython's terminal style."""
|
|
63
63
|
pt_app = getattr(shell, "pt_app", None)
|
|
64
64
|
style = pt_app.app.style if pt_app is not None else None
|
|
65
|
+
sys.stdout.write(getattr(shell, "separate_out", "") or "\n")
|
|
65
66
|
print_formatted_text(PygmentsTokens(prompts.out_prompt_tokens()), style=style, end="")
|
|
@@ -2,20 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from itertools import chain
|
|
6
|
-
|
|
7
5
|
from rich.console import Console
|
|
8
6
|
from rich.markdown import Markdown
|
|
9
|
-
from rich.segment import Segments
|
|
10
7
|
from rich.text import Text
|
|
11
8
|
|
|
12
9
|
from .execution import ExecutionReport
|
|
13
10
|
from .prompts import CellPrompts, render_output_prompt
|
|
14
11
|
|
|
15
12
|
|
|
16
|
-
_MAXIMUM_OUTPUT_LINES = 10
|
|
17
|
-
|
|
18
|
-
|
|
19
13
|
def _visible_output(report: ExecutionReport) -> str:
|
|
20
14
|
parts = [part for part in (report.stdout, report.stderr) if part]
|
|
21
15
|
if report.displays:
|
|
@@ -28,28 +22,20 @@ def _visible_output(report: ExecutionReport) -> str:
|
|
|
28
22
|
|
|
29
23
|
|
|
30
24
|
class TerminalRenderer:
|
|
31
|
-
"""Render
|
|
25
|
+
"""Render tool output and Markdown answers to the active terminal."""
|
|
32
26
|
|
|
33
27
|
def __init__(self) -> None:
|
|
34
28
|
self.console = Console()
|
|
35
29
|
|
|
36
30
|
def tool_output(self, report: ExecutionReport, shell: object, prompts: CellPrompts) -> None:
|
|
37
|
-
"""Show
|
|
31
|
+
"""Show the complete tool output."""
|
|
38
32
|
visible = _visible_output(report)
|
|
39
33
|
if not visible:
|
|
40
34
|
return
|
|
41
35
|
output = Text.from_ansi(visible)
|
|
42
|
-
options = self.console.options
|
|
43
|
-
complete = self.console.render_lines(output, options, pad=False, new_lines=True)
|
|
44
|
-
preview = complete[:_MAXIMUM_OUTPUT_LINES]
|
|
45
36
|
if report.ok:
|
|
46
37
|
render_output_prompt(shell, prompts)
|
|
47
|
-
self.console.print(
|
|
48
|
-
if len(complete) > len(preview):
|
|
49
|
-
self.console.print(
|
|
50
|
-
f"[dim]{len(preview)} of {len(complete)} lines shown; "
|
|
51
|
-
"the complete result was returned to the model.[/dim]"
|
|
52
|
-
)
|
|
38
|
+
self.console.print(output)
|
|
53
39
|
|
|
54
40
|
def assistant(self, text: str) -> None:
|
|
55
41
|
"""Render the final model response as terminal Markdown."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|