mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
@@ -171,16 +171,24 @@ async function readCharacterData(inputFile, inputFormat = 'png') {
|
|||||||
return memoryCache.get(cacheKey);
|
return memoryCache.get(cacheKey);
|
||||||
}
|
}
|
||||||
if (useDiskCache) {
|
if (useDiskCache) {
|
||||||
const cachedData = await diskCache.instance().then(i => i.getItem(cacheKey));
|
try {
|
||||||
if (cachedData) {
|
const cachedData = await diskCache.instance().then(i => i.getItem(cacheKey));
|
||||||
return cachedData;
|
if (cachedData) {
|
||||||
|
return cachedData;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Error while reading from disk cache:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await parse(inputFile, inputFormat);
|
const result = await parse(inputFile, inputFormat);
|
||||||
!isAndroid && memoryCache.set(cacheKey, result);
|
!isAndroid && memoryCache.set(cacheKey, result);
|
||||||
if (useDiskCache) {
|
if (useDiskCache) {
|
||||||
await diskCache.instance().then(i => i.setItem(cacheKey, result));
|
try {
|
||||||
|
await diskCache.instance().then(i => i.setItem(cacheKey, result));
|
||||||
|
} catch (error) {
|
||||||
|
console.warn('Error while writing to disk cache:', error);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user