Spaces:
Running
Running
Upload kimi-utils.js
Browse files- kimi-js/kimi-utils.js +8 -2
kimi-js/kimi-utils.js
CHANGED
|
@@ -562,6 +562,10 @@ class KimiVideoManager {
|
|
| 562 |
|
| 563 |
// Nettoyer les handlers en cours lors du changement de personnage
|
| 564 |
this._cleanupLoadingHandlers();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 565 |
|
| 566 |
this.updateVideoCategories();
|
| 567 |
}
|
|
@@ -1508,11 +1512,13 @@ class KimiVideoManager {
|
|
| 1508 |
|
| 1509 |
const folder = getCharacterInfo(this.characterName).videoFolder;
|
| 1510 |
// Rotating fallback pool (stable neutrals first positions)
|
| 1511 |
-
|
|
|
|
| 1512 |
const neutralList = (this.videoCategories && this.videoCategories.neutral) || [];
|
| 1513 |
-
// Choose first 3 as
|
| 1514 |
this._fallbackPool = neutralList.slice(0, 3);
|
| 1515 |
this._fallbackIndex = 0;
|
|
|
|
| 1516 |
}
|
| 1517 |
const fallbackVideo = this._fallbackPool[this._fallbackIndex % this._fallbackPool.length];
|
| 1518 |
|
|
|
|
| 562 |
|
| 563 |
// Nettoyer les handlers en cours lors du changement de personnage
|
| 564 |
this._cleanupLoadingHandlers();
|
| 565 |
+
// Reset per-character fallback pool so it will be rebuilt for the new character
|
| 566 |
+
this._fallbackPool = null;
|
| 567 |
+
this._fallbackIndex = 0;
|
| 568 |
+
this._fallbackPoolCharacter = null;
|
| 569 |
|
| 570 |
this.updateVideoCategories();
|
| 571 |
}
|
|
|
|
| 1512 |
|
| 1513 |
const folder = getCharacterInfo(this.characterName).videoFolder;
|
| 1514 |
// Rotating fallback pool (stable neutrals first positions)
|
| 1515 |
+
// Build or rebuild fallback pool when absent or when character changed
|
| 1516 |
+
if (!this._fallbackPool || this._fallbackPoolCharacter !== this.characterName) {
|
| 1517 |
const neutralList = (this.videoCategories && this.videoCategories.neutral) || [];
|
| 1518 |
+
// Choose first 3 as core reliable set; if less than 3 available, take all
|
| 1519 |
this._fallbackPool = neutralList.slice(0, 3);
|
| 1520 |
this._fallbackIndex = 0;
|
| 1521 |
+
this._fallbackPoolCharacter = this.characterName;
|
| 1522 |
}
|
| 1523 |
const fallbackVideo = this._fallbackPool[this._fallbackIndex % this._fallbackPool.length];
|
| 1524 |
|