Fixing false separator

This commit is contained in:
Dita Aji Pratama 2026-06-17 17:13:28 +07:00
parent 34527d5438
commit 19b128618d
2 changed files with 11 additions and 5 deletions

View File

@ -80,7 +80,11 @@ class HendrikTUI:
if mi: if mi:
self.log[-1]["model_info"] = (mi.get("provider"), mi.get("model")) self.log[-1]["model_info"] = (mi.get("provider"), mi.get("model"))
elif msg["role"] == "assistant": elif msg["role"] == "assistant":
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"]) log(self, "ai", msg["content"])
if session.messages and session.messages[-1]["role"] == "assistant":
log(self, "sep", "")
def run(self): def run(self):
try: try:

View File

@ -323,10 +323,11 @@ def session_browser_popup(app, stdscr):
pw = min(60, app.w - 4) pw = min(60, app.w - 4)
ph = min(len(items) + 4, app.h - 4) ph = min(len(items) + 4, app.h - 4)
if ph < 5:
curses.flash()
return
px = (app.w - pw) // 2 px = (app.w - pw) // 2
py = (app.h - ph) // 2 py = (app.h - ph) // 2
if ph < 6:
return
win = curses.newwin(ph, pw, py, px) win = curses.newwin(ph, pw, py, px)
win.keypad(True) win.keypad(True)
@ -431,10 +432,11 @@ def session_search_popup(app, stdscr):
pw = min(60, app.w - 4) pw = min(60, app.w - 4)
ph = min(len(items) + 4, app.h - 4) ph = min(len(items) + 4, app.h - 4)
if ph < 5:
curses.flash()
return
px = (app.w - pw) // 2 px = (app.w - pw) // 2
py = (app.h - ph) // 2 py = (app.h - ph) // 2
if ph < 6:
return
win = curses.newwin(ph, pw, py, px) win = curses.newwin(ph, pw, py, px)
win.keypad(True) win.keypad(True)