feat(tui): welcome art with light-blue thick border, new C_WELCOME color pair
This commit is contained in:
parent
02f5ce345b
commit
d833774809
12
tui/agent.py
12
tui/agent.py
@ -3,6 +3,18 @@ import threading
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from scripts import ntro
|
from scripts import ntro
|
||||||
|
|
||||||
|
WELCOME_ART = """\
|
||||||
|
\n\
|
||||||
|
╔══════════════════════════════════════════╗
|
||||||
|
║ ║
|
||||||
|
║ /\\_/\\ H E N D R I K ║
|
||||||
|
║ ( o.o ) AI Agent ║
|
||||||
|
║ > ^ < siap membantu! ║
|
||||||
|
║ ( ) ║
|
||||||
|
║ (___) ║
|
||||||
|
║ ║
|
||||||
|
╚══════════════════════════════════════════╝"""
|
||||||
|
|
||||||
|
|
||||||
def log(app, role, text):
|
def log(app, role, text):
|
||||||
app.log.append({
|
app.log.append({
|
||||||
|
|||||||
@ -2,6 +2,7 @@ import curses
|
|||||||
import threading
|
import threading
|
||||||
from .render import init_colors, draw
|
from .render import init_colors, draw
|
||||||
from .input import handle_key
|
from .input import handle_key
|
||||||
|
from .agent import log, WELCOME_ART
|
||||||
|
|
||||||
|
|
||||||
class HendrikTUI:
|
class HendrikTUI:
|
||||||
@ -41,6 +42,7 @@ class HendrikTUI:
|
|||||||
|
|
||||||
self.messages = [{"role": "system",
|
self.messages = [{"role": "system",
|
||||||
"content": self.build_system_prompt(self.tools_def)}]
|
"content": self.build_system_prompt(self.tools_def)}]
|
||||||
|
log(self, "welcome", WELCOME_ART)
|
||||||
|
|
||||||
while self.running:
|
while self.running:
|
||||||
self.h, self.w = stdscr.getmaxyx()
|
self.h, self.w = stdscr.getmaxyx()
|
||||||
|
|||||||
@ -20,6 +20,7 @@ C_ERROR = 8 # error message: merah
|
|||||||
C_INPUT_BORDER = 9 # border input box: biru
|
C_INPUT_BORDER = 9 # border input box: biru
|
||||||
C_STATUS_INFO = 12 # status info (workspace/hints): putih
|
C_STATUS_INFO = 12 # status info (workspace/hints): putih
|
||||||
C_HINT_DISABLED = 13 # hint disabled (abu-abu)
|
C_HINT_DISABLED = 13 # hint disabled (abu-abu)
|
||||||
|
C_WELCOME = 14 # welcome art: light blue
|
||||||
|
|
||||||
|
|
||||||
def init_colors():
|
def init_colors():
|
||||||
@ -38,6 +39,7 @@ def init_colors():
|
|||||||
curses.init_pair(C_ERROR, curses.COLOR_RED, -1)
|
curses.init_pair(C_ERROR, curses.COLOR_RED, -1)
|
||||||
curses.init_pair(C_INPUT_BORDER, curses.COLOR_BLUE, -1)
|
curses.init_pair(C_INPUT_BORDER, curses.COLOR_BLUE, -1)
|
||||||
curses.init_pair(C_HINT_DISABLED, 8, -1) # abu-abu di atas bg default
|
curses.init_pair(C_HINT_DISABLED, 8, -1) # abu-abu di atas bg default
|
||||||
|
curses.init_pair(C_WELCOME, curses.COLOR_BLUE + 8, -1) # light blue
|
||||||
|
|
||||||
|
|
||||||
def draw(app, stdscr):
|
def draw(app, stdscr):
|
||||||
@ -123,6 +125,10 @@ def draw_chat(app, stdscr):
|
|||||||
rendered.append((C_SYSTEM, lines[0]))
|
rendered.append((C_SYSTEM, lines[0]))
|
||||||
for line in lines[1:]:
|
for line in lines[1:]:
|
||||||
rendered.append((C_SYSTEM, " " + line))
|
rendered.append((C_SYSTEM, " " + line))
|
||||||
|
elif role == "welcome":
|
||||||
|
lines = text.split("\n")
|
||||||
|
for line in lines:
|
||||||
|
rendered.append((C_WELCOME, " " + line))
|
||||||
elif role == "error":
|
elif role == "error":
|
||||||
label = " \u2717 "
|
label = " \u2717 "
|
||||||
lines = text.split("\n")
|
lines = text.split("\n")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user