|
@@ -25,8 +25,10 @@ const eventConfigDialog = document.querySelector("#event-config-dialog");
|
|
|
const auditDialog = document.querySelector("#audit-dialog");
|
|
const auditDialog = document.querySelector("#audit-dialog");
|
|
|
const toolInvocationMode = document.querySelector("#tool-invocation-mode");
|
|
const toolInvocationMode = document.querySelector("#tool-invocation-mode");
|
|
|
const toolModeHelp = document.querySelector("#tool-mode-help");
|
|
const toolModeHelp = document.querySelector("#tool-mode-help");
|
|
|
|
|
+const eventAgentModelSettings = document.querySelector("#event-agent-model-settings");
|
|
|
const WORKSPACE_SNAPSHOTS_STORAGE_KEY = "agent-lab.workspace-snapshots.v1";
|
|
const WORKSPACE_SNAPSHOTS_STORAGE_KEY = "agent-lab.workspace-snapshots.v1";
|
|
|
const LEGACY_PROMPT_SETS_STORAGE_KEY = "agent-lab.prompt-sets.v1";
|
|
const LEGACY_PROMPT_SETS_STORAGE_KEY = "agent-lab.prompt-sets.v1";
|
|
|
|
|
+const CONSOLE_UI_STORAGE_KEY = "agent-lab-console-ui-v1";
|
|
|
|
|
|
|
|
let socket = null;
|
|
let socket = null;
|
|
|
let activeAssistant = null;
|
|
let activeAssistant = null;
|
|
@@ -43,6 +45,7 @@ let auditEntries = [];
|
|
|
let selectedAuditKey = null;
|
|
let selectedAuditKey = null;
|
|
|
let liveAuditSequence = 0;
|
|
let liveAuditSequence = 0;
|
|
|
let turnActive = false;
|
|
let turnActive = false;
|
|
|
|
|
+let eventPromptInsertionIndex = 0;
|
|
|
|
|
|
|
|
bindClick("#add-system-prompt", () => {
|
|
bindClick("#add-system-prompt", () => {
|
|
|
systemPrompts.append(createSystemPrompt({ content: "" }));
|
|
systemPrompts.append(createSystemPrompt({ content: "" }));
|
|
@@ -82,21 +85,124 @@ bindClick("#select-all-tools", () => {
|
|
|
bindClick("#clear-tools", () => {
|
|
bindClick("#clear-tools", () => {
|
|
|
setAllTools(false);
|
|
setAllTools(false);
|
|
|
});
|
|
});
|
|
|
-toolInvocationMode.addEventListener("change", updateToolModeHelp);
|
|
|
|
|
|
|
+toolInvocationMode.addEventListener("change", refreshToolModeState);
|
|
|
|
|
|
|
|
chatForm.addEventListener("submit", (event) => {
|
|
chatForm.addEventListener("submit", (event) => {
|
|
|
event.preventDefault();
|
|
event.preventDefault();
|
|
|
runDebugSession();
|
|
runDebugSession();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+initializeConsoleUi();
|
|
|
initializePromptList();
|
|
initializePromptList();
|
|
|
-updateToolModeHelp();
|
|
|
|
|
refreshWorkspaceSnapshotSelector();
|
|
refreshWorkspaceSnapshotSelector();
|
|
|
loadTools();
|
|
loadTools();
|
|
|
loadSessions({ preserveStatus: true });
|
|
loadSessions({ preserveStatus: true });
|
|
|
renderAuditReplay([]);
|
|
renderAuditReplay([]);
|
|
|
renderSessionUsage({ calls: [], turns: [], session: {} });
|
|
renderSessionUsage({ calls: [], turns: [], session: {} });
|
|
|
|
|
|
|
|
|
|
+function readConsoleUiState() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const state = JSON.parse(localStorage.getItem(CONSOLE_UI_STORAGE_KEY) || "{}");
|
|
|
|
|
+ return state && typeof state === "object" && !Array.isArray(state) ? state : {};
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ return {};
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function writeConsoleUiState(state) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ localStorage.setItem(CONSOLE_UI_STORAGE_KEY, JSON.stringify(state));
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ // Presentation preferences are optional when storage is unavailable.
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function setControlSectionExpanded(button, expanded, { persist = true } = {}) {
|
|
|
|
|
+ const targetId = button.dataset.collapseTarget;
|
|
|
|
|
+ const target = targetId ? document.querySelector(`#${targetId}`) : null;
|
|
|
|
|
+ if (!target) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ button.setAttribute("aria-expanded", String(expanded));
|
|
|
|
|
+ target.hidden = !expanded;
|
|
|
|
|
+ if (persist) {
|
|
|
|
|
+ const state = readConsoleUiState();
|
|
|
|
|
+ const sections = state.sections && typeof state.sections === "object"
|
|
|
|
|
+ ? state.sections
|
|
|
|
|
+ : {};
|
|
|
|
|
+ writeConsoleUiState({
|
|
|
|
|
+ ...state,
|
|
|
|
|
+ sections: { ...sections, [targetId]: Boolean(expanded) },
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function setDebugDrawerOpen(open, { persist = true } = {}) {
|
|
|
|
|
+ const layout = document.querySelector("#console-layout");
|
|
|
|
|
+ const drawer = document.querySelector("#debug-drawer");
|
|
|
|
|
+ const button = document.querySelector("#toggle-debug-drawer");
|
|
|
|
|
+ if (layout) {
|
|
|
|
|
+ layout.classList.toggle("debug-drawer-closed", !open);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (drawer) {
|
|
|
|
|
+ drawer.hidden = !open;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (button) {
|
|
|
|
|
+ button.setAttribute("aria-expanded", String(open));
|
|
|
|
|
+ button.textContent = open ? "Hide Debug" : "Show Debug";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (persist) {
|
|
|
|
|
+ writeConsoleUiState({
|
|
|
|
|
+ ...readConsoleUiState(),
|
|
|
|
|
+ debug_drawer_open: Boolean(open),
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function initializeConsoleUi() {
|
|
|
|
|
+ const state = readConsoleUiState();
|
|
|
|
|
+ document.querySelectorAll(".control-section-toggle").forEach((button) => {
|
|
|
|
|
+ const targetId = button.dataset.collapseTarget;
|
|
|
|
|
+ const storedExpanded = state.sections && typeof state.sections[targetId] === "boolean"
|
|
|
|
|
+ ? state.sections[targetId]
|
|
|
|
|
+ : button.getAttribute("aria-expanded") === "true";
|
|
|
|
|
+ setControlSectionExpanded(button, storedExpanded, { persist: false });
|
|
|
|
|
+ button.addEventListener("click", () => {
|
|
|
|
|
+ setControlSectionExpanded(
|
|
|
|
|
+ button,
|
|
|
|
|
+ button.getAttribute("aria-expanded") !== "true",
|
|
|
|
|
+ );
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ const drawerButton = document.querySelector("#toggle-debug-drawer");
|
|
|
|
|
+ if (drawerButton) {
|
|
|
|
|
+ const storedOpen = typeof state.debug_drawer_open === "boolean"
|
|
|
|
|
+ ? state.debug_drawer_open
|
|
|
|
|
+ : drawerButton.getAttribute("aria-expanded") === "true";
|
|
|
|
|
+ setDebugDrawerOpen(storedOpen, { persist: false });
|
|
|
|
|
+ drawerButton.addEventListener("click", () => {
|
|
|
|
|
+ setDebugDrawerOpen(drawerButton.getAttribute("aria-expanded") !== "true");
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ updateTopbarStatus();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function updateTopbarStatus() {
|
|
|
|
|
+ const sessionLabel = document.querySelector("#current-session-label");
|
|
|
|
|
+ const modeLabel = document.querySelector("#current-mode-label");
|
|
|
|
|
+ if (sessionLabel) {
|
|
|
|
|
+ sessionLabel.textContent = currentSessionId
|
|
|
|
|
+ ? `Session ${currentSessionId.slice(0, 8)}`
|
|
|
|
|
+ : "No session";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (modeLabel) {
|
|
|
|
|
+ modeLabel.textContent = toolInvocationMode.value === "chat_agent_tools"
|
|
|
|
|
+ ? "ChatAgent Tools"
|
|
|
|
|
+ : "Dual Agent";
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function openChatConfig() {
|
|
function openChatConfig() {
|
|
|
chatConfigDialog.showModal();
|
|
chatConfigDialog.showModal();
|
|
|
}
|
|
}
|
|
@@ -180,6 +286,7 @@ async function createSession() {
|
|
|
}),
|
|
}),
|
|
|
});
|
|
});
|
|
|
currentSessionId = session.id;
|
|
currentSessionId = session.id;
|
|
|
|
|
+ updateTopbarStatus();
|
|
|
sessionTitle.value = session.title;
|
|
sessionTitle.value = session.title;
|
|
|
await loadSessions({ preserveStatus: true });
|
|
await loadSessions({ preserveStatus: true });
|
|
|
await loadSessionReplay(session.id, { preserveStatus: true });
|
|
await loadSessionReplay(session.id, { preserveStatus: true });
|
|
@@ -202,6 +309,7 @@ async function loadSelectedSession() {
|
|
|
closeSocket();
|
|
closeSocket();
|
|
|
setSessionStatus("Loading session");
|
|
setSessionStatus("Loading session");
|
|
|
currentSessionId = sessionId;
|
|
currentSessionId = sessionId;
|
|
|
|
|
+ updateTopbarStatus();
|
|
|
await loadSessionReplay(sessionId);
|
|
await loadSessionReplay(sessionId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -261,7 +369,7 @@ function renderTools(tools) {
|
|
|
if (!tools.length) {
|
|
if (!tools.length) {
|
|
|
toolList.textContent = "No tools available";
|
|
toolList.textContent = "No tools available";
|
|
|
updateToolCount();
|
|
updateToolCount();
|
|
|
- updateEventPromptItem(tools);
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -280,7 +388,7 @@ function renderTools(tools) {
|
|
|
checkbox.checked = true;
|
|
checkbox.checked = true;
|
|
|
checkbox.addEventListener("change", () => {
|
|
checkbox.addEventListener("change", () => {
|
|
|
updateToolCount();
|
|
updateToolCount();
|
|
|
- updateEventPromptItem(availableTools);
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
label.append(checkbox, ` ${tool.name}`);
|
|
label.append(checkbox, ` ${tool.name}`);
|
|
@@ -302,7 +410,7 @@ function renderTools(tools) {
|
|
|
pendingEnabledTools = null;
|
|
pendingEnabledTools = null;
|
|
|
}
|
|
}
|
|
|
updateToolCount();
|
|
updateToolCount();
|
|
|
- updateEventPromptItem(tools);
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function formatRequiredParameters(tool) {
|
|
function formatRequiredParameters(tool) {
|
|
@@ -317,7 +425,7 @@ function setAllTools(checked) {
|
|
|
checkbox.checked = checked;
|
|
checkbox.checked = checked;
|
|
|
});
|
|
});
|
|
|
updateToolCount();
|
|
updateToolCount();
|
|
|
- updateEventPromptItem(availableTools);
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function updateToolCount() {
|
|
function updateToolCount() {
|
|
@@ -435,8 +543,26 @@ function restoreWorkspaceSnapshot(snapshot) {
|
|
|
eventAgent.batch_timeout_seconds ?? 15;
|
|
eventAgent.batch_timeout_seconds ?? 15;
|
|
|
const enabledTools = eventAgent.enabled_tools || [];
|
|
const enabledTools = eventAgent.enabled_tools || [];
|
|
|
pendingEnabledTools = applySelectedTools(enabledTools) ? null : enabledTools;
|
|
pendingEnabledTools = applySelectedTools(enabledTools) ? null : enabledTools;
|
|
|
- updateEventPromptItem(availableTools);
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function refreshToolModeState() {
|
|
|
|
|
+ const isChatAgentTools = toolInvocationMode.value === "chat_agent_tools";
|
|
|
|
|
+ updateTopbarStatus();
|
|
|
updateToolModeHelp();
|
|
updateToolModeHelp();
|
|
|
|
|
+ eventAgentModelSettings
|
|
|
|
|
+ .querySelectorAll("input, textarea, select, button")
|
|
|
|
|
+ .forEach((control) => {
|
|
|
|
|
+ control.disabled = isChatAgentTools;
|
|
|
|
|
+ });
|
|
|
|
|
+ const capturedEventPromptIndex = captureEventPromptInsertionIndex();
|
|
|
|
|
+ if (capturedEventPromptIndex !== null) {
|
|
|
|
|
+ eventPromptInsertionIndex = capturedEventPromptIndex;
|
|
|
|
|
+ }
|
|
|
|
|
+ removeGeneratedEventPromptItems();
|
|
|
|
|
+ if (!isChatAgentTools) {
|
|
|
|
|
+ updateEventPromptItem(availableTools);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function updateToolModeHelp() {
|
|
function updateToolModeHelp() {
|
|
@@ -475,12 +601,15 @@ function restoreExtraBody(prefix, extraBody = {}) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function restoreSystemPrompts(prompts) {
|
|
function restoreSystemPrompts(prompts) {
|
|
|
|
|
+ const restoredEventPromptIndex = deriveEventPromptInsertionIndex(prompts);
|
|
|
|
|
+ if (restoredEventPromptIndex !== null) {
|
|
|
|
|
+ eventPromptInsertionIndex = restoredEventPromptIndex;
|
|
|
|
|
+ }
|
|
|
systemPrompts.textContent = "";
|
|
systemPrompts.textContent = "";
|
|
|
const promptItems = normalizePromptItems(prompts);
|
|
const promptItems = normalizePromptItems(prompts);
|
|
|
promptItems.forEach((prompt) => {
|
|
promptItems.forEach((prompt) => {
|
|
|
systemPrompts.append(createSystemPrompt(prompt));
|
|
systemPrompts.append(createSystemPrompt(prompt));
|
|
|
});
|
|
});
|
|
|
- ensureEventPromptItem();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function restorePreMessages(messages) {
|
|
function restorePreMessages(messages) {
|
|
@@ -573,7 +702,7 @@ function applySelectedTools(toolNames) {
|
|
|
checkbox.checked = selected.has(checkbox.value);
|
|
checkbox.checked = selected.has(checkbox.value);
|
|
|
});
|
|
});
|
|
|
updateToolCount();
|
|
updateToolCount();
|
|
|
- updateEventPromptItem(availableTools);
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -582,7 +711,7 @@ function initializePromptList() {
|
|
|
bindPromptItemControls(item);
|
|
bindPromptItemControls(item);
|
|
|
bindPromptDrag(item);
|
|
bindPromptDrag(item);
|
|
|
});
|
|
});
|
|
|
- ensureEventPromptItem();
|
|
|
|
|
|
|
+ refreshToolModeState();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function buildPromptItems() {
|
|
function buildPromptItems() {
|
|
@@ -600,7 +729,13 @@ function buildCustomPromptItems() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function collectSystemPrompts() {
|
|
function collectSystemPrompts() {
|
|
|
- return buildPromptItems()
|
|
|
|
|
|
|
+ const promptItems = buildPromptItems();
|
|
|
|
|
+ const serializablePrompts = promptItems.filter((item) => (
|
|
|
|
|
+ item.prompt_kind === "event_agent_system"
|
|
|
|
|
+ ? toolInvocationMode.value === "dual_agent"
|
|
|
|
|
+ : !isGeneratedEventPromptContent(item.content)
|
|
|
|
|
+ ));
|
|
|
|
|
+ return serializablePrompts
|
|
|
.map((item) => item.content)
|
|
.map((item) => item.content)
|
|
|
.filter(Boolean);
|
|
.filter(Boolean);
|
|
|
}
|
|
}
|
|
@@ -609,10 +744,7 @@ function normalizePromptItems(prompts) {
|
|
|
const items = Array.isArray(prompts) ? prompts : [];
|
|
const items = Array.isArray(prompts) ? prompts : [];
|
|
|
const normalized = items
|
|
const normalized = items
|
|
|
.map((prompt) => normalizePromptItem(prompt))
|
|
.map((prompt) => normalizePromptItem(prompt))
|
|
|
- .filter((prompt) => prompt.prompt_kind === "event_agent_system" || prompt.content);
|
|
|
|
|
- if (!normalized.some((prompt) => prompt.prompt_kind === "event_agent_system")) {
|
|
|
|
|
- normalized.push({ prompt_kind: "event_agent_system", content: "" });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ .filter((prompt) => isRetainedCustomPrompt(prompt));
|
|
|
if (!normalized.some((prompt) => prompt.prompt_kind === "custom")) {
|
|
if (!normalized.some((prompt) => prompt.prompt_kind === "custom")) {
|
|
|
normalized.unshift({ prompt_kind: "custom", role: "system", content: "" });
|
|
normalized.unshift({ prompt_kind: "custom", role: "system", content: "" });
|
|
|
}
|
|
}
|
|
@@ -636,6 +768,42 @@ function normalizePromptItem(prompt) {
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function deriveEventPromptInsertionIndex(prompts) {
|
|
|
|
|
+ const items = Array.isArray(prompts) ? prompts : [];
|
|
|
|
|
+ let retainedPromptCount = 0;
|
|
|
|
|
+ for (const prompt of items) {
|
|
|
|
|
+ const normalized = normalizePromptItem(prompt);
|
|
|
|
|
+ if (
|
|
|
|
|
+ normalized.prompt_kind === "event_agent_system"
|
|
|
|
|
+ || isGeneratedEventPromptContent(normalized.content)
|
|
|
|
|
+ ) {
|
|
|
|
|
+ return retainedPromptCount;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (isRetainedCustomPrompt(normalized)) {
|
|
|
|
|
+ retainedPromptCount += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function isRetainedCustomPrompt(prompt) {
|
|
|
|
|
+ return prompt.prompt_kind !== "event_agent_system"
|
|
|
|
|
+ && Boolean(prompt.content)
|
|
|
|
|
+ && !isGeneratedEventPromptContent(prompt.content);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function isGeneratedEventPromptContent(content) {
|
|
|
|
|
+ const normalized = typeof content === "string" ? content.trim() : "";
|
|
|
|
|
+ return normalized.startsWith(
|
|
|
|
|
+ "You may request EventAgent work using this text protocol.",
|
|
|
|
|
+ )
|
|
|
|
|
+ && normalized.includes("<agent_events>")
|
|
|
|
|
+ && normalized.includes("</agent_events>")
|
|
|
|
|
+ && normalized.includes(
|
|
|
|
|
+ "Use exact event names only, one per line. Do not include parameters.",
|
|
|
|
|
+ );
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function buildAvailableEventsPrompt(tools) {
|
|
function buildAvailableEventsPrompt(tools) {
|
|
|
const eventLines = tools.map((tool) => `- ${tool.name}: ${tool.description || "No description"}`);
|
|
const eventLines = tools.map((tool) => `- ${tool.name}: ${tool.description || "No description"}`);
|
|
|
if (!eventLines.length) {
|
|
if (!eventLines.length) {
|
|
@@ -662,6 +830,31 @@ function updateEventPromptItem(tools) {
|
|
|
eventPrompt.querySelector(".system-prompt").value = prompt;
|
|
eventPrompt.querySelector(".system-prompt").value = prompt;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function isGeneratedEventPromptItem(item) {
|
|
|
|
|
+ const content = item.querySelector(".system-prompt").value;
|
|
|
|
|
+ return item.dataset.promptKind === "event_agent_system"
|
|
|
|
|
+ || isGeneratedEventPromptContent(content);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function captureEventPromptInsertionIndex() {
|
|
|
|
|
+ let retainedPromptCount = 0;
|
|
|
|
|
+ for (const item of systemPrompts.querySelectorAll(".prompt-item")) {
|
|
|
|
|
+ if (isGeneratedEventPromptItem(item)) {
|
|
|
|
|
+ return retainedPromptCount;
|
|
|
|
|
+ }
|
|
|
|
|
+ retainedPromptCount += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function removeGeneratedEventPromptItems() {
|
|
|
|
|
+ systemPrompts.querySelectorAll(".prompt-item").forEach((item) => {
|
|
|
|
|
+ if (isGeneratedEventPromptItem(item)) {
|
|
|
|
|
+ item.remove();
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function ensureEventPromptItem() {
|
|
function ensureEventPromptItem() {
|
|
|
const existing = systemPrompts.querySelector('[data-prompt-kind="event_agent_system"]');
|
|
const existing = systemPrompts.querySelector('[data-prompt-kind="event_agent_system"]');
|
|
|
if (existing) {
|
|
if (existing) {
|
|
@@ -672,7 +865,9 @@ function ensureEventPromptItem() {
|
|
|
prompt_kind: "event_agent_system",
|
|
prompt_kind: "event_agent_system",
|
|
|
content: "",
|
|
content: "",
|
|
|
});
|
|
});
|
|
|
- systemPrompts.append(item);
|
|
|
|
|
|
|
+ const promptItems = [...systemPrompts.querySelectorAll(".prompt-item")];
|
|
|
|
|
+ const insertionTarget = promptItems[eventPromptInsertionIndex] || null;
|
|
|
|
|
+ systemPrompts.insertBefore(item, insertionTarget);
|
|
|
return item;
|
|
return item;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -907,6 +1102,7 @@ function handleServerMessage(message) {
|
|
|
if (message.type === "session_started") {
|
|
if (message.type === "session_started") {
|
|
|
if (message.session_id) {
|
|
if (message.session_id) {
|
|
|
currentSessionId = message.session_id;
|
|
currentSessionId = message.session_id;
|
|
|
|
|
+ updateTopbarStatus();
|
|
|
loadSessions({ preserveStatus: true });
|
|
loadSessions({ preserveStatus: true });
|
|
|
}
|
|
}
|
|
|
appendLog("session", "Session started");
|
|
appendLog("session", "Session started");
|