mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
unvendor: Replace localforage
This commit is contained in:
@ -52,7 +52,6 @@ module.exports = {
|
||||
globals: {
|
||||
droll: 'readonly',
|
||||
Handlebars: 'readonly',
|
||||
localforage: 'readonly',
|
||||
moment: 'readonly',
|
||||
pdfjsLib: 'readonly',
|
||||
Popper: 'readonly',
|
||||
|
25
package-lock.json
generated
25
package-lock.json
generated
@ -34,6 +34,7 @@
|
||||
"ip-matching": "^2.1.2",
|
||||
"ipaddr.js": "^2.0.1",
|
||||
"jimp": "^0.22.10",
|
||||
"localforage": "^1.10.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mime-types": "^2.1.35",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
@ -4504,6 +4505,12 @@
|
||||
"integrity": "sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/immediate": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
|
||||
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/import-fresh": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz",
|
||||
@ -4946,6 +4953,15 @@
|
||||
"node": ">= 0.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lie": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
|
||||
"integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"immediate": "~3.0.5"
|
||||
}
|
||||
},
|
||||
"node_modules/load-bmfont": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/load-bmfont/-/load-bmfont-1.4.2.tgz",
|
||||
@ -4971,6 +4987,15 @@
|
||||
"node": ">=6.11.5"
|
||||
}
|
||||
},
|
||||
"node_modules/localforage": {
|
||||
"version": "1.10.0",
|
||||
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz",
|
||||
"integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"lie": "3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
|
||||
|
@ -24,6 +24,7 @@
|
||||
"ip-matching": "^2.1.2",
|
||||
"ipaddr.js": "^2.0.1",
|
||||
"jimp": "^0.22.10",
|
||||
"localforage": "^1.10.0",
|
||||
"lodash": "^4.17.21",
|
||||
"mime-types": "^2.1.35",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
|
1
public/global.d.ts
vendored
1
public/global.d.ts
vendored
@ -1,7 +1,6 @@
|
||||
// Global namespace modules
|
||||
declare var droll;
|
||||
declare var Handlebars;
|
||||
declare var localforage;
|
||||
declare var pdfjsLib;
|
||||
declare var Popper;
|
||||
declare var showdown;
|
||||
|
@ -6758,7 +6758,6 @@
|
||||
<script src="lib/select2-search-placeholder.js"></script>
|
||||
<script src="lib/seedrandom.min.js"></script>
|
||||
<script src="lib/droll.js"></script>
|
||||
<script src="lib/localforage.min.js"></script>
|
||||
<script src="lib/handlebars.js"></script>
|
||||
<script src="lib/pagination.js"></script>
|
||||
<script src="lib/toolcool-color-picker.js"></script>
|
||||
|
@ -24,7 +24,6 @@
|
||||
"droll",
|
||||
"handlebars",
|
||||
"highlight.js",
|
||||
"localforage",
|
||||
"pdfjs-dist",
|
||||
"@mozilla/readability"
|
||||
]
|
||||
|
@ -5,6 +5,7 @@
|
||||
import Fuse from 'fuse.js';
|
||||
import DOMPurify from 'dompurify';
|
||||
import hljs from 'highlight.js';
|
||||
import localforage from 'localforage';
|
||||
|
||||
/**
|
||||
* Expose the libraries to the 'window' object.
|
||||
@ -27,16 +28,22 @@ export function initLibraryShims() {
|
||||
// @ts-ignore
|
||||
window.hljs = hljs;
|
||||
}
|
||||
if (!('localforage' in window)) {
|
||||
// @ts-ignore
|
||||
window.localforage = localforage;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
Fuse,
|
||||
DOMPurify,
|
||||
hljs,
|
||||
localforage,
|
||||
};
|
||||
|
||||
export {
|
||||
Fuse,
|
||||
DOMPurify,
|
||||
hljs,
|
||||
localforage,
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ import {
|
||||
Fuse,
|
||||
DOMPurify,
|
||||
hljs,
|
||||
localforage,
|
||||
initLibraryShims,
|
||||
default as libs,
|
||||
} from './lib.js';
|
||||
@ -503,7 +504,7 @@ reloadMarkdownProcessor();
|
||||
|
||||
// array for prompt token calculations
|
||||
console.debug('initializing Prompt Itemization Array on Startup');
|
||||
const promptStorage = new localforage.createInstance({ name: 'SillyTavern_Prompts' });
|
||||
const promptStorage = localforage.createInstance({ name: 'SillyTavern_Prompts' });
|
||||
export let itemizedPrompts = [];
|
||||
|
||||
export const systemUserName = 'SillyTavern System';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { localforage } from '../lib.js';
|
||||
import { characters, main_api, api_server, nai_settings, online_status, this_chid } from '../script.js';
|
||||
import { power_user, registerDebugFunction } from './power-user.js';
|
||||
import { chat_completion_sources, model_list, oai_settings } from './openai.js';
|
||||
@ -135,7 +136,7 @@ const TOKENIZER_URLS = {
|
||||
},
|
||||
};
|
||||
|
||||
const objectStore = new localforage.createInstance({ name: 'SillyTavern_ChatCompletions' });
|
||||
const objectStore = localforage.createInstance({ name: 'SillyTavern_ChatCompletions' });
|
||||
|
||||
let tokenCache = {};
|
||||
|
||||
|
Reference in New Issue
Block a user