Improving TUI
This commit is contained in:
parent
bb3cf5a6a1
commit
bbf67f11b1
@ -20,6 +20,7 @@ class HendrikTUI:
|
|||||||
self.TOOL_HANDLERS = TOOL_HANDLERS
|
self.TOOL_HANDLERS = TOOL_HANDLERS
|
||||||
self.build_system_prompt = build_system_prompt
|
self.build_system_prompt = build_system_prompt
|
||||||
self.agent_max_iterations = agent_max_iterations
|
self.agent_max_iterations = agent_max_iterations
|
||||||
|
self.character_name = config.AGENT_CHARACTER or "AI Agent"
|
||||||
|
|
||||||
self.messages = None
|
self.messages = None
|
||||||
self.log = []
|
self.log = []
|
||||||
|
|||||||
@ -57,9 +57,9 @@ def draw(app, stdscr):
|
|||||||
|
|
||||||
|
|
||||||
def draw_header(app, stdscr):
|
def draw_header(app, stdscr):
|
||||||
# Baris 1: " Hendrik AI Agent ─────── <model> "
|
# Baris 1: " {app.character_name} AI Agent ─────── <model> "
|
||||||
w = app.w
|
w = app.w
|
||||||
name = " Hendrik AI Agent "
|
name = f" {app.character_name} AI Agent "
|
||||||
model = f" {app.llm.model} "
|
model = f" {app.llm.model} "
|
||||||
# Perbaiki kalkulasi agar line1 tepat mengisi w kolom
|
# Perbaiki kalkulasi agar line1 tepat mengisi w kolom
|
||||||
mid = w - len(model) - 1
|
mid = w - len(model) - 1
|
||||||
@ -181,7 +181,7 @@ def draw_chat(app, stdscr):
|
|||||||
_add_row([(C_USER, label)])
|
_add_row([(C_USER, label)])
|
||||||
_wrap_render(text, indent=1, color=C_INPUT, bold=False)
|
_wrap_render(text, indent=1, color=C_INPUT, bold=False)
|
||||||
elif role == "ai":
|
elif role == "ai":
|
||||||
label = f" Hendrik ({item['time']}) "
|
label = f" {app.character_name} ({item['time']}) "
|
||||||
_add_row([(C_AI, label)])
|
_add_row([(C_AI, label)])
|
||||||
_wrap_render(text, indent=1, color=C_INPUT, bold=False)
|
_wrap_render(text, indent=1, color=C_INPUT, bold=False)
|
||||||
elif role == "system":
|
elif role == "system":
|
||||||
@ -217,7 +217,7 @@ def draw_chat(app, stdscr):
|
|||||||
|
|
||||||
# Label: "Hendrik" hijau + "tool_name" kuning + "(HH:MM)" hijau
|
# Label: "Hendrik" hijau + "tool_name" kuning + "(HH:MM)" hijau
|
||||||
_add_row([
|
_add_row([
|
||||||
(C_AI, " Hendrik "),
|
(C_AI, f" {app.character_name} "),
|
||||||
(C_TOOL_CALL, tname),
|
(C_TOOL_CALL, tname),
|
||||||
(C_AI, f" ({item['time']}) "),
|
(C_AI, f" ({item['time']}) "),
|
||||||
])
|
])
|
||||||
@ -225,7 +225,7 @@ def draw_chat(app, stdscr):
|
|||||||
_wrap_text_simple(args_str, indent=1, color=C_INPUT, bold=False)
|
_wrap_text_simple(args_str, indent=1, color=C_INPUT, bold=False)
|
||||||
except Exception:
|
except Exception:
|
||||||
_add_row([
|
_add_row([
|
||||||
(C_AI, " Hendrik "),
|
(C_AI, f" {app.character_name} "),
|
||||||
(C_TOOL_CALL, "unknown"),
|
(C_TOOL_CALL, "unknown"),
|
||||||
(C_AI, f" ({item['time']}) "),
|
(C_AI, f" ({item['time']}) "),
|
||||||
])
|
])
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user