mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-20 20:35:00 +00:00
feat: Warn when using --stream and --cache-prompts together
This commit is contained in:
parent
7c40c3a61c
commit
16bb0c93e7
2 changed files with 40 additions and 3 deletions
|
@ -579,9 +579,6 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
io = get_io(False)
|
io = get_io(False)
|
||||||
io.tool_warning("Terminal does not support pretty output (UnicodeDecodeError)")
|
io.tool_warning("Terminal does not support pretty output (UnicodeDecodeError)")
|
||||||
|
|
||||||
if args.stream and args.cache_prompts:
|
|
||||||
io.tool_warning("Cost estimates may be inaccurate when using streaming and caching.")
|
|
||||||
|
|
||||||
# Process any environment variables set via --set-env
|
# Process any environment variables set via --set-env
|
||||||
if args.set_env:
|
if args.set_env:
|
||||||
for env_setting in args.set_env:
|
for env_setting in args.set_env:
|
||||||
|
@ -1065,6 +1062,9 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
io.tool_output(f"Cur working dir: {Path.cwd()}")
|
io.tool_output(f"Cur working dir: {Path.cwd()}")
|
||||||
io.tool_output(f"Git working dir: {git_root}")
|
io.tool_output(f"Git working dir: {git_root}")
|
||||||
|
|
||||||
|
if args.stream and args.cache_prompts:
|
||||||
|
io.tool_warning("Cost estimates may be inaccurate when using streaming and caching.")
|
||||||
|
|
||||||
if args.load:
|
if args.load:
|
||||||
commands.cmd_load(args.load)
|
commands.cmd_load(args.load)
|
||||||
|
|
||||||
|
|
|
@ -1246,3 +1246,40 @@ class TestMain(TestCase):
|
||||||
# Only set_reasoning_effort should be called, not set_thinking_tokens
|
# Only set_reasoning_effort should be called, not set_thinking_tokens
|
||||||
mock_instance.set_reasoning_effort.assert_called_once_with("3")
|
mock_instance.set_reasoning_effort.assert_called_once_with("3")
|
||||||
mock_instance.set_thinking_tokens.assert_not_called()
|
mock_instance.set_thinking_tokens.assert_not_called()
|
||||||
|
|
||||||
|
@patch("aider.main.InputOutput")
|
||||||
|
def test_stream_and_cache_warning(self, MockInputOutput):
|
||||||
|
mock_io_instance = MockInputOutput.return_value
|
||||||
|
with GitTemporaryDirectory():
|
||||||
|
main(
|
||||||
|
["--stream", "--cache-prompts", "--exit", "--yes"],
|
||||||
|
input=DummyInput(),
|
||||||
|
output=DummyOutput(),
|
||||||
|
)
|
||||||
|
mock_io_instance.tool_warning.assert_called_with(
|
||||||
|
"Cost estimates may be inaccurate when using streaming and caching."
|
||||||
|
)
|
||||||
|
|
||||||
|
@patch("aider.main.InputOutput")
|
||||||
|
def test_stream_without_cache_no_warning(self, MockInputOutput):
|
||||||
|
mock_io_instance = MockInputOutput.return_value
|
||||||
|
with GitTemporaryDirectory():
|
||||||
|
main(
|
||||||
|
["--stream", "--exit", "--yes"],
|
||||||
|
input=DummyInput(),
|
||||||
|
output=DummyOutput(),
|
||||||
|
)
|
||||||
|
for call in mock_io_instance.tool_warning.call_args_list:
|
||||||
|
self.assertNotIn("Cost estimates may be inaccurate", call[0][0])
|
||||||
|
|
||||||
|
@patch("aider.main.InputOutput")
|
||||||
|
def test_cache_without_stream_no_warning(self, MockInputOutput):
|
||||||
|
mock_io_instance = MockInputOutput.return_value
|
||||||
|
with GitTemporaryDirectory():
|
||||||
|
main(
|
||||||
|
["--cache-prompts", "--exit", "--yes"],
|
||||||
|
input=DummyInput(),
|
||||||
|
output=DummyOutput(),
|
||||||
|
)
|
||||||
|
for call in mock_io_instance.tool_warning.call_args_list:
|
||||||
|
self.assertNotIn("Cost estimates may be inaccurate", call[0][0])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue