Add back button to model picker
This commit is contained in:
1 parent
918bc45ee0
commit
7c80500280
3 files changed
+23
-2
No files matched your search
+16
-1
@@ -11,10 +11,11 @@ from unittest.mock import patch
|
||||
|
||||
from rich.console import Console
|
||||
from rich.markdown import Markdown
|
||||
from textual.widgets import Button
|
||||
|
||||
import httpx
|
||||
|
||||
from ai_chat import AIChatApp, AIConfig, MessageBubble, ChatMessage, ControlsHelp, ScreenshotOptions, main
|
||||
from ai_chat import AIChatApp, AIConfig, MessageBubble, ChatMessage, ControlsHelp, ScreenshotOptions, ModelSettings, main
|
||||
from settings import load_settings, save_settings, store_model, model_from_settings
|
||||
|
||||
|
||||
@@ -211,6 +212,20 @@ class ChatTests(unittest.IsolatedAsyncioTestCase):
|
||||
await self.wait_finished(app, pilot)
|
||||
self.assertEqual(app.messages[-1].content, 'working')
|
||||
|
||||
async def test_back_exits_model_picker_without_saving(self):
|
||||
app = await self.make_app(lambda request: httpx.Response(500))
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
path = Path(directory) / 'sloppy.json'
|
||||
app.settings_path = path
|
||||
app.choose_models = True
|
||||
async with app.run_test() as pilot:
|
||||
self.assertIsInstance(app.screen, ModelSettings)
|
||||
app.screen.query_one('#back-models', Button).press()
|
||||
await pilot.pause()
|
||||
self.assertNotIsInstance(app.screen, ModelSettings)
|
||||
self.assertFalse(path.exists())
|
||||
self.assertIn('Ctrl+M', str(app.status_bar.render()))
|
||||
|
||||
async def test_empty_stream_uses_fallback(self):
|
||||
calls = []
|
||||
def handler(request):
|
||||
|
||||
Reference in new issue
Block a user