Skip to content

修复:提高切换队伍时序与错误提示的可靠性 - #3395

Open
JerryChen97 wants to merge 3 commits into
babalae:mainfrom
JerryChen97:agent/stabilize-switch-party-timing
Open

修复:提高切换队伍时序与错误提示的可靠性#3395
JerryChen97 wants to merge 3 commits into
babalae:mainfrom
JerryChen97:agent/stabilize-switch-party-timing

Conversation

@JerryChen97

@JerryChen97 JerryChen97 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

问题背景

原脚本使用固定等待时间串联打开队伍页、OCR 查找、点击确定和部署。设备较慢或界面动画尚未结束时,脚本可能在错误状态截图,进而把“部署失败”误报成“没有找到指定队伍”。

根据 review 完成的重构

  • 移除脚本层的 OCR、模板匹配、固定 sleepoperationDelayMs 配置。
  • 改为调用 BetterGI 核心 genshin.switchParty。核心流程会识别当前界面状态、轮询下一状态并使用有限超时,不再依赖一个统一的固定延迟。
  • 保留原有传送策略:
    • 默认先传送七天神像,再切换队伍。
    • 开启“关闭前往七天神像”时,先在当前位置尝试;失败后传送神像重试一次。
  • 同时处理核心显式返回 false 和抛出异常两种失败形式;最终失败会返回主界面并继续向上抛出,避免调用方在错误队伍下继续执行。
  • 移除不再使用的 enableDebug 设置。
  • 脚本版本更新至 1.8;最低 BetterGI 版本更新至 0.45.1,该版本开始向 JavaScript 返回明确的换队布尔结果。

验证

已完成:

  • node --check repo/js/AcceleratedEditionSwitchParty/main.js
  • 使用 Node.js 解析 settings.jsonmanifest.json
  • git diff --check
  • 模拟验证以下路径:强制神像成功、当前位置失败后神像成功、核心异常后回退、最终失败向上抛出、缺少队伍配置

尚未完成游戏内完整实机验证,因此继续保留为 Draft PR。

@JerryChen97 JerryChen97 changed the title fix: improve switch party timing reliability 修复:提高切换队伍时序与错误提示的可靠性 Jul 16, 2026
@JerryChen97

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor
Action performed

Full review triggered.

@JerryChen97
JerryChen97 marked this pull request as ready for review July 16, 2026 23:41
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 02c23df7-643f-441e-b681-592812ee5c37

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

Changes

队伍切换流程增强

Layer / File(s) Summary
操作延迟配置与重试基础
repo/js/AcceleratedEditionSwitchParty/settings.json, repo/js/AcceleratedEditionSwitchParty/main.js, repo/js/AcceleratedEditionSwitchParty/manifest.json
新增 operationDelayMs 配置及取值校验,加入模板查找重试机制,并将版本更新至 1.7
队伍定位与确认部署交互
repo/js/AcceleratedEditionSwitchParty/main.js
翻页、配置入口、队伍定位、确认和部署流程统一使用动态等待;确认与部署按钮通过重试查找。
切换结果校验与错误处理
repo/js/AcceleratedEditionSwitchParty/main.js
直接切换和传送后重试路径均校验 SwitchParty 返回值,失败时抛出错误并进入统一异常处理。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SwitchParty
  participant GameUI
  participant findTemplateWithRetry
  participant Notification
  SwitchParty->>GameUI: 定位并点击目标队伍
  SwitchParty->>findTemplateWithRetry: 查找确认按钮
  findTemplateWithRetry->>GameUI: 捕获区域模板识别
  SwitchParty->>findTemplateWithRetry: 查找部署按钮
  findTemplateWithRetry->>GameUI: 捕获区域模板识别
  SwitchParty->>Notification: 部署成功后发送通知
Loading

Poem

我是小兔蹦蹦跳,
延迟配置调得妙。
模板失败再找找,
确认部署稳稳到。
队伍切换成功笑!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次 PR 的主要变更,包括提高切换队伍的时序稳定性和错误提示可靠性,表述简洁且明确。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MualaniMarine
MualaniMarine marked this pull request as draft July 17, 2026 22:35
@JerryChen97

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@repo/js/AcceleratedEditionSwitchParty/main.js`:
- Line 153: 将 AcceleratedEditionSwitchParty 中 notification 的 API 调用统一改为
PascalCase:把正常通知的 notification.send 替换为 notification.Send,把错误通知的
notification.error 替换为 notification.Error;检查该文件包含第 108、153、170、177
行在内的所有相关调用,确保消息内容和其余逻辑不变。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 25b36797-8548-42cc-b76a-94f433d0fdf7

📥 Commits

Reviewing files that changed from the base of the PR and between d30edda and 7d6e382.

📒 Files selected for processing (3)
  • repo/js/AcceleratedEditionSwitchParty/main.js
  • repo/js/AcceleratedEditionSwitchParty/manifest.json
  • repo/js/AcceleratedEditionSwitchParty/settings.json

Comment thread repo/js/AcceleratedEditionSwitchParty/main.js Outdated
@MualaniMarine

Copy link
Copy Markdown
Collaborator

如果要改造,不建议额外加延迟的方式,而是改成状态机,默认1500ms太长了

@JerryChen97
JerryChen97 force-pushed the agent/stabilize-switch-party-timing branch from 7d6e382 to 19bdb1c Compare September 2, 2026 04:08
@JerryChen97

Copy link
Copy Markdown
Contributor Author

@MualaniMarine 感谢建议,已按状态驱动的方向重构并更新分支:不再增加 operationDelayMs,也删除了脚本层的固定 sleep、OCR 和模板点击流程,改为复用 genshin.switchParty 的核心实现,由核心按界面状态轮询和超时。

原有行为仍保留:当前位置换队失败时会传送七天神像重试;最终失败会返回主界面并向上抛出。最低版本相应提升至 0.45.1,目前仍保留 Draft 等待实机验证。

@JerryChen97
JerryChen97 marked this pull request as ready for review September 2, 2026 12:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T12:38:18.107027Z 19bdb1c Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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