fix(app): 대화 shows a trace before a quick answer ends

The screen re-read its window every 3 seconds unless a trace was already
shown as being made, so an answer that ended between two reads came with
its trace. It now asks twice a second for history_stamp (the newest
record and trace ids and the steps of the traces being made, cheap and not
logged) and reads the window again as soon as it changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
javis-bot
2026-11-16 12:33:38 +09:00
parent 1f2a8ec05e
commit b2b6f92943
4 changed files with 79 additions and 8 deletions

View File

@@ -589,11 +589,19 @@ function conversationScreen() {
h("div", { class: "hint", style: "margin:8px 0" }, "사람이 한 말, 자비스의 답, 자비스가 답을 만든 과정(참고한 기록, 고른 도구, 계획, 도구 호출과 결과, 모델 생각)을 시간순으로 보여 줍니다. 자비스가 말을 알아들은 순간 생각이 나타나고, 답을 만드는 동안 단계가 하나씩 채워집니다. 모델 생각은 생각 모드가 켜진 답에만 있습니다. 생각 기록은 30일 동안 둡니다. 실시간으로 다시 읽는 것은 최근 2,000개까지이고, 그보다 앞서 불러온 기록의 수정과 삭제는 화면을 다시 열면 보입니다."),
h("div", { class: "row", style: "justify-content:center" }, more), box);
load();
// Every second while an answer is being made, so its trace fills in as it goes; else every 3 seconds.
let ticks = 0;
const tick = () => {
const making = page.shown.some((i) => i.pending);
if (live.checked && (making || ++ticks % 3 === 0)) load();
// Twice a second the store's stamp (cheap): when something was said, a question arrived or an
// answer moved on, the window is read again at once, so a trace shows from its question on and
// fills in as it goes. Every 3 seconds it is read anyway (an edited message changes no stamp).
let ticks = 0, stamp = null, asking = false;
const tick = async () => {
if (!live.checked) return;
if (++ticks % 6 === 0) return load();
if (asking) return;
asking = true;
try {
const s = (await api("history_stamp")).stamp;
if (s !== stamp) { stamp = s; load(); }
} catch (e) { /* the next tick tries again */ } finally { asking = false; }
};
return { view, tick };
}
@@ -925,7 +933,7 @@ async function show(name) {
try {
if (name === "dashboard") { screen.replaceChildren(); await refresh(); ticker = setInterval(refresh, 1000); return; }
if (name === "logs") { const l = logsScreen(); screen.replaceChildren(l.view); ticker = setInterval(l.tick, 1000); return; }
if (name === "conversations") { const c = conversationScreen(); screen.replaceChildren(c.view); ticker = setInterval(c.tick, 1000); return; }
if (name === "conversations") { const c = conversationScreen(); screen.replaceChildren(c.view); ticker = setInterval(c.tick, 500); return; }
if (name === "notes") { screen.replaceChildren(notesScreen()); return; }
const titles = { bot: "봇", channels: "채널·호출", chat: "채팅 채널", memory: "대화 기억", model: "모델", features: "기능",
collect: "백그라운드 수집", game: "게임 모드", schedule: "예약", pcControl: "PC 제어", app: "앱" };