feat(app): log screen saves (shown lines, conversation, voice recordings), stop-or-finish on a new request, video pages that play
- 로그 screen: "보이는 글 txt로 저장" (logs_save_text), a 대화 view that saves the days' conversation with every trace in full (history_export), and a 목소리 view with the voice.record switch and the days' recordings as a zip with an index (voice_export). - Voice worker: with JARVIS_RECORDINGS_DIR (voice.record, off by default) each final and each spoken answer is kept as a WAV with an index line; day folders older than 7 days removed. - response.interrupt (default on): off, latest/important finish the running answer first. - Bot browser: Chrome lets pages start video and sound; botBrowser reports each page's media state, waits for a player to start after open/click, and presses play on a video page a click led to when its player stayed paused (live: a clicked YouTube video stayed paused). - webSearch reads `query` when `search_query` is missing (live: both searches of an answer failed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -832,7 +832,15 @@ function logsScreen() {
|
||||
await navigator.clipboard.writeText(r.report);
|
||||
toast(r.tooLongForDiscord ? "복사했습니다. 디스코드 메시지 한도(2,000자)를 넘으니 파일로 내보내세요." : "최근 오류를 복사했습니다.");
|
||||
} catch (e) { fail(e); }
|
||||
} }, "최근 오류 복사")),
|
||||
} }, "최근 오류 복사"),
|
||||
h("button", { class: "btn", onclick: async () => {
|
||||
try {
|
||||
const text = [...box.children].map((l) => l.textContent).join("\n");
|
||||
if (!text) return toast("화면에 보이는 로그가 없습니다");
|
||||
const r = await api("logs_save_text", { text });
|
||||
toast(`${r.path}에 저장했습니다`);
|
||||
} catch (e) { fail(e); }
|
||||
} }, "보이는 글 txt로 저장")),
|
||||
box,
|
||||
h("div", { class: "row", style: "margin-top:10px" }, h("span", { class: "muted" }, "내보내기"), from, "~", to,
|
||||
h("button", { class: "btn", onclick: async () => {
|
||||
@@ -841,9 +849,10 @@ function logsScreen() {
|
||||
toast(`${r.path}에 저장했습니다${r.droppedLines ? ` (10MB를 넘어 오래된 ${r.droppedLines}줄은 뺐습니다)` : ""}`);
|
||||
} catch (e) { fail(e); }
|
||||
} }, "zip으로 저장")));
|
||||
// 로그 and 한 일 (the activity) on one screen; 한 일 is read again each time it is opened.
|
||||
// 로그, 대화 (its export), 목소리 (the recordings) and 한 일 (the activity) on one screen; each view
|
||||
// but 로그 is made again each time it is opened.
|
||||
const body = h("div");
|
||||
const switches = [["로그", () => logs], ["한 일", activityView]].map(([label, make]) => {
|
||||
const switches = [["로그", () => logs], ["대화", talkExportView], ["목소리", voiceView], ["한 일", activityView]].map(([label, make]) => {
|
||||
const b = h("button", { class: "btn", onclick: () => {
|
||||
for (const x of switches) x.classList.toggle("primary", x === b);
|
||||
body.replaceChildren(make());
|
||||
@@ -856,6 +865,50 @@ function logsScreen() {
|
||||
return { view, tick: () => logs.isConnected && poll() };
|
||||
}
|
||||
|
||||
/** Two date boxes for a range of days, today by default (local time). */
|
||||
function dayRange() {
|
||||
const today = dayOf(Date.now() / 1000);
|
||||
return [h("input", { type: "date", value: today }), h("input", { type: "date", value: today })];
|
||||
}
|
||||
|
||||
/** The 로그 screen's 대화 view: the 대화 screen's content of some days, saved as a text file. */
|
||||
function talkExportView() {
|
||||
const [from, to] = dayRange();
|
||||
return h("div", { class: "card" },
|
||||
h("div", { class: "hint" }, "대화 화면의 내용을 날짜별로 txt 파일에 저장합니다. 사람이 한 말, 자비스 생각(참고한 기록, 고른 도구, 계획, 도구 호출과 가져온 자료), 자비스 답이 모두 들어갑니다. 파일은 데이터 폴더의 logs 폴더에 저장되고 이 PC에만 남습니다."),
|
||||
h("div", { class: "row" }, from, "~", to, h("button", { class: "btn primary", onclick: async () => {
|
||||
try {
|
||||
const r = await api("history_export", { from: from.value, to: to.value });
|
||||
toast(r.items ? `${r.items}개를 ${r.path}에 저장했습니다` : `그 날짜에는 기록이 없습니다 (${r.path})`);
|
||||
} catch (e) { fail(e); }
|
||||
} }, "txt로 저장")));
|
||||
}
|
||||
|
||||
/** The 로그 screen's 목소리 view: whether recordings are kept, and the recordings of some days as a zip. */
|
||||
function voiceView() {
|
||||
const on = h("input", { type: "checkbox", class: "switch" });
|
||||
api("settings_view").then((v) => { on.checked = !!v["voice.record"]; }).catch(fail);
|
||||
on.addEventListener("change", async () => {
|
||||
try {
|
||||
const r = await api("settings_apply", { changes: { "voice.record": on.checked } });
|
||||
toast(r.restartNeeded ? "저장했습니다. 봇을 다시 시작하면 적용됩니다." : "저장했습니다.");
|
||||
} catch (e) { on.checked = !on.checked; fail(e); }
|
||||
});
|
||||
const [from, to] = dayRange();
|
||||
return h("div", { class: "card" },
|
||||
h("div", { class: "hint" }, "켜 두면 음성 채널에서 받아 적은 말 하나하나와 자비스가 말한 답을 소리 파일(wav)로 저장합니다. 같은 채널의 다른 사람 목소리도 저장되니 필요할 때만 켜 주세요. 데이터 폴더의 recordings 폴더에 7일 동안 남고 그 뒤 지웁니다. 봇을 다음에 시작할 때부터 적용됩니다."),
|
||||
h("label", { class: "row", style: "margin-bottom:12px" }, on, "목소리 녹음 저장"),
|
||||
h("div", { class: "row" }, from, "~", to, h("button", { class: "btn primary", onclick: async () => {
|
||||
try {
|
||||
const r = await api("voice_export", { from: from.value, to: to.value });
|
||||
const mb = (r.bytes / 1e6).toFixed(1);
|
||||
toast(r.files ? `소리 파일 ${r.files}개(${mb}MB)를 ${r.path}에 저장했습니다${r.bytes > 10e6 ? ". 디스코드 파일 한도(10MB)를 넘습니다" : ""}`
|
||||
: `그 날짜에는 저장된 목소리가 없습니다 (${r.path})`);
|
||||
} catch (e) { fail(e); }
|
||||
} }, "zip으로 저장")),
|
||||
h("div", { class: "small muted", style: "margin-top:8px" }, "zip 안의 index.txt에 파일마다 시간, 누가 말했는지, 받아 적은 글(자비스는 말한 글)이 적혀 있습니다."));
|
||||
}
|
||||
|
||||
// ---- update -------------------------------------------------------------------------------------
|
||||
|
||||
/** The 앱 screen's update card: the version here, the newest release, its download and install. */
|
||||
|
||||
Reference in New Issue
Block a user