Constrain the chat prompt container height
This commit is contained in:
parent
93824cdee5
commit
cdaeaa94e6
2 changed files with 27 additions and 1 deletions
|
|
@ -172,7 +172,7 @@ class FlexibleInput(Widget):
|
||||||
DEFAULT_CSS = """
|
DEFAULT_CSS = """
|
||||||
FlexibleInput {
|
FlexibleInput {
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 0 1;
|
padding: 0 1 1 1;
|
||||||
border-top: solid $primary-darken-1;
|
border-top: solid $primary-darken-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -180,6 +180,10 @@ class FlexibleInput(Widget):
|
||||||
border-top: solid $primary;
|
border-top: solid $primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FlexibleInput > Horizontal {
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
FlexibleInput #promptMarker {
|
FlexibleInput #promptMarker {
|
||||||
width: 2;
|
width: 2;
|
||||||
height: 1;
|
height: 1;
|
||||||
|
|
|
||||||
|
|
@ -138,3 +138,25 @@ class TestChatAppImageAttach:
|
||||||
await pilot.pause()
|
await pilot.pause()
|
||||||
assert app._images == [data]
|
assert app._images == [data]
|
||||||
assert "[Image #1]" in app.query_one(PostableTextArea).text
|
assert "[Image #1]" in app.query_one(PostableTextArea).text
|
||||||
|
|
||||||
|
|
||||||
|
class TestChatAppLayout:
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_prompt_stays_compact_and_history_visible(self, temp_db_path):
|
||||||
|
from haiku.rag.chat.app import ChatApp
|
||||||
|
from haiku.rag.chat.widgets.chat_history import ChatHistory
|
||||||
|
from haiku.rag.client import HaikuRAG
|
||||||
|
|
||||||
|
async with HaikuRAG(temp_db_path, create=True):
|
||||||
|
pass
|
||||||
|
|
||||||
|
app = ChatApp(db_path=temp_db_path, capabilities=[])
|
||||||
|
async with app.run_test() as pilot:
|
||||||
|
await pilot.pause()
|
||||||
|
prompt = app.query_one(FlexibleInput)
|
||||||
|
history = app.query_one(ChatHistory)
|
||||||
|
assert prompt.region.height <= 4
|
||||||
|
assert history.region.height > prompt.region.height
|
||||||
|
assert history.region.y < prompt.region.y
|
||||||
|
area = app.query_one(PostableTextArea)
|
||||||
|
assert prompt.region.contains_region(area.region)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue