Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

feat(agent): auto-load most-recent session on first tab open

mrbizarro93677168cc1b
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 9958a1e..a0718ca 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -10466,6 +10466,13 @@ function workflowSwitch(name) {
const stored = localStorage.getItem('phos_agent_session');
if (stored) {
agentLoadSession(stored);
+ } else {
+ // No session in this browser yet — but the panel may already
+ // have persisted sessions on disk (e.g. an overnight agentic
+ // run that completed before the user reopened the panel).
+ // Pick the most-recently-updated one so the user lands in
+ // the conversation they care about, not an empty pane.
+ agentLoadMostRecent();
}
} else {
agentLoadSession(window.AGENT.sessionId);
@@ -10532,6 +10539,20 @@ async function agentNewSession(initialMessage) {
return j.session;
}
+async function agentLoadMostRecent() {
+ try {
+ const r = await fetch('/agent/sessions');
+ const j = await r.json();
+ const sessions = j.sessions || [];
+ if (sessions.length === 0) return; // empty pane is correct here
+ const mostRecent = sessions[0]; // server-side sorted by updated_at desc
+ await agentLoadSession(mostRecent.session_id);
+ try { localStorage.setItem('phos_agent_session', mostRecent.session_id); } catch(e) {}
+ } catch (e) {
+ console.warn('agentLoadMostRecent', e);
+ }
+}
+
async function agentLoadSession(sid) {
try {
const r = await fetch('/agent/sessions/' + encodeURIComponent(sid));