IndexedDB open sometime hangs forever

This commit is contained in:
Cohee
2023-08-14 19:40:31 +03:00
parent 8c759e87cf
commit edcce96a6e
2 changed files with 6 additions and 4 deletions

View File

@ -457,7 +457,7 @@ $(document).ready(function () {
saveSettingsDebounced(); saveSettingsDebounced();
}); });
$("#phrase_rep_pen_novel", function () { $("#phrase_rep_pen_novel").on('change', function () {
const val = $("#phrase_rep_pen_novel").find(":selected").val(); const val = $("#phrase_rep_pen_novel").find(":selected").val();
nai_settings.phrase_rep_pen = getPhraseRepPenString(Number(val).toFixed(0)); nai_settings.phrase_rep_pen = getPhraseRepPenString(Number(val).toFixed(0));
saveSettingsDebounced(); saveSettingsDebounced();

View File

@ -122,15 +122,15 @@ const openrouter_website_model = 'OR_Website';
let biasCache = undefined; let biasCache = undefined;
let model_list = []; let model_list = [];
const objectStore = new IndexedDBStore('SillyTavern', 'chat_completions'); const objectStore = new IndexedDBStore('SillyTavern', 'chat_completions');
const tokenCache = await loadTokenCache(); let tokenCache = {};
async function loadTokenCache() { async function loadTokenCache() {
try { try {
console.debug('Chat Completions: loading token cache from IndexedDB') console.debug('Chat Completions: loading token cache from IndexedDB')
return await objectStore.get('tokenCache') || {}; tokenCache = await objectStore.get('tokenCache') || {};
} catch (e) { } catch (e) {
console.log('Chat Completions: unable to load token cache from IndexedDB, using default value', e); console.log('Chat Completions: unable to load token cache from IndexedDB, using default value', e);
return {}; tokenCache = {};
} }
} }
@ -2800,6 +2800,8 @@ function onProxyPasswordShowClick() {
} }
$(document).ready(function () { $(document).ready(function () {
loadTokenCache();
$('#test_api_button').on('click', testApiConnection); $('#test_api_button').on('click', testApiConnection);
$(document).on('input', '#temp_openai', function () { $(document).on('input', '#temp_openai', function () {