Update version to 1.71.3 and add file URL mapping

This commit is contained in:
kwaroran
2024-01-06 22:31:42 +09:00
parent e974b5ee7f
commit de17fe3afa
4 changed files with 11 additions and 8 deletions

View File

@@ -8,7 +8,7 @@
}, },
"package": { "package": {
"productName": "RisuAI", "productName": "RisuAI",
"version": "1.71.2" "version": "1.71.3"
}, },
"tauri": { "tauri": {
"allowlist": { "allowlist": {

View File

@@ -6,6 +6,7 @@ import { v4 } from 'uuid';
let tfCache:Cache = null let tfCache:Cache = null
let tfLoaded = false let tfLoaded = false
let tfMap:{[key:string]:string} = {}
async function initTransformers(){ async function initTransformers(){
if(tfLoaded){ if(tfLoaded){
return return
@@ -26,6 +27,10 @@ async function initTransformers(){
const newURL = 'https://sv.risuai.xyz/transformers/' + url.substring(11) const newURL = 'https://sv.risuai.xyz/transformers/' + url.substring(11)
await tfCache.add(newURL) await tfCache.add(newURL)
} }
if(Object.keys(tfMap).includes(url)){
const assetId = tfMap[url]
return new Response(await loadAsset(assetId))
}
} }
return await tfCache.match(url) return await tfCache.match(url)
} }
@@ -120,11 +125,9 @@ export const runVITS = async (text: string, modelData:string|OnnxModelFiles = 'X
const files = modelData.files const files = modelData.files
const keys = Object.keys(files) const keys = Object.keys(files)
for(const key of keys){ for(const key of keys){
const ast = new Response(await loadAsset(files[key])) const fileURL = '/tf/' + modelData.id + '/' + key
tfCache.put(key,ast.clone()) tfMap[fileURL] = files[key]
tfCache.put(location.origin + key, ast.clone()) tfMap[location.origin + fileURL] = files[key]
console.log('put', key)
console.log('put', location.origin + key)
} }
lastSynth = modelData.id lastSynth = modelData.id
synthesizer = await pipeline('text-to-speech', modelData.id); synthesizer = await pipeline('text-to-speech', modelData.id);

View File

@@ -15,7 +15,7 @@ import type { OobaChatCompletionRequestParams } from '../model/ooba';
export const DataBase = writable({} as any as Database) export const DataBase = writable({} as any as Database)
export const loadedStore = writable(false) export const loadedStore = writable(false)
export let appVer = "1.71.2" export let appVer = "1.71.3"
export let webAppSubVer = '' export let webAppSubVer = ''
export function setDatabase(data:Database){ export function setDatabase(data:Database){

View File

@@ -1 +1 @@
{"version":"1.71.2"} {"version":"1.71.3"}