fix FindJade&SwitchAccount - #1706
Conversation
Automated PR 2026.07.23
20260725 缩小体力和活动体力的检测范围,范围太大,可能把0识别为10的情况. # 潜在风险1,超过1000的数字可能会只识别到最后的000,还有识别0的时候,score比较低,只有0.3,不知道怎么优化。 # 潜在风险2,部分数字,遇到过300等,会识别为0,之前没截上图,待后面遇到再处理这种情况。
There was a problem hiding this comment.
Hey - 我发现了两个问题,并提供了一些整体性的反馈:
- 新增的 OCR 规则
O_SA_CHECK_SELCET_SVR在名字中似乎有拼写错误(SELCETvsSELECT),这会降低后续使用和搜索的便利性;建议统一更名。 - 对于新添加或更新的 OCR 规则(例如
O_SA_SELECT_SVR_CHARACTER_LIST,O_SA_CHECK_SELCET_SVR),mode字段现在使用了不同的大小写形式(Full,Single),而现有用法是大写(FULL,SINGLE);请根据 OCR 引擎的实际期望值统一大小写,以避免潜在的运行时问题。 - 将
Config('oas1')改为Config('翻小号')会把一个与环境或用户绑定的配置名硬编码进FindJade,这在其他环境中可能并不合适;建议通过配置方式注入,而不是在代码中写死具体的配置名。
面向 AI Agent 的提示词
Please address the comments from this code review:
## Overall Comments
- 新增的 OCR 规则 `O_SA_CHECK_SELCET_SVR` 在名字中似乎有拼写错误(`SELCET` vs `SELECT`),这会降低后续使用和搜索的便利性;建议统一更名。
- 对于新添加或更新的 OCR 规则(例如 `O_SA_SELECT_SVR_CHARACTER_LIST`, `O_SA_CHECK_SELCET_SVR`),`mode` 字段现在使用了不同的大小写形式(`Full`, `Single`),而现有用法是大写(`FULL`, `SINGLE`);请根据 OCR 引擎的实际期望值统一大小写,以避免潜在的运行时问题。
- 将 `Config('oas1')` 改为 `Config('翻小号')` 会把一个与环境或用户绑定的配置名硬编码进 `FindJade`,这在其他环境中可能并不合适;建议通过配置方式注入,而不是在代码中写死具体的配置名。
## Individual Comments
### Comment 1
<location path="tasks/Component/SwitchAccount/assets.py" line_range="52" />
<code_context>
# 登录界面 用户中心(区别于游戏内用户中心) 账户名
O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
+ # 判断是否在 选择服务器 界面的文本特质
+ O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr")
</code_context>
<issue_to_address>
**suggestion (typo):** 常量名和内部 name 中的拼写错误(`SELCET`/`selcet`)会影响可读性和可搜索性。
`O_SA_CHECK_SELCET_SVR` 和 `name="sa_check_selcet_svr"` 都使用了 `SELCET/selcet` 而不是 `SELECT/select`。请重命名以保证一致性并便于搜索(例如改为 `O_SA_CHECK_SELECT_SVR`, `sa_check_select_svr`)。
Suggested implementation:
```python
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
```
1. 在代码库中搜索 `O_SA_CHECK_SELCET_SVR`,将所有用法更新为 `O_SA_CHECK_SELECT_SVR`。
2. 搜索字符串 `"sa_check_selcet_svr"`,更新所有引用(例如日志、配置、测试)为 `"sa_check_select_svr"`。
</issue_to_address>
### Comment 2
<location path="tasks/Component/SwitchAccount/assets.py" line_range="44-52" />
<code_context>
O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
</code_context>
<issue_to_address>
**issue (bug_risk):** `mode` 大小写不一致(`Full`/`Single` vs `FULL`/`SINGLE`)可能在 API 区分大小写时破坏分发逻辑。
其他规则使用的是大写 `mode` 值(例如 "FULL", "SINGLE"),但这一条使用的是 "Full"。如果 `RuleOcr` 或下游代码对 `mode` 的比较是区分大小写的,那么它可能无法匹配预期的模式。除非 `RuleOcr` 在内部做了大小写归一化,否则请将大小写与现有规则保持一致。
</issue_to_address>帮我变得更有用!请对每一条评论点选 👍 或 👎,我会根据你的反馈改进后续的代码审查。
Original comment in English
Hey - I've found 2 issues, and left some high level feedback:
- The new OCR rule
O_SA_CHECK_SELCET_SVRappears to have a typo in its name (SELCETvsSELECT), which could make future usage and searches harder; consider renaming it consistently. - For the new/updated OCR rules (e.g.,
O_SA_SELECT_SVR_CHARACTER_LIST,O_SA_CHECK_SELCET_SVR), themodevalues now use different casing (Full,Single) compared to existing usages (FULL,SINGLE); please align the casing with whatever the OCR engine actually expects to avoid subtle runtime issues. - The change from
Config('oas1')toConfig('翻小号')hardcodes an environment-specific or user-specific config name intoFindJade, which may not be appropriate for other environments; consider making this configurable rather than embedding a specific profile.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new OCR rule `O_SA_CHECK_SELCET_SVR` appears to have a typo in its name (`SELCET` vs `SELECT`), which could make future usage and searches harder; consider renaming it consistently.
- For the new/updated OCR rules (e.g., `O_SA_SELECT_SVR_CHARACTER_LIST`, `O_SA_CHECK_SELCET_SVR`), the `mode` values now use different casing (`Full`, `Single`) compared to existing usages (`FULL`, `SINGLE`); please align the casing with whatever the OCR engine actually expects to avoid subtle runtime issues.
- The change from `Config('oas1')` to `Config('翻小号')` hardcodes an environment-specific or user-specific config name into `FindJade`, which may not be appropriate for other environments; consider making this configurable rather than embedding a specific profile.
## Individual Comments
### Comment 1
<location path="tasks/Component/SwitchAccount/assets.py" line_range="52" />
<code_context>
# 登录界面 用户中心(区别于游戏内用户中心) 账户名
O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account")
+ # 判断是否在 选择服务器 界面的文本特质
+ O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr")
</code_context>
<issue_to_address>
**suggestion (typo):** Typo in constant and name (`SELCET`/`selcet`) may hurt readability and searchability.
Both `O_SA_CHECK_SELCET_SVR` and `name="sa_check_selcet_svr"` use `SELCET/selcet` instead of `SELECT/select`. Please rename them for consistency and easier searching (e.g. `O_SA_CHECK_SELECT_SVR`, `sa_check_select_svr`).
Suggested implementation:
```python
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")
```
1. Search the codebase for `O_SA_CHECK_SELCET_SVR` and update all usages to `O_SA_CHECK_SELECT_SVR`.
2. Search for the string `"sa_check_selcet_svr"` and update any references (e.g., logs, configs, tests) to `"sa_check_select_svr"`.
</issue_to_address>
### Comment 2
<location path="tasks/Component/SwitchAccount/assets.py" line_range="44-52" />
<code_context>
O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list")
</code_context>
<issue_to_address>
**issue (bug_risk):** Inconsistent `mode` casing (`Full`/`Single` vs `FULL`/`SINGLE`) could break dispatch logic if the API is case-sensitive.
Other rules use uppercase `mode` values (e.g. "FULL", "SINGLE"), but this one uses "Full". If `RuleOcr` or downstream code compares `mode` case-sensitively, this may not match the expected mode. Please align the casing with existing rules unless `RuleOcr` normalizes it internally.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| # 登录界面 用户中心(区别于游戏内用户中心) 账户名 | ||
| O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account") | ||
| # 判断是否在 选择服务器 界面的文本特质 | ||
| O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr") |
There was a problem hiding this comment.
suggestion (typo): 常量名和内部 name 中的拼写错误(SELCET/selcet)会影响可读性和可搜索性。
O_SA_CHECK_SELCET_SVR 和 name="sa_check_selcet_svr" 都使用了 SELCET/selcet 而不是 SELECT/select。请重命名以保证一致性并便于搜索(例如改为 O_SA_CHECK_SELECT_SVR, sa_check_select_svr)。
Suggested implementation:
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")- 在代码库中搜索
O_SA_CHECK_SELCET_SVR,将所有用法更新为O_SA_CHECK_SELECT_SVR。 - 搜索字符串
"sa_check_selcet_svr",更新所有引用(例如日志、配置、测试)为"sa_check_select_svr"。
Original comment in English
suggestion (typo): Typo in constant and name (SELCET/selcet) may hurt readability and searchability.
Both O_SA_CHECK_SELCET_SVR and name="sa_check_selcet_svr" use SELCET/selcet instead of SELECT/select. Please rename them for consistency and easier searching (e.g. O_SA_CHECK_SELECT_SVR, sa_check_select_svr).
Suggested implementation:
# 判断是否在 选择服务器 界面的文本特质
O_SA_CHECK_SELECT_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_select_svr")- Search the codebase for
O_SA_CHECK_SELCET_SVRand update all usages toO_SA_CHECK_SELECT_SVR. - Search for the string
"sa_check_selcet_svr"and update any references (e.g., logs, configs, tests) to"sa_check_select_svr".
| O_SA_SELECT_SVR_CHARACTER_LIST = RuleOcr(roi=(418,131,641,481), area=(417,135,647,482), mode="Full", method="Default", keyword="", name="sa_select_svr_character_list") | ||
| # 选择账号界面 账号列表 | ||
| O_SA_ACCOUNT_ACCOUNT_LIST = RuleOcr(roi=(460,280,440,330), area=(460,280,440,330), mode="FULL", method="Default", keyword="", name="sa_account_account_list") | ||
| # 选择账号界面 已选择的账号 | ||
| O_SA_ACCOUNT_ACCOUNT_SELECTED = RuleOcr(roi=(460,280,370,50), area=(460,280,370,50), mode="SINGLE", method="Default", keyword="", name="sa_account_account_selected") | ||
| # 登录界面 用户中心(区别于游戏内用户中心) 账户名 | ||
| O_SA_LOGIN_FORM_USER_CENTER_ACCOUNT = RuleOcr(roi=(290,185,290,50), area=(290,185,290,50), mode="SINGLE", method="Default", keyword="", name="sa_login_form_user_center_account") | ||
| # 判断是否在 选择服务器 界面的文本特质 | ||
| O_SA_CHECK_SELCET_SVR = RuleOcr(roi=(252,145,97,32), area=(248,141,102,38), mode="Single", method="Default", keyword="已有角色", name="sa_check_selcet_svr") |
There was a problem hiding this comment.
issue (bug_risk): mode 大小写不一致(Full/Single vs FULL/SINGLE)可能在 API 区分大小写时破坏分发逻辑。
其他规则使用的是大写 mode 值(例如 "FULL", "SINGLE"),但这一条使用的是 "Full"。如果 RuleOcr 或下游代码对 mode 的比较是区分大小写的,那么它可能无法匹配预期的模式。除非 RuleOcr 在内部做了大小写归一化,否则请将大小写与现有规则保持一致。
Original comment in English
issue (bug_risk): Inconsistent mode casing (Full/Single vs FULL/SINGLE) could break dispatch logic if the API is case-sensitive.
Other rules use uppercase mode values (e.g. "FULL", "SINGLE"), but this one uses "Full". If RuleOcr or downstream code compares mode case-sensitively, this may not match the expected mode. Please align the casing with existing rules unless RuleOcr normalizes it internally.
修复切换账号逻辑
直接测试是可以正常切换小号寻找勾协的
Summary by Sourcery
调整账号切换、OCR 处理以及 FindJade 配置,以更可靠地完成小号切换和活动交互。
Bug 修复:
增强功能:
Original summary in English
Summary by Sourcery
Adjust account switching, OCR handling, and FindJade configuration for more reliable small-account switching and activity interactions.
Bug Fixes:
Enhancements: