Skip to content

Commit 4fb24d9

Browse files
committed
Mitigate rendering issues when models output a newline
1 parent ecf4e06 commit 4fb24d9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/shelloracle/providers/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"on interpreting the requirements and translating them into a single, executable Bash command. "
1212
"Ensure accuracy and relevance to the user's description. The output should be a valid Bash "
1313
"command that directly aligns with the user's intent, ready for execution in a command-line "
14-
"environment. Output nothing except for the command. No code block, no English explanation, "
15-
"no start/end tags."
14+
"environment. Do not output anything except for the command. No code block, no English explanation, "
15+
"no newlines, and no start/end tags."
1616
)
1717

1818

src/shelloracle/shelloracle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ async def shelloracle() -> None:
6161
shell_command = ""
6262
with create_app_session_from_tty(), patch_stdout(raw=True), yaspin() as sp:
6363
async for token in provider.generate(prompt):
64+
# some models may erroneously return a newline, which causes issues with the status spinner
65+
token = token.replace("\n", "")
6466
shell_command += token
6567
sp.text = shell_command
6668
sys.stdout.write(shell_command)

0 commit comments

Comments
 (0)