Fixing UI bug
This commit is contained in:
parent
d9ee874f51
commit
419f2832c8
13
tui/app.py
13
tui/app.py
@ -1,4 +1,5 @@
|
||||
import curses
|
||||
import json
|
||||
import threading
|
||||
from datetime import datetime
|
||||
import config
|
||||
@ -82,9 +83,21 @@ class HendrikTUI:
|
||||
if mi:
|
||||
self.log[-1]["model_info"] = (mi.get("provider"), mi.get("model"))
|
||||
elif msg["role"] == "assistant":
|
||||
# Log tool calls jika ada
|
||||
if msg.get("tool_calls"):
|
||||
for tc in msg["tool_calls"]:
|
||||
log(self, "tool_call", json.dumps({
|
||||
"name": tc["function"]["name"],
|
||||
"arguments": tc["function"]["arguments"],
|
||||
}))
|
||||
# Log AI content jika ada dan ini adalah response final
|
||||
next_role = session.messages[i + 1]["role"] if i + 1 < len(session.messages) else None
|
||||
if next_role in ("user", None):
|
||||
if msg.get("content"):
|
||||
log(self, "ai", msg["content"])
|
||||
elif msg["role"] == "tool":
|
||||
# Tool result - tidak perlu di-log secara eksplisit
|
||||
pass
|
||||
if session.messages and session.messages[-1]["role"] == "assistant":
|
||||
log(self, "sep", "")
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user