From 25c98b2d1d5ad6c0279148e5bd4327f6d9d07e37 Mon Sep 17 00:00:00 2001 From: Leonid Pershin Date: Fri, 21 Aug 2026 23:36:29 +0300 Subject: [PATCH] Allow /debug ask and /why to call the LLM for a short explanation. Client dump stays the source of truth; the model only narrates Exact vs session vs live without applying a patch. Co-authored-by: Cursor --- Assets/assistent.js | 38 ++++++++++++++++++++++++++++++++------ Config/_base/ui.json | 5 +++-- README.md | 3 ++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/Assets/assistent.js b/Assets/assistent.js index 8b927dc..18abb9c 100644 --- a/Assets/assistent.js +++ b/Assets/assistent.js @@ -66,7 +66,9 @@ let HELP_TEXT = `Slash-команды (без LLM): /help — этот список -/debug — сводка: промпт, params, Exact/session, почему так +/debug — сводка UI/Exact (без LLM) +/debug ask — то же + короткий ответ модели +/why — сразу /debug ask /gen — Generate сейчас /look generate|refN — прикрепить окно к vision /init /mask /clear — Init / Mask / Clear Init @@ -82,7 +84,8 @@ let SLASH_COMMANDS = [ { cmd: '/help', hint: 'список команд' }, - { cmd: '/debug', hint: 'сводка настроек' }, + { cmd: '/debug', hint: 'сводка · ask = с LLM' }, + { cmd: '/why', hint: 'debug + пояснение LLM' }, { cmd: '/gen', hint: 'Generate сейчас' }, { cmd: '/look ', hint: 'generate|refN' }, { cmd: '/init', hint: 'как Init' }, @@ -4234,7 +4237,7 @@ } async function handleReplySideEffects(reply, civitaiResults, opts = {}) { - const { fromAutoCritique, fromVisionHop, fromCards } = opts; + const { fromAutoCritique, fromVisionHop, fromCards, fromDebug } = opts; if (fromCards) { const card = extractCardJson(reply); if (card) { @@ -4286,6 +4289,11 @@ return; } } + if (fromDebug) { + // Q&A only — never apply patches / generate from a debug explanation turn. + state.pendingSilentGen = false; + return; + } const wantsGen = !!(opts.userWantsGenerate || state.pendingSilentGen || (Array.isArray(patch?.actions) && patch.actions.map(String).includes('generate'))); const doApply = !!(patch && (wantsGen || $('sa_auto_apply')?.checked)); @@ -4456,8 +4464,26 @@ return true; } if (cmd === 'debug' || cmd === 'dbg' || cmd === 'why') { - appendSystemNote(buildDebugSummary()); - setStatus('/debug'); + const dump = buildDebugSummary(); + appendSystemNote(dump); + const argL = String(arg || '').toLowerCase().trim(); + const wantLlm = cmd === 'why' + || /^(ask|llm|explain|поясни|почему|модель)(\s|$)/i.test(argL); + if (wantLlm) { + setStatus('/debug ask…'); + await sendChat({ + forcedUserText: + 'Отладка Assistent. Ниже факты UI (уже собраны клиентом). ' + + 'Кратко своими словами (5–10 строк, язык пользователя): какие промпт/params сейчас, ' + + 'что из Exact vs session_exact vs live, что сделал последний патч и почему так логично. ' + + 'Без JSON patch, без generate, без look_at.\n\n' + dump, + skipSlash: true, + skipAutoPack: true, + fromDebug: true, + }); + } else { + setStatus('/debug'); + } return true; } if (cmd === 'gen' || cmd === 'generate') { @@ -4660,7 +4686,7 @@ if (!text) { return; } - if (!opts.fromAutoCritique && !opts.fromDownload && !opts.fromVisionHop) { + if (!opts.fromAutoCritique && !opts.fromDownload && !opts.fromVisionHop && !opts.fromDebug) { state.lastUserParamIntent = userTextMentionsParams(text); state.pendingSilentGen = userAsksGenerate(text); } diff --git a/Config/_base/ui.json b/Config/_base/ui.json index fbd7b73..6a82be2 100644 --- a/Config/_base/ui.json +++ b/Config/_base/ui.json @@ -1,6 +1,6 @@ { "welcome_html": "
Assistent · Krea 2
Напиши, что сгенерировать — или кинь референс и попроси правку.", - "help_text": "Slash-команды (без LLM):\n/help — этот список\n/debug — сводка: промпт, params, Exact/session, почему так\n/gen — Generate сейчас\n/look generate|refN — прикрепить окно к vision\n/init /mask /clear — Init / Mask / Clear Init\n/interrupt — остановить генерацию\n/aspect 16:9 — размер из таблицы 1K\n/seed lock|random — зафиксировать или рандомизировать seed\n/vary — новый seed, тот же промпт\n/pack write|critique|compose|params|inpaint|describe|card\n/civitai — поиск LoRA (Confirm в чате)\n/inventory — rescan моделей + обновить список LoRA\n\nЧипсы над полем ввода делают то же для aspect / seed / vary / Turbo·RAW.", + "help_text": "Slash-команды (без LLM):\n/help — этот список\n/debug — сводка UI/Exact\n/debug ask · /why — сводка + короткий ответ модели\n/gen — Generate сейчас\n/look generate|refN — прикрепить окно к vision\n/init /mask /clear — Init / Mask / Clear Init\n/interrupt — остановить генерацию\n/aspect 16:9 — размер из таблицы 1K\n/seed lock|random — зафиксировать или рандомизировать seed\n/vary — новый seed, тот же промпт\n/pack write|critique|compose|params|inpaint|describe|card\n/civitai — поиск LoRA (Confirm в чате)\n/inventory — rescan моделей + обновить список LoRA\n\nЧипсы над полем ввода делают то же для aspect / seed / vary / Turbo·RAW.", "chips": [ { "label": "1:1", "action": "aspect", "value": "1:1", "title": "1024×1024" }, { "label": "4:5", "action": "aspect", "value": "4:5", "title": "928×1152" }, @@ -17,7 +17,8 @@ ], "slash": [ { "cmd": "/help", "hint": "список команд", "action": "help" }, - { "cmd": "/debug", "hint": "сводка настроек", "action": "debug" }, + { "cmd": "/debug", "hint": "сводка · ask = с LLM", "action": "debug" }, + { "cmd": "/why", "hint": "debug + пояснение LLM", "action": "why" }, { "cmd": "/gen", "hint": "Generate сейчас", "action": "gen" }, { "cmd": "/look ", "hint": "generate|refN", "action": "look" }, { "cmd": "/init", "hint": "как Init", "action": "init" }, diff --git a/README.md b/README.md index 9db4ef1..5fe8f21 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ Copy `personas/cinema/` → `noir/`, edit only differing JSON files. | Command | Effect | | --- | --- | | `/help` | List commands | -| `/debug` | Short dump: prompt, params, Exact/session, why | +| `/debug` | Short UI/Exact dump (no LLM) | +| `/debug ask` / `/why` | Dump + short model explanation | | `/gen` | Generate now | | `/look generate\|refN` | Attach that board window + ask the LLM to look | | `/init` `/mask` `/clear` | Same as board buttons |