mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-10 03:27:57 +00:00
refac
This commit is contained in:
parent
77db1656e1
commit
eee724c82f
2 changed files with 4 additions and 2 deletions
|
|
@ -96,7 +96,8 @@ def validate_voice_animation(data: bytes) -> None:
|
|||
ext = model.get('extensions', {}).get('VRMC_vrm_animation', {})
|
||||
bones = ext.get('humanoid', {}).get('humanBones', {})
|
||||
nodes = model.get('nodes', [])
|
||||
if ext.get('specVersion') != '1.0' or not bones or not 0 < len(nodes) <= 512:
|
||||
# Match the VRMA loader's compatibility fallback for unversioned exports.
|
||||
if ext.get('specVersion') not in (None, '1.0') or not bones or not 0 < len(nodes) <= 512:
|
||||
raise ValueError('Use a VRMA 1.0 humanoid animation.')
|
||||
for bone in bones.values():
|
||||
if type(bone.get('node')) is not int or not 0 <= bone['node'] < len(nodes):
|
||||
|
|
|
|||
|
|
@ -29,8 +29,9 @@ export function validateAnimation(data: ArrayBuffer) {
|
|||
const json = JSON.parse(new TextDecoder().decode(new Uint8Array(data, 20, length)));
|
||||
const ext = json.extensions?.VRMC_vrm_animation;
|
||||
const bones = Object.values(ext?.humanoid?.humanBones ?? {}) as { node: number }[];
|
||||
// Match the VRMA loader's compatibility fallback for unversioned exports.
|
||||
if (
|
||||
ext?.specVersion !== '1.0' ||
|
||||
(ext?.specVersion != null && ext.specVersion !== '1.0') ||
|
||||
!bones.length ||
|
||||
!json.nodes?.length ||
|
||||
json.nodes.length > 512 ||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue