fix: 修复 JSON 格式错误导致模型不可用的问题 (#790)

This commit is contained in:
ayangweb
2026-01-10 17:51:44 +08:00
committed by GitHub
parent d69669bd3a
commit ef17ba9ebc
3 changed files with 13 additions and 1 deletions

View File

@@ -39,6 +39,7 @@
"dayjs": "^1.11.13",
"es-toolkit": "^1.38.0",
"is-url": "^1.2.4",
"json5": "^2.2.3",
"nanoid": "^5.1.5",
"pinia": "^3.0.3",
"pixi-live2d-display": "^0.4.0",

10
pnpm-lock.yaml generated
View File

@@ -62,6 +62,9 @@ importers:
is-url:
specifier: ^1.2.4
version: 1.2.4
json5:
specifier: ^2.2.3
version: 2.2.3
nanoid:
specifier: ^5.1.5
version: 5.1.5
@@ -3227,6 +3230,11 @@ packages:
json-stable-stringify-without-jsonify@1.0.1:
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
json5@2.2.3:
resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==}
engines: {node: '>=6'}
hasBin: true
jsonc-eslint-parser@2.4.0:
resolution: {integrity: sha512-WYDyuc/uFcGp6YtM2H0uKmUwieOuzeE/5YocFJLnLfclZ4inf3mRn8ZVy1s7Hxji7Jxm6Ss8gqpexD/GlKoGgg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
@@ -8031,6 +8039,8 @@ snapshots:
json-stable-stringify-without-jsonify@1.0.1: {}
json5@2.2.3: {}
jsonc-eslint-parser@2.4.0:
dependencies:
acorn: 8.14.1

View File

@@ -3,6 +3,7 @@ import type { Cubism4InternalModel } from 'pixi-live2d-display'
import { convertFileSrc } from '@tauri-apps/api/core'
import { readDir, readTextFile } from '@tauri-apps/plugin-fs'
import JSON5 from 'json5'
import { Cubism4ModelSettings, Live2DModel } from 'pixi-live2d-display'
import { Application, Ticker } from 'pixi.js'
@@ -46,7 +47,7 @@ class Live2d {
const modelPath = join(path, modelFile.name)
const modelJSON = JSON.parse(await readTextFile(modelPath))
const modelJSON = JSON5.parse(await readTextFile(modelPath))
const modelSettings = new Cubism4ModelSettings({
...modelJSON,