Auto-generate on clear create-photo user requests (0.15.16).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-23 20:56:09 +03:00
co-authored by Cursor
parent caa18e8a51
commit 649c64a587
8 changed files with 69 additions and 19 deletions
+1 -3
View File
@@ -1218,9 +1218,7 @@ import { DEFAULT_ASPECT_TABLE, applyAspectTableFromObject as mergeAspectTable }
const modelAsked = !!(patch && (patch.generate === true || patch.generate === 1
|| (typeof patch.generate === 'string' && /^(true|1|yes|on)$/i.test(patch.generate))
|| (Array.isArray(patch.actions) && patch.actions.map(String).includes('generate'))));
const hasPrompt = !!(String(patch?.prompt || '').trim() || String(opts.sessionPrompt || '').trim());
const userAsked = !isMachineTurn(opts) && userAsksGenerate(userText)
&& (modelAsked || hasPrompt);
const userAsked = !isMachineTurn(opts) && userAsksGenerate(userText);
const generate = !vetoed && !opts.fromAutoCritique && (userAsked || !!opts.userWantsGenerate);
const hasLook = !!patch
&& (patch.look_at != null || patch.vision_from != null || patch.vision_slots != null);
+26 -4
View File
@@ -28,13 +28,36 @@ export function userAsksGenerate(text) {
if (!t || userAsksNoGenerate(t)) {
return false;
}
if (/^как\s+(сгенерир|нарисов|сделать\s+(фото|кадр|изображ))/i.test(t)) {
return false;
}
if (/\bhow\s+to\s+(generate|draw|make|create)\b/i.test(t)) {
return false;
}
if (/\b(generat(e|ion)|draw|render|make\s+(an?\s+)?image|run\s+generate)\b/i.test(t)) {
return true;
}
if (/\b(create|make)\s+(a\s+)?(photo|picture|image|shot|portrait)\b/i.test(t)) {
return true;
}
if (/\blet['']?s\s+(make|create|generate|draw)\s+(an?\s+)?(image|photo|picture|shot)\b/i.test(t)) {
return true;
}
if (/\bi\s+want\s+(an?\s+)?(image|photo|picture|shot)\b/i.test(t)) {
return true;
}
return cyrTokenRe(
'сгенер[а-яё]*|нарисуй|нарисуйте|нарисуем|'
+ 'запусти\\s+генер[а-яё]*|'
+ 'сдела(й|ем|йте)\\s+(кадр|картинк[а-яё]*|изображ[а-яё]*)',
+ 'созда(й|йте|дим|дите)\\s+(фото|фотограф[а-яё]*|картинк[а-яё]*|изображ[а-яё]*|кадр|портрет|снимок)|'
+ 'сдела(й|йте|ем|йте)\\s+(фото|фотограф[а-яё]*|кадр|картинк[а-яё]*|изображ[а-яё]*|портрет|снимок)|'
+ 'давай\\s+(фото|фотограф[а-яё]*|картинк[а-яё]*|изображ[а-яё]*|кадр|сгенер[а-яё]*|нарису[а-яё]*)|'
+ 'давай\\s+сделаем\\s+(фото|фотограф[а-яё]*|картинк[а-яё]*|изображ[а-яё]*|кадр)|'
+ 'хочу\\s+(фото|фотограф[а-яё]*|картинк[а-яё]*|изображ[а-яё]*|кадр)|'
+ 'нужн[ао]?\\s+(фото|фотограф[а-яё]*|картинк[а-яё]*|изображ[а-яё]*|кадр)|'
+ 'сфотографируй|отрисуй|'
+ 'придумай\\s+(фото|кадр|картинк[а-яё]*|сцену|изображ[а-яё]*)|'
+ 'сгенери(руй|руйте)\\s+(мне\\s+)?(фото|кадр|картинк[а-яё]*|изображ[а-яё]*)',
).test(t);
}
@@ -87,14 +110,13 @@ function generateFlagOn(patch) {
/**
* Generate is user-owned. Model `generate:true` is advisory (Qwen dumps it on Q&A).
* User «нарисуй»/«сгенерируй» (or opts.userWantsGenerate from hops/buttons) starts Generate.
* User «нарисуй»/«сгенерируй»/«создай фото» (or opts.userWantsGenerate from hops/buttons) starts Generate.
*/
export function resolveTurnIntent(patch, userText, opts = {}) {
const vetoed = !opts.machineTurn && userAsksNoGenerate(userText);
const modelAsked = generateFlagOn(patch);
const hasPrompt = !!(String(patch?.prompt || '').trim() || String(opts.sessionPrompt || '').trim());
const userAsked = !opts.machineTurn && userAsksGenerate(userText)
&& (modelAsked || hasPrompt);
const userAsked = !opts.machineTurn && userAsksGenerate(userText);
const generate = !vetoed && !opts.fromAutoCritique && (userAsked || !!opts.userWantsGenerate);
const hasLook = !!patch
&& (patch.look_at != null || patch.vision_from != null || patch.vision_slots != null);
+1 -3
View File
@@ -355,9 +355,7 @@ export function resolveTurnIntent(patch, userText, {
const delta = normalizeDelta(patch) || {};
const vetoed = typeof vetoFn === 'function' ? !!vetoFn(userText) : false;
const modelAsked = patchWantsGenerate(delta);
const hasPrompt = !!(String(delta.prompt || '').trim() || String(sessionPrompt || '').trim());
const userAsked = typeof askGenerateFn === 'function' && !!askGenerateFn(userText)
&& (modelAsked || hasPrompt);
const userAsked = typeof askGenerateFn === 'function' && !!askGenerateFn(userText);
const generate = !vetoed && !fromAutoCritique && (userAsked || !!userWantsGenerate);
const hasLook = delta.look_at != null || delta.vision_from != null || delta.vision_slots != null;
const look = !!(hasLook && !generate && !vetoed);