diff --git a/tui/app.py b/tui/app.py index 807a681..24467b9 100644 --- a/tui/app.py +++ b/tui/app.py @@ -80,7 +80,11 @@ class HendrikTUI: if mi: self.log[-1]["model_info"] = (mi.get("provider"), mi.get("model")) elif msg["role"] == "assistant": - log(self, "ai", msg["content"]) + next_role = session.messages[i + 1]["role"] if i + 1 < len(session.messages) else None + if next_role in ("user", None): + log(self, "ai", msg["content"]) + if session.messages and session.messages[-1]["role"] == "assistant": + log(self, "sep", "") def run(self): try: diff --git a/tui/input.py b/tui/input.py index 4d46814..b87c802 100644 --- a/tui/input.py +++ b/tui/input.py @@ -323,10 +323,11 @@ def session_browser_popup(app, stdscr): pw = min(60, app.w - 4) ph = min(len(items) + 4, app.h - 4) + if ph < 5: + curses.flash() + return px = (app.w - pw) // 2 py = (app.h - ph) // 2 - if ph < 6: - return win = curses.newwin(ph, pw, py, px) win.keypad(True) @@ -431,10 +432,11 @@ def session_search_popup(app, stdscr): pw = min(60, app.w - 4) ph = min(len(items) + 4, app.h - 4) + if ph < 5: + curses.flash() + return px = (app.w - pw) // 2 py = (app.h - ph) // 2 - if ph < 6: - return win = curses.newwin(ph, pw, py, px) win.keypad(True)