This commit is contained in:
josc146 2023-12-22 10:49:28 +08:00
parent 4db735e026
commit 5525fb1470
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ document.querySelectorAll('.grid.h-10.grid-cols-12.place-content-center.gap-x-3.
if (!data.name.endsWith('.bin') && !data.name.endsWith('.pth')) if (!data.name.endsWith('.bin') && !data.name.endsWith('.pth'))
return return
data.desc = {en: '', zh: ''} data.desc = { en: '', zh: '', ja: '' }
const rawText = await (await fetch(e.children[1].href.replace('/resolve/', '/raw/'))).text() const rawText = await (await fetch(e.children[1].href.replace('/resolve/', '/raw/'))).text()
data.size = parseInt(extractValue(rawText, 'size')) data.size = parseInt(extractValue(rawText, 'size'))
@ -27,6 +27,7 @@ document.querySelectorAll('.grid.h-10.grid-cols-12.place-content-center.gap-x-3.
data.lastUpdated = e.children[3].children[0].getAttribute('datetime') data.lastUpdated = e.children[3].children[0].getAttribute('datetime')
data.url = e.children[1].href.replace('/resolve/', '/blob/') data.url = e.children[1].href.replace('/resolve/', '/blob/')
data.downloadUrl = e.children[1].href data.downloadUrl = e.children[1].href
data.tags = []
modelsJson.push(data) modelsJson.push(data)
}) })

View File

@ -90,7 +90,7 @@ export async function refreshLocalModels(cache: {
for (let i = 0; i < cache.models.length; i++) { for (let i = 0; i < cache.models.length; i++) {
if (!cache.models[i].lastUpdatedMs) if (!cache.models[i].lastUpdatedMs)
cache.models[i].lastUpdatedMs = Date.parse(cache.models[i].lastUpdated); cache.models[i].lastUpdatedMs = Date.parse(cache.models[i].lastUpdated);
if (!cache.models[i].tags) if (!cache.models[i].tags || !Array.isArray(cache.models[i].tags) || cache.models[i].tags?.length === 0)
cache.models[i].tags = ['Other']; cache.models[i].tags = ['Other'];
for (let j = i + 1; j < cache.models.length; j++) { for (let j = i + 1; j < cache.models.length; j++) {