Skip to content

fix: Fix parser vocal named-argument asset resolution#946

Open
A-kirami wants to merge 2 commits into
OpenWebGAL:devfrom
A-kirami:fix/parser-vocal-asset-path
Open

fix: Fix parser vocal named-argument asset resolution#946
A-kirami wants to merge 2 commits into
OpenWebGAL:devfrom
A-kirami:fix/parser-vocal-asset-path

Conversation

@A-kirami
Copy link
Copy Markdown
Contributor

@A-kirami A-kirami commented May 6, 2026

背景

当前 parser 对语音参数有两种写法:

  • 简写:-a.mp3
  • 标准写法:-vocal=a.mp3

其中简写会经过 assetSetter,但标准写法此前会被当作普通字符串参数处理,导致没有补全资源路径,最终无法正确解析语音资源。

变更

  • vocal 命名参数新增独立解析分支
  • -vocal=... 与简写语法统一走 assetSetter
  • 补充 parser 回归测试,覆盖 say:123 -speaker=xx -vocal=a.mp3;

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the argsParser to explicitly handle the vocal argument by applying an assetSetter and flattens the conditional logic for better readability. A corresponding test case was added to verify this behavior. Feedback was provided to perform a case-insensitive check for the vocal argument name to ensure consistency and improve robustness.

I am having trouble creating individual review comments. Click here to see my feedback.

packages/parser/src/scriptParser/argsParser.ts (38-43)

medium

建议对 vocal 参数名进行不区分大小写的检查,并将结果的 key 统一设置为小写的 'vocal'。这样可以确保即使脚本中使用了不同大小写的参数名(如 -VOCAL=...),解析结果也能保持一致,并正确触发后续的语音逻辑。这也能与第33行简写形式的处理逻辑保持一致。

    } else if (argName.toLowerCase() === 'vocal' && argValue !== undefined) {
      returnArrayList.push({
        key: 'vocal',
        value: assetSetter(argValue, fileType.vocal),
      });
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant