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.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
feat(agent): show model reasoning as a "Thinking" disclosure
mrbizarro529c3ea76f71
diff --git a/agent/engine.py b/agent/engine.pyindex 11479cd..3ac960e 100644--- a/agent/engine.py+++ b/agent/engine.py@@ -81,6 +81,13 @@ class ChatResult:finish_reason: str = "stop"usage: dict = field(default_factory=dict)model: str = ""+ # Some chat servers (mlx-lm with reasoning models like Qwen 3.6,+ # DeepSeek R1) return the model's chain-of-thought in a separate+ # `reasoning` field on the response message. We surface it so the+ # UI can show "what the model was thinking" — invisible reasoning+ # is the #1 cause of "agent appears stuck" reports. Empty for+ # non-reasoning models / non-supporting servers.+ reasoning: str = ""def _normalize_for_wire(messages: list[dict]) -> list[dict]:@@ -199,13 +206,9 @@ def chat(messages: list[dict], config: EngineConfig,# and `message.content` (final answer). When max_tokens is too small,# reasoning consumes the budget and content comes back empty with# finish_reason="length" — the agent gets nothing and the chat- # appears "stuck". Two recovery paths:- # 1. Empty content + non-empty reasoning + finish="length" → raise- # a clear error so the user knows to bump max_tokens.- # 2. Empty content + non-empty reasoning + finish="stop" → use- # the reasoning as content. This is unusual (the model- # decided to put its answer in the thinking block) but better- # than silently dropping output.+ # appears "stuck". We surface reasoning ALWAYS (so the UI can show+ # "what the model was thinking") and fall back to using it as+ # content only when content is empty.reasoning = msg.get("reasoning") or ""if not content and reasoning:if finish == "length":@@ -218,8 +221,10 @@ def chat(messages: list[dict], config: EngineConfig,# No length issue but content is empty — fall back to reasoning# so SOMETHING surfaces in the chat.content = reasoning+ reasoning = "" # already promoted to content; don't double-showreturn ChatResult(content=content, finish_reason=finish, usage=usage,+ reasoning=reasoning,model=data.get("model", config.model))diff --git a/agent/runtime.py b/agent/runtime.pyindex b527867..27d0602 100644--- a/agent/runtime.py+++ b/agent/runtime.py@@ -318,9 +318,16 @@ def run_turn(session: Session, user_message: str | None,returnassistant_content = result.content or ""- session.messages.append({"role": "assistant", "content": assistant_content})+ # Persist reasoning alongside content so it survives panel restart+ # and the UI can re-render it on session load. Most chat models+ # don't return reasoning; the field is empty in that case.+ msg_dict: dict = {"role": "assistant", "content": assistant_content}+ if getattr(result, "reasoning", None):+ msg_dict["reasoning"] = result.reasoning+ session.messages.append(msg_dict)yield emit(TurnEvent("assistant", {"content": assistant_content,+ "reasoning": getattr(result, "reasoning", "") or "","step": step_i,"model": result.model,"usage": result.usage,diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex b4a44a2..25ea462 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -3824,6 +3824,13 @@ def _render_session_messages(sess: agent_runtime.Session) -> list[dict]:"tool": action.get("tool"),"args": action.get("args", {}),}+ # Surface model reasoning to the UI as a separate field so+ # the renderer can show it as a collapsible "Thinking" block.+ # Reasoning is what makes the agent feel "stuck" when it+ # isn't — the user sees no content and assumes nothing's+ # happening, but the model is reasoning.+ if m.get("reasoning"):+ entry["reasoning"] = m["reasoning"]out.append(entry)continueout.append({"kind": role, "content": content})@@ -7974,6 +7981,54 @@ HTML = r"""<!doctype html>margin: 14px 0;}+ /* ---- Reasoning disclosure (chain-of-thought) ----+ Shown above the assistant content as a collapsed details block.+ Quiet by default so the answer stays the focus; expanding reveals+ the model's thought process. Reasoning often runs 1–4k chars on+ a planning turn — scroll caps prevent runaway height. */+ .agent-reasoning {+ margin: 0 0 8px 0;+ border: 1px solid var(--border);+ border-radius: 8px;+ background: rgba(255,255,255,0.02);+ }+ .agent-reasoning > summary {+ list-style: none;+ cursor: pointer;+ padding: 7px 12px;+ display: inline-flex;+ align-items: center;+ gap: 7px;+ font-size: 11px;+ color: var(--muted);+ user-select: none;+ }+ .agent-reasoning > summary::-webkit-details-marker { display: none; }+ .agent-reasoning > summary svg {+ transition: transform 0.18s ease;+ flex-shrink: 0;+ }+ .agent-reasoning[open] > summary svg { transform: rotate(90deg); }+ .agent-reasoning > summary .label {+ font-weight: 600;+ color: var(--text);+ }+ .agent-reasoning > summary .meta {+ color: var(--muted);+ font-weight: 400;+ }+ .agent-reasoning .agent-reasoning-body {+ padding: 0 14px 12px 26px;+ font-size: 11.5px;+ line-height: 1.6;+ color: rgba(255,255,255,0.62);+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;+ white-space: pre-wrap;+ word-break: break-word;+ max-height: 320px;+ overflow-y: auto;+ }+/* ---- Tool cards (calls + results, expandable) ----Visually quieter than they used to be: 2px left accent (was 3px),subtle background, smaller font, less vertical padding. The point@@ -14738,6 +14793,13 @@ function renderMessage(m) {body.appendChild(renderAttachmentChips(m.attachments));}+ // Reasoning disclosure — surfaces the model's chain-of-thought as a+ // collapsible "Thinking" block above the content. Closed by default+ // so the chat reads as the answer; expand to see the model's work.+ // The #1 fix for "agent appears stuck" — reasoning models spend most+ // of their time here and the user couldn't see it.+ if (m.reasoning) body.appendChild(renderReasoningBlock(m.reasoning));+const content = document.createElement('div');content.className = 'agent-msg-content agent-md';content.innerHTML = mdToHtml(m.content || '');@@ -14750,6 +14812,29 @@ function renderMessage(m) {return row;}+// Reasoning block — shows the model's chain-of-thought (Qwen 3.6 / R1 /+// any mlx-lm reasoning model). Collapsed by default; click to expand.+// Reads as a quiet bracket of italic text above the answer so users+// see SOMETHING happened during the long inference even if the final+// content was short. Crucial for reasoning models where the model+// spends 80% of its tokens here.+function renderReasoningBlock(text) {+ const wrap = document.createElement('details');+ wrap.className = 'agent-reasoning';+ const sum = document.createElement('summary');+ const len = (text || '').length;+ sum.innerHTML =+ '<svg viewBox="0 0 24 24" width="11" height="11" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 5l7 7-7 7"/></svg>' ++ '<span class="label">Thinking</span>' ++ `<span class="meta">${len.toLocaleString()} chars</span>`;+ wrap.appendChild(sum);+ const body = document.createElement('div');+ body.className = 'agent-reasoning-body';+ body.textContent = text;+ wrap.appendChild(body);+ return wrap;+}+function renderAttachmentChips(attachments) {const wrap = document.createElement('div');wrap.className = 'agent-msg-attachments';