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 <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-21 23:36:29 +03:00
co-authored by Cursor
parent 6d487726ef
commit 25c98b2d1d
3 changed files with 37 additions and 9 deletions
+31 -5
View File
@@ -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());
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);
}
+3 -2
View File
@@ -1,6 +1,6 @@
{
"welcome_html": "<div class=\"sa-welcome-title\">Assistent · Krea 2</div><ul><li><strong>Generate</strong> слева — живой просмотр. В чат сам не уходит.</li><li><strong>Refs</strong> — референсы на отдельной вкладке: drop / paste / Снимок gen.</li><li>Галочка vision на окне — отправить кадр модели.</li><li>Чипсы aspect / seed / Vary / Turbo·RAW. В чате: <code>/help</code>.</li><li>Кнопки патча только у последнего предложения.</li></ul>Напиши, что сгенерировать — или кинь референс и попроси правку.",
"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 <query> — поиск 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 <query> — поиск 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" },
+2 -1
View File
@@ -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 |