kingkont 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/renderer/chat.js +29 -8
package/package.json
CHANGED
package/renderer/chat.js
CHANGED
|
@@ -182,16 +182,35 @@
|
|
|
182
182
|
},
|
|
183
183
|
|
|
184
184
|
generate_node: {
|
|
185
|
-
description: 'Запустить генерацию для draft-ноды (image/video/audio).
|
|
185
|
+
description: 'Запустить генерацию для draft-ноды (image/video/audio/text). Стартует напрямую в фоне БЕЗ показа диалога — не интерактивная UI-форма как regenerateNode.',
|
|
186
186
|
params: '{"id":"<node-id>"}',
|
|
187
187
|
async handler({ id }) {
|
|
188
188
|
const b = state.currentBoard;
|
|
189
189
|
if (!b) throw new Error('доска не выбрана');
|
|
190
190
|
const node = b.metadata.nodes.find(n => n.id === id);
|
|
191
191
|
if (!node) throw new Error(`нода не найдена: ${id}`);
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
const prompt = node.generated?.prompt || node.generated?.rawPrompt;
|
|
193
|
+
if (!prompt) throw new Error('у ноды нет промпта');
|
|
194
|
+
const kind = node.type;
|
|
195
|
+
const refs = (node.generated?.refs || []).map(r => ({ name: r.name, type: r.type, file: r.file }));
|
|
196
|
+
const modelKey = node.generated?.modelKey;
|
|
197
|
+
const boardHandle = b.handle;
|
|
198
|
+
const bKey = b.key;
|
|
199
|
+
// Маршрутизация по kind — копия логики из resumeJob, чтобы запустить
|
|
200
|
+
// job напрямую без gen-modal'а.
|
|
201
|
+
if (kind === 'audio') {
|
|
202
|
+
if (typeof runTTSJob !== 'function') throw new Error('runTTSJob недоступен');
|
|
203
|
+
runTTSJob(node, prompt, boardHandle, bKey, node.generated?.voiceId).catch(e => console.error('TTS job failed:', e));
|
|
204
|
+
} else if (kind === 'text') {
|
|
205
|
+
if (typeof runTextJob !== 'function') throw new Error('runTextJob недоступен');
|
|
206
|
+
const imageRefs = refs.filter(r => r.type === 'image' && r.file);
|
|
207
|
+
runTextJob(node, prompt, modelKey || 'anthropic/claude-sonnet-4', boardHandle, bKey, imageRefs).catch(e => console.error('text job failed:', e));
|
|
208
|
+
} else {
|
|
209
|
+
// image / video — через KIE/Chatium.
|
|
210
|
+
if (typeof startGenerationJob !== 'function') throw new Error('startGenerationJob недоступен');
|
|
211
|
+
startGenerationJob(node, kind, prompt, refs, boardHandle, bKey, modelKey).catch(e => console.error('gen job failed:', e));
|
|
212
|
+
}
|
|
213
|
+
return { ok: true, note: 'генерация стартовала в фоне (без gen-modal)' };
|
|
195
214
|
},
|
|
196
215
|
},
|
|
197
216
|
};
|
|
@@ -214,10 +233,12 @@
|
|
|
214
233
|
}
|
|
215
234
|
lines.push('');
|
|
216
235
|
lines.push('Правила:');
|
|
217
|
-
lines.push('- Не выдумывай id нод —
|
|
218
|
-
lines.push('-
|
|
219
|
-
lines.push('-
|
|
220
|
-
lines.push('-
|
|
236
|
+
lines.push('- Не выдумывай id нод — id это случайные UUID, угадать нельзя.');
|
|
237
|
+
lines.push(' - Если нужен id существующей ноды — сначала read_scene (вернёт массив с реальными id).');
|
|
238
|
+
lines.push(' - После add_node — id новой ноды лежит в result.id ответа этого вызова.');
|
|
239
|
+
lines.push('- Не выдумывай имена сцен — сначала list_scenes.');
|
|
240
|
+
lines.push('- Для генерации сразу после add_node — ВОЗЬМИ id из result.id ПРЕДЫДУЩЕГО вызова и передай в generate_node.');
|
|
241
|
+
lines.push('- Когда нужно создать несколько нод сразу — выдавай add_node + generate_node чередуя, или сначала все add_node, потом все generate_node (используя id из их result-ов).');
|
|
221
242
|
lines.push('- Отвечай по-русски, кратко. Объясняй что делаешь, без лишней воды.');
|
|
222
243
|
lines.push('');
|
|
223
244
|
lines.push('ВАЖНО: НИКОГДА не пиши <tool_result>...</tool_result> сам — это формат который Я');
|