Fixing minor issues
This commit is contained in:
parent
b954f5a6cb
commit
34527d5438
@ -62,7 +62,13 @@ def submit(app, stdscr):
|
|||||||
app.scroll = 999999
|
app.scroll = 999999
|
||||||
app.processing = True
|
app.processing = True
|
||||||
|
|
||||||
_add_msg(app, "user", query)
|
if app.current_session is None:
|
||||||
|
app.current_session = app.session_mgr.create(
|
||||||
|
f"Session {datetime.now().strftime('%Y-%m-%d %H:%M')}",
|
||||||
|
app._model_info(),
|
||||||
|
)
|
||||||
|
|
||||||
|
_add_msg(app, "user", query, model_info=app._model_info())
|
||||||
|
|
||||||
app.agent_done.clear()
|
app.agent_done.clear()
|
||||||
app.agent_thread = threading.Thread(
|
app.agent_thread = threading.Thread(
|
||||||
|
|||||||
18
tui/app.py
18
tui/app.py
@ -71,15 +71,16 @@ class HendrikTUI:
|
|||||||
self.log.clear()
|
self.log.clear()
|
||||||
self.scroll = 0
|
self.scroll = 0
|
||||||
log(self, "welcome", WELCOME_ART)
|
log(self, "welcome", WELCOME_ART)
|
||||||
for msg in session.messages:
|
for i, msg in enumerate(session.messages):
|
||||||
if msg["role"] == "user":
|
if msg["role"] == "user":
|
||||||
|
if i > 0:
|
||||||
|
log(self, "sep", "")
|
||||||
log(self, "user", msg["content"])
|
log(self, "user", msg["content"])
|
||||||
|
mi = msg.get("model_info")
|
||||||
|
if mi:
|
||||||
|
self.log[-1]["model_info"] = (mi.get("provider"), mi.get("model"))
|
||||||
elif msg["role"] == "assistant":
|
elif msg["role"] == "assistant":
|
||||||
log(self, "ai", msg["content"])
|
log(self, "ai", msg["content"])
|
||||||
elif msg["role"] == "system" and msg.get("content"):
|
|
||||||
if len(msg["content"]) > 100:
|
|
||||||
continue
|
|
||||||
log(self, "system", msg["content"])
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
try:
|
try:
|
||||||
@ -93,7 +94,12 @@ class HendrikTUI:
|
|||||||
stdscr.keypad(True)
|
stdscr.keypad(True)
|
||||||
stdscr.refresh()
|
stdscr.refresh()
|
||||||
|
|
||||||
self.new_session()
|
self.messages = [{"role": "system", "content": self.build_system_prompt(
|
||||||
|
tools_definition=self.tools_def,
|
||||||
|
character=config.AGENT_CHARACTER or None,
|
||||||
|
skills=config.AGENT_SKILLS.split(",") if config.AGENT_SKILLS else None,
|
||||||
|
)}]
|
||||||
|
log(self, "welcome", WELCOME_ART)
|
||||||
|
|
||||||
while self.running:
|
while self.running:
|
||||||
self.h, self.w = stdscr.getmaxyx()
|
self.h, self.w = stdscr.getmaxyx()
|
||||||
|
|||||||
@ -137,7 +137,7 @@ def draw_chat(app, stdscr):
|
|||||||
info_line = f" {p_name} - {m_name} "
|
info_line = f" {p_name} - {m_name} "
|
||||||
else:
|
else:
|
||||||
info_line = f" {m_name} "
|
info_line = f" {m_name} "
|
||||||
_add_row([(C_SYSTEM, info_line)])
|
_add_row([(C_USER, info_line)])
|
||||||
label = f" You ({item['time']}) "
|
label = f" You ({item['time']}) "
|
||||||
_add_row([(C_USER, label)])
|
_add_row([(C_USER, label)])
|
||||||
_wrap_render(text, indent=1, color=C_INPUT)
|
_wrap_render(text, indent=1, color=C_INPUT)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user