Small improve
This commit is contained in:
parent
4572fe6b60
commit
6976348c74
@ -208,7 +208,7 @@ def draw_menubar(app, stdscr):
|
||||
pass
|
||||
x += len(text)
|
||||
|
||||
model = f" {app.llm.model} "
|
||||
model = " F10:menu " # sementara: petunjuk tombol, bukan nama model
|
||||
try:
|
||||
stdscr.addstr(y, max(0, app.w - len(model)), model, base_attr)
|
||||
except curses.error:
|
||||
|
||||
@ -21,7 +21,6 @@ C_STATUS_PROC = theme.C_STATUS_PROC
|
||||
C_ERROR = theme.C_ERROR
|
||||
C_INPUT_BORDER = theme.C_INPUT_BORDER
|
||||
C_STATUS_INFO = theme.C_STATUS_INFO
|
||||
C_HINT_DISABLED = theme.C_HINT_DISABLED
|
||||
C_WELCOME = theme.C_WELCOME
|
||||
C_TOOL_CALL = theme.C_TOOL_CALL
|
||||
|
||||
@ -50,26 +49,16 @@ def draw(app, stdscr):
|
||||
|
||||
|
||||
def draw_header(app, stdscr):
|
||||
# Baris 1: menu bar (dengan mnemonic + model di kanan)
|
||||
# Baris 1: menu bar (dengan mnemonic + petunjuk F10 di kanan)
|
||||
draw_menubar(app, stdscr)
|
||||
|
||||
# Baris 2: shortcut hints kontekstual sesuai status processing
|
||||
if app.processing:
|
||||
hints = " F10:menu Esc:cancel "
|
||||
else:
|
||||
hints = (" F10:menu ^Enter:send ^N:new ^O:open F2:rename "
|
||||
"F4:model F6:ws ^C:exit ")
|
||||
full_line = hints.ljust(app.w)
|
||||
attr2 = curses.color_pair(C_HINT_DISABLED)
|
||||
stdscr.addstr(1, 0, full_line[:app.w], attr2)
|
||||
|
||||
|
||||
def draw_chat(app, stdscr):
|
||||
# Area chat — dari baris 2 sampai baris (h - 11).
|
||||
# Bisa di-scroll dengan Page Up / Page Down.
|
||||
# app.log berisi daftar item (role, text, time) untuk display.
|
||||
h, w = app.h, app.w
|
||||
chat_top = 2
|
||||
chat_top = 1
|
||||
chat_h = h - 11
|
||||
if chat_h <= 0:
|
||||
return
|
||||
@ -355,7 +344,7 @@ def draw_input(app, stdscr):
|
||||
|
||||
|
||||
def draw_status(app, stdscr):
|
||||
# Status bar di baris h-9: mode, workspace, session
|
||||
# Status bar di baris h-9: mode, model, workspace, session
|
||||
h, w = app.h, app.w
|
||||
y = h - 9
|
||||
ws = get_current_workspace()
|
||||
@ -364,18 +353,19 @@ def draw_status(app, stdscr):
|
||||
if app.current_session:
|
||||
session_tag = f" {app.current_session.name} "
|
||||
|
||||
model = app.llm.model
|
||||
mode = " PROCESSING " if app.processing else " READY "
|
||||
|
||||
# Format: [MODE] workspace session (menggunakan spasi sebagai pemisah)
|
||||
status_text = f"{mode} {ws} {session_tag}"
|
||||
# Format: [MODE] model workspace session (menggunakan spasi sebagai pemisah)
|
||||
status_text = f"{mode} {model} {ws} {session_tag}"
|
||||
|
||||
# Jika terlalu panjang, potong bagian workspace-nya saja agar tetap readable
|
||||
ws_display = ws
|
||||
if len(status_text) > w:
|
||||
max_ws_len = w - len(mode) - len(session_tag) - 2
|
||||
max_ws_len = w - len(mode) - len(model) - len(session_tag) - 3
|
||||
if len(ws) > max_ws_len:
|
||||
ws_display = ".." + ws[-(max_ws_len - 2):]
|
||||
status_text = f"{mode} {ws_display} {session_tag}"
|
||||
status_text = f"{mode} {model} {ws_display} {session_tag}"
|
||||
|
||||
# Gambar background dasar
|
||||
full_status = status_text.ljust(w)[:w]
|
||||
@ -385,14 +375,18 @@ def draw_status(app, stdscr):
|
||||
mode_attr = curses.color_pair(C_STATUS_READY) if not app.processing else curses.color_pair(C_STATUS_PROC)
|
||||
stdscr.addstr(y, 0, mode, mode_attr | curses.A_BOLD)
|
||||
|
||||
# Highlight Workspace dan Session dengan warna Putih-Bold
|
||||
# Highlight Model, Workspace dan Session dengan warna Putih-Bold
|
||||
highlight_attr = curses.color_pair(C_STATUS_INFO) | curses.A_BOLD
|
||||
|
||||
try:
|
||||
# Mode sudah digambar, kita cari posisi setelah mode
|
||||
ws_start = len(mode) + 1 # melewati mode + 1 spasi
|
||||
model_start = len(mode) + 1 # melewati mode + 1 spasi
|
||||
ws_start = len(mode) + len(model) + 2
|
||||
ws_len = len(ws_display)
|
||||
|
||||
# Gambar Model
|
||||
stdscr.addstr(y, model_start, model, highlight_attr)
|
||||
|
||||
# Gambar Workspace
|
||||
stdscr.addstr(y, ws_start, ws_display, highlight_attr)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user