Add storage-backed story history
This commit is contained in:
@@ -32,7 +32,7 @@ class TTSFactoryModule extends BaseModule {
|
||||
this.db = null; // Will hold the DB connection
|
||||
this.dbName = 'ttsAudioCacheDB';
|
||||
this.storeName = 'audioCacheStore';
|
||||
this.dbVersion = 1;
|
||||
this.dbVersion = 2;
|
||||
this.currentCacheSize = 0; // Track current size in bytes
|
||||
this.maxCacheSizeBytes = 100 * 1024 * 1024; // 100 MB by default
|
||||
this.cacheInitialized = false;
|
||||
@@ -1537,6 +1537,16 @@ class TTSFactoryModule extends BaseModule {
|
||||
console.log("Created 'size' index.");
|
||||
}
|
||||
}
|
||||
if (!db.objectStoreNames.contains('storyHistoryStore')) {
|
||||
const historyStore = db.createObjectStore('storyHistoryStore', { keyPath: 'key' });
|
||||
historyStore.createIndex('gameId', 'gameId', { unique: false });
|
||||
historyStore.createIndex('gameOrder', ['gameId', 'blockId'], { unique: true });
|
||||
console.log("Object store 'storyHistoryStore' created.");
|
||||
}
|
||||
if (!db.objectStoreNames.contains('storySaveStore')) {
|
||||
db.createObjectStore('storySaveStore', { keyPath: 'slot' });
|
||||
console.log("Object store 'storySaveStore' created.");
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user