feat: support custom reco & act for vscode & maa-tools#1599
Merged
Conversation
Contributor
Author
|
@Windsland52 要给m9a来个不( |
Contributor
There was a problem hiding this comment.
Hey - 我在这里给出了一些高层次的反馈:
tools/parser.ts中的自定义解析逻辑对多个“魔法字符串”键进行了硬编码(例如'RecognitionNodeName'、'SubTask'、'ClearHitCount'、'QuantizedSliding')。建议将它们提取为命名清晰的常量或配置映射(config map),以便让未来的更新更安全,并降低拼写错误带来的风险。customActParser在多个分支中重复使用相同的模式:utils.parseObject+utils.parseArray+utils.isString。你可以将这部分逻辑抽取成一个小的辅助函数,来避免重复代码,同时让每个分支的意图更清晰。- 目前
customActParser中基于name的分支逻辑是一连串的 if/else 块;可以考虑改成一个分发表(dispatch table)或switch语句,这样在增加新的动作类型时,更容易扩展而不会继续让该函数膨胀。
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The custom parser logic in tools/parser.ts hardcodes multiple magic string keys (e.g., 'RecognitionNodeName', 'SubTask', 'ClearHitCount', 'QuantizedSliding'); consider extracting these into well-named constants or a config map to make future updates safer and reduce the chance of typos.
- customActParser repeats the same pattern of `utils.parseObject` + `utils.parseArray` + `utils.isString` in several branches; you could factor this into a small helper to avoid duplication and make the intent of each case clearer.
- The branching in customActParser based on `name` is currently a chain of if/else blocks; switching to a dispatch table or switch statement could make it easier to extend with new action types without growing the function further.帮我变得更有用!请在每条评论上点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English
Hey - I've left some high level feedback:
- The custom parser logic in tools/parser.ts hardcodes multiple magic string keys (e.g., 'RecognitionNodeName', 'SubTask', 'ClearHitCount', 'QuantizedSliding'); consider extracting these into well-named constants or a config map to make future updates safer and reduce the chance of typos.
- customActParser repeats the same pattern of
utils.parseObject+utils.parseArray+utils.isStringin several branches; you could factor this into a small helper to avoid duplication and make the intent of each case clearer. - The branching in customActParser based on
nameis currently a chain of if/else blocks; switching to a dispatch table or switch statement could make it easier to extend with new action types without growing the function further.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The custom parser logic in tools/parser.ts hardcodes multiple magic string keys (e.g., 'RecognitionNodeName', 'SubTask', 'ClearHitCount', 'QuantizedSliding'); consider extracting these into well-named constants or a config map to make future updates safer and reduce the chance of typos.
- customActParser repeats the same pattern of `utils.parseObject` + `utils.parseArray` + `utils.isString` in several branches; you could factor this into a small helper to avoid duplication and make the intent of each case clearer.
- The branching in customActParser based on `name` is currently a chain of if/else blocks; switching to a dispatch table or switch statement could make it easier to extend with new action types without growing the function further.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Contributor
|
我好早之前就想要这个了,但想到插件是通用的就没说( 也许还可以在custom_action_param约定一个参数(比如 nodes)表示这个参数的字段需要填节点,同理一些其他的也能这么处理? |
Contributor
感觉可以,我们项目内配置好然后统一就行。 |
Contributor
Author
|
反正现在走项目配置了就无所谓了呗( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
识别custom里面的task引用
暂时不支持anchor
@he0119 来帮补下(
Summary by Sourcery
添加自定义解析器配置,以支持在 maatools 中解析自定义识别与动作任务引用,并更新格式化和工具配置。
新功能:
增强:
构建:
Original summary in English
Summary by Sourcery
Add custom parser configuration to support resolving custom recognition and action task references in maatools, and update formatting and tooling configuration.
New Features:
Enhancements:
Build:
新功能:
maatools.config中为特定识别函数配置自定义识别任务引用解析。maatools.config中为子任务配置自定义行动任务引用解析。改进:
构建:
@nekosu/maa-tools升级到 1.0.20 版本。Original summary in English
Summary by Sourcery
添加自定义解析器配置,以支持在 maatools 中解析自定义识别与动作任务引用,并更新格式化和工具配置。
新功能:
增强:
构建:
Original summary in English
Summary by Sourcery
Add custom parser configuration to support resolving custom recognition and action task references in maatools, and update formatting and tooling configuration.
New Features:
Enhancements:
Build: