Refactor URL handling in initTransformers function
This commit is contained in:
@@ -25,7 +25,13 @@ async function initTransformers(){
|
|||||||
if(typeof url === 'string'){
|
if(typeof url === 'string'){
|
||||||
if(url.startsWith('/tf/Xenova/')){
|
if(url.startsWith('/tf/Xenova/')){
|
||||||
const newURL = 'https://sv.risuai.xyz/transformers/' + url.substring(11)
|
const newURL = 'https://sv.risuai.xyz/transformers/' + url.substring(11)
|
||||||
await tfCache.add(newURL)
|
const v = await tfCache.match(newURL)
|
||||||
|
if(v){
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
const response = await fetch(newURL)
|
||||||
|
await tfCache.put(newURL, response.clone())
|
||||||
|
return response
|
||||||
}
|
}
|
||||||
if(Object.keys(tfMap).includes(url)){
|
if(Object.keys(tfMap).includes(url)){
|
||||||
const assetId = tfMap[url]
|
const assetId = tfMap[url]
|
||||||
|
|||||||
Reference in New Issue
Block a user