kingkont 0.20.19 → 0.20.20

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingkont",
3
- "version": "0.20.19",
3
+ "version": "0.20.20",
4
4
  "description": "KingKont \u00b7 Chatium \u2014 \u043d\u043e\u0434-\u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0441\u0446\u0435\u043d \u0441 AI-\u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 (\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438/\u0432\u0438\u0434\u0435\u043e/\u0433\u043e\u043b\u043e\u0441/SFX/\u043c\u0443\u0437\u044b\u043a\u0430/\u0442\u0435\u043a\u0441\u0442)",
5
5
  "main": "main.js",
6
6
  "bin": {
@@ -2207,8 +2207,24 @@ async function runNodeJobDirectly(node) {
2207
2207
  const model = g.model || g.modelKey || 'anthropic/claude-sonnet-4';
2208
2208
  await runTextJob(node, g.prompt, model, boardHandle, bKey, imageRefs);
2209
2209
  } else {
2210
- // image / video
2211
- await startGenerationJob(node, kind, g.prompt, refs, boardHandle, bKey, g.modelKey);
2210
+ // image / video — modelKey должен быть short-key (state.videoModel-style),
2211
+ // а не full-slug. Если g.modelKey не сохранён (старые ноды) — конвертируем
2212
+ // из g.model через _shortVideoModelFromGen/_shortImageModelFromGen.
2213
+ let modelKey = g.modelKey;
2214
+ if (!modelKey) {
2215
+ if (kind === 'video' && typeof _shortVideoModelFromGen === 'function') {
2216
+ modelKey = _shortVideoModelFromGen(g);
2217
+ } else if (kind === 'image' && typeof _shortImageModelFromGen === 'function') {
2218
+ modelKey = _shortImageModelFromGen(g);
2219
+ }
2220
+ }
2221
+ console.log(`[runNodeJobDirectly ${kind}] using node-saved params:`, {
2222
+ modelKey,
2223
+ ...(kind === 'video' ? {
2224
+ duration: g.duration, resolution: g.resolution, aspectRatio: g.aspectRatio,
2225
+ } : { aspectRatio: g.aspectRatio }),
2226
+ });
2227
+ await startGenerationJob(node, kind, g.prompt, refs, boardHandle, bKey, modelKey);
2212
2228
  }
2213
2229
  } catch (e) {
2214
2230
  console.error('runNodeJobDirectly failed', e);
package/renderer/media.js CHANGED
@@ -648,6 +648,39 @@ async function restartJob(nodeId) {
648
648
  }
649
649
  }
650
650
 
651
+ // Конвертер full-slug → short-key для UI-кнопок [data-vid-model] / [data-img-model].
652
+ // Старые ноды могли сохранять только g.model (полный slug провайдера),
653
+ // а селектор кнопки сравнивает с short-key (state.videoModel = 'kling-3.0').
654
+ // Без этой конверсии restore модели из ноды ничего не делал, и юзер видел
655
+ // "последний выбранный мной", а не модель ноды.
656
+ const _VIDEO_SLUG_TO_KEY = {
657
+ 'bytedance/seedance-2': 'seedance-2',
658
+ 'bytedance/seedance-2-fast': 'seedance-2-fast',
659
+ 'kwaivgi/kling-o1': 'kling-o1',
660
+ 'kling-3.0/video': 'kling-3.0',
661
+ };
662
+ const _IMAGE_SLUG_TO_KEY = {
663
+ 'nano-banana-2': 'nano-banana-2',
664
+ 'nano-banana-pro': 'nano-banana-pro',
665
+ 'grok-imagine/text-to-image': 'grok',
666
+ 'seedream/4.5-text-to-image': 'seedream',
667
+ 'seedream/5-lite-text-to-image': 'seedream-5-lite',
668
+ 'gpt-image-2-text-to-image': 'gpt-image-2',
669
+ 'gpt-image/1.5-text-to-image': 'gpt-image-1.5',
670
+ 'flux/schnell': 'flux-schnell',
671
+ 'sdxl/lightning': 'sdxl-lightning',
672
+ };
673
+ function _shortVideoModelFromGen(g) {
674
+ if (g.modelKey) return g.modelKey;
675
+ if (g.model && _VIDEO_SLUG_TO_KEY[g.model]) return _VIDEO_SLUG_TO_KEY[g.model];
676
+ return null;
677
+ }
678
+ function _shortImageModelFromGen(g) {
679
+ if (g.modelKey) return g.modelKey;
680
+ if (g.model && _IMAGE_SLUG_TO_KEY[g.model]) return _IMAGE_SLUG_TO_KEY[g.model];
681
+ return null;
682
+ }
683
+
651
684
  async function regenerateNode(node) {
652
685
  if (node.status === 'generating') return;
653
686
  const g = node.generated || {};
@@ -742,23 +775,33 @@ async function regenerateNode(node) {
742
775
 
743
776
  $('ttsModelRow').style.display = state.genKind === 'audio' ? '' : 'none';
744
777
 
745
- if (g.modelKey && state.genKind === 'image') {
746
- state.imageModel = g.modelKey;
747
- document.querySelectorAll('#genModal [data-img-model]').forEach(b =>
748
- b.classList.toggle('active', b.dataset.imgModel === g.modelKey));
749
- }
750
778
  if (state.genKind === 'image') {
779
+ const imgKey = _shortImageModelFromGen(g);
780
+ if (imgKey) state.imageModel = imgKey;
781
+ document.querySelectorAll('#genModal [data-img-model]').forEach(b =>
782
+ b.classList.toggle('active', b.dataset.imgModel === state.imageModel));
751
783
  if (g.aspectRatio) state.imageAspect = g.aspectRatio;
752
784
  syncImageAspectActive();
753
785
  }
754
- // Видео: подставляем сохранённые duration/resolution/aspect для regenerate
786
+ // Видео: подставляем сохранённые duration/resolution/aspect/model для
787
+ // regenerate. Юзер: «если в ноде есть указанные параметры длины видео,
788
+ // модели, ratio — безусловно используй их в диалоге и в самой генерации».
789
+ // Раньше: `if (g.modelKey) state.videoModel = ...` — если у ноды только
790
+ // полный slug (g.model = 'bytedance/seedance-2', а modelKey пустой), мы
791
+ // оставляли state.videoModel = "последнее выбранное юзером". Теперь
792
+ // конвертируем full-slug → short-key через _shortVideoModelFromGen.
793
+ // duration приводим к number — старые ноды могли сохранять строкой.
755
794
  if (state.genKind === 'video') {
756
- if (g.duration) state.videoDuration = g.duration;
795
+ const vidKey = _shortVideoModelFromGen(g);
796
+ if (vidKey) state.videoModel = vidKey;
797
+ if (g.duration != null) state.videoDuration = +g.duration || state.videoDuration;
757
798
  if (g.resolution) state.videoResolution = g.resolution;
758
799
  if (g.aspectRatio) state.videoAspect = g.aspectRatio;
759
- if (g.modelKey) state.videoModel = g.modelKey;
760
800
  syncVideoOptionsActive();
761
801
  syncVideoModelActive();
802
+ console.log('[regenerateNode video] restored from node:',
803
+ { modelKey: state.videoModel, duration: state.videoDuration,
804
+ resolution: state.videoResolution, aspect: state.videoAspect });
762
805
  }
763
806
  if (state.genKind === 'audio') {
764
807
  if (g.ttsModel) state.ttsModel = g.ttsModel;