Skip to content

Conversation

@HardyNLee
Copy link
Contributor

@HardyNLee HardyNLee commented Jan 20, 2026

介绍

完善 callSteam 命令支持。

Note

建议先更新 webgal-parser

主要更改

  • 文本编辑器
    • 新增 callSteam 高亮
    • 新增 callSteam 补全
    • 新增 achievementId 参数补全
  • 图形编辑器
    • 不再为 callSteam 特殊处理,统一使用 commandType.callSteam
    • callSteam 组件会寻找支持的参数作为参数 Key

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @HardyNLee, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

此拉取请求全面增强了对 callSteam 命令的支持,覆盖了文本编辑器和图形编辑器。通过引入新的高亮规则、命令及参数自动补全功能,显著提升了文本编辑器的开发体验。同时,图形编辑器也进行了优化,统一了 callSteam 命令的处理逻辑,使其组件能够更智能地识别和应用相关参数,从而简化了工作流程并提高了命令的集成度。

Highlights

  • 文本编辑器: 现在支持 callSteam 命令的高亮显示。
  • 文本编辑器: 新增了 callSteam 命令的自动补全功能。
  • 文本编辑器: 为 callSteam 命令新增了 achievementId 参数的补全提示。
  • 图形编辑器: 对 callSteam 命令的处理进行了统一,不再进行特殊处理,而是使用通用的 commandType.callSteam
  • 图形编辑器: 中的 CallSteam 组件现在能够动态识别并使用支持的参数作为参数键。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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

本次 PR 旨在完善 callSteam 命令的支持,整体实现得不错。主要改动包括在文本编辑器中增加了对 callSteam 的高亮和自动补全,并在图形编辑器中进行了重构,使其不再特殊处理 callSteam 命令。

我在代码中发现了一些可以改进的地方:

  1. hl.json 文件中,命令列表存在多处重复,这会影响未来的可维护性。
  2. CallSteam.tsx 组件中,submit 函数的逻辑存在一个 bug,当用户更改参数键时,可能会导致生成不正确的脚本。

具体的修改建议请见我的评论。修复这些问题后,代码会更加健壮和易于维护。

Comment on lines 27 to 36
const submitString = combineSubmitString(
props.sentence.commandRaw || CALL_STEAM_COMMAND,
props.sentence.commandRaw,
"",
props.sentence.args.filter((arg) => arg.key !== "speaker"),
normalizedKey ? [{ key: normalizedKey, value: paramValue.value, fullMode: true }] : [],
props.sentence.args,
[
...(normalizedKey ? [
{ key: normalizedKey, value: paramValue.value, fullMode: true }
] : []),
],
);
Copy link
Contributor

Choose a reason for hiding this comment

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

high

submit 函数的逻辑存在缺陷。当用户在UI中更改参数的键时,旧的参数不会从句子中移除。combineSubmitString 会保留新旧两个参数,导致生成错误的脚本。

为了修复这个问题,在调用 combineSubmitString 之前,应该从 originalArgs 中过滤掉所有此组件能管理的参数,然后只在 newArgs 中添加当前选中的参数。

    const submitString = combineSubmitString(
      props.sentence.commandRaw,
      "",
      props.sentence.args.filter(arg => !paramOptions.has(arg.key)),
      normalizedKey ? [{ key: normalizedKey, value: paramValue.value, fullMode: true }] : [],
    );

"character-colon": {
"comment": "[char]:[utt[ -args]][;cmt]",
"match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
"match": "^(?!(?:say|changeBg|changeFigure|bgm|playVideo|pixiPerform|pixiInit|intro|miniAvatar|changeScene|choose|end|setComplexAnimation|label|jumpLabel|setVar|callScene|showVars|unlockCg|unlockBgm|filmMode|setTextbox|setAnimation|playEffect|setTempAnimation|setTransform|setTransition|getUserInput|applyStyle|wait|callSteam)\\:)(.*?)(\\:)([^\\;\\n]*?)($|\\;.*?$)",
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

这个文件中的命令列表 (say|changeBg|...) 在多个地方重复出现(例如第139、174、209、230行)。这使得未来添加或删除命令时难以维护,容易出错。

建议考虑重构以消除重复。虽然 tmlanguage.json 格式本身不支持在正则表达式字符串中使用变量,但可以考虑使用脚本来生成此JSON文件,该脚本可以从单一的命令列表中构建正则表达式。

这将大大提高可维护性。

@MakinoharaShoko MakinoharaShoko merged commit 1d77205 into OpenWebGAL:dev Jan 25, 2026
6 checks passed
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.

2 participants