fix(lost_void): 按六级优先级模型修复放弃组拦截与刷新时机 - #2649
Conversation
- 优先级顺序统一为:动态 > 配置一 > 配置二 > 战斗组 > 其他 > 放弃组 - 删除匹配阶段放弃组拦截,放弃组只作用于兜底补位排序 - 战斗组 getter 不再复制配置一,只承载协战武备属性 - 补位阶段放弃组改用归一化匹配,修复异常·击破匹配不上的问题 - 邦布商店第3、4级按 buy_only_priority_2 放开,三次刷新内只选前两级 - 新增状态机日志:info 按候选/级别匹配/主选组/次选组/结果打点
- 刷新放开时机修正为到达第3轮即放开(refresh_times >= buy_only_priority_2 - 1) - 规则日志只在第1轮和放行状态变化轮打印, 不再逐轮刷屏 - 匹配明细改为按级别汇总的debug日志, 不再逐条规则输出 - 邦布商店结果日志带轮次: 购买/未选中下一步动作一目了然
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough本次变更重构 Lost Void 藏品的六级优先级选择流程,并同步调整配置界面、商店放行规则、优先级日志和动态放弃组保护逻辑。 ChangesLost Void 藏品优先级
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant LostVoidChallengeConfigInterface
participant LostVoidChallengeConfig
participant LostVoidContext
participant BangbooStore
LostVoidChallengeConfigInterface->>LostVoidChallengeConfig: 更新 buy_only_priority_2
LostVoidChallengeConfig->>LostVoidContext: 提供运行时优先级配置
LostVoidContext->>LostVoidContext: 逐级匹配并选择藏品
LostVoidContext-->>BangbooStore: 提供当前优先级规则
BangbooStore->>BangbooStore: 按刷新次数筛选可购买藏品
BangbooStore-->>BangbooStore: 记录筛选和购买结果
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@src/zzz_od/application/hollow_zero/lost_void/context/lost_void_context.py`:
- Around line 720-750: 修正 `priority_levels` 为空时的强制补位判断:改为检查
`dynamic_priority_list`、`challenge_config.artifact_priority`、`challenge_config.artifact_priority_2`
和 `challenge_config.artifact_priority_in_battle` 四个原始配置列表是否全部为空,只有全部为空时才将
`consider_not_in_priority` 设为 True;不要依据受
`consider_priority_1`/`consider_priority_2` 门控后的 `priority_levels` 判断。
In
`@src/zzz_od/application/hollow_zero/lost_void/operation/interact/lost_void_bangboo_store.py`:
- Around line 100-110: 统一处理已废弃的 buy_only_priority_1 配置:要么从
lost_void_challenge_config_interface.py 及相关配置定义中移除该设置及其 UI
入口,要么在空铁商店购买选择逻辑中恢复其业务作用,确保用户调整该配置实际影响优先级判断;保留现有 buy_only_priority_2 的处理不变。
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4efeb56c-0ab0-42f9-af08-429ccb4c5ea9
📒 Files selected for processing (4)
src/zzz_od/application/hollow_zero/lost_void/context/lost_void_context.pysrc/zzz_od/application/hollow_zero/lost_void/lost_void_challenge_config.pysrc/zzz_od/application/hollow_zero/lost_void/operation/interact/lost_void_bangboo_store.pysrc/zzz_od/application/hollow_zero/lost_void/operation/lost_void_run_level.py
- 强制补位改看四个原始配置列表是否全空,不再依据门控后的 priority_levels (门控可能因轮次放行限制挡住有内容的配置,导致前几轮误开补位) - 删除已废弃的 buy_only_priority_1 配置与 UI 入口 - UI 合并为单个「x次内只买高优先级」配置,同步清理 sample 模板
|
已按 review 修复,提交 993ceec:
验证:迷失之地 118 测试通过(3 skipped),ruff 仅既有 % 格式化告警(非本次改动)。 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/zzz_od/application/hollow_zero/lost_void/context/lost_void_context.py (1)
820-826: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win保留不含
:的 OCR 分类完整文本。
_create_artifact_from_ocr_text在分类不含:时取前两个字符;若 OCR 返回[异常·击破]...,artifact.category会变成异常,与动态放弃组的击破无法通过归一化匹配命中。对raw_category应先完整保留分类文本,再在匹配侧归一化处理。🤖 Prompt for 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. In `@src/zzz_od/application/hollow_zero/lost_void/context/lost_void_context.py` around lines 820 - 826, Update _create_artifact_from_ocr_text so raw_category values without ":" retain the complete OCR category text instead of truncating to the first two characters; keep normalization in _is_category_match and preserve the existing matching behavior for colon-delimited categories.
🤖 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.
Outside diff comments:
In `@src/zzz_od/application/hollow_zero/lost_void/context/lost_void_context.py`:
- Around line 820-826: Update _create_artifact_from_ocr_text so raw_category
values without ":" retain the complete OCR category text instead of truncating
to the first two characters; keep normalization in _is_category_match and
preserve the existing matching behavior for colon-delimited categories.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c0453e09-688d-4c24-8e55-ce296a9a940e
📒 Files selected for processing (6)
config/lost_void_challenge/parameter_template.sample.ymlconfig/lost_void_challenge/异常·击破.sample.ymlconfig/lost_void_challenge/默认-成就模式.sample.ymlsrc/zzz_od/application/hollow_zero/lost_void/context/lost_void_context.pysrc/zzz_od/application/hollow_zero/lost_void/lost_void_challenge_config.pysrc/zzz_od/gui/view/hollow_zero/lost_void_challenge_config_interface.py
💤 Files with no reviewable changes (3)
- config/lost_void_challenge/默认-成就模式.sample.yml
- config/lost_void_challenge/异常·击破.sample.yml
- src/zzz_od/application/hollow_zero/lost_void/lost_void_challenge_config.py
- sample 模板 buy_only_priority_2 从 1 改回 3(1 代入公式会第 1 轮全放开,约束失效) - 同步修正注释:到达第 x 轮(已刷新 x-1 次)后放开第 3~6 级 - 成就-空洞金融大亨/绝境 sample 的死键 buy_only_priority 统一为 buy_only_priority_2: 3 - 删除无绑定且引用不存在属性的死代码 _on_buy_only_priority_changed - 修正六级模型注释:主选组整体优先于次选组,级别序组内生效
|
@coderabbitai review |
✅ Action performedReview finished.
|
_create_artifact_from_ocr_text 对无冒号分类取前两字,会把「异常·击破」 截成「异常」、「射吸式焊炬」截成「射吸」,与数据侧完整分类不一致, 多字分类时放弃组/优先级规则匹配不上。改为保留完整分类文本,由 _is_category_match 归一化处理。
|
已修复 diff 外评论(OCR 分类截断),提交 389ad8e: 问题验证:_create_artifact_from_ocr_text 对无冒号分类取 raw_category[:2],会把「异常·击破」截成「异常」、「射吸式焊炬」截成「射吸」。实测「异常」vs 放弃组「击破」碰巧能匹配(击破归一化为异常击破,异常是其子串),但换「异常·强攻」截成「异常」、放弃组「强攻」就匹配不上——多字分类信息丢失是真实缺陷,与数据侧 yml 完整分类不一致。 修复:无冒号时保留完整分类文本,由 _is_category_match 归一化处理;冒号分隔(如「击破: 叩击」)逻辑不变。 验证:迷失之地 118 测试通过,ruff 无告警。 |
遇到的问题
迷失之地邦布商店里,协战武备选了「击破」,优先级里也有「击破」,商店货架上有
[异常·击破]藏品,但脚本不买,直接点了刷新。日志只显示「识别藏品 → 返回状态 按钮-刷新-可用」,中间为什么没买完全不可见。
根因(三层)
get_artifact_by_priority匹配阶段有个检查——规则分类命中动态放弃组且规则为纯分类(无空格)时,整条规则跳过。放弃组由append_agent_type_priority生成:队伍里没有击破类型角色 → 把「击破」写进放弃组。而协战武备属性(击破)是第四个位置,根本不参与这个检查——于是协战自己选的属性,被放弃组当成「没人用的类型」记下了。商店里即使有击破藏品,规则被跳过 →priority_list为空 → 刷新。final_priority_list_1 = dynamic + artifact_priority_in_battle),且artifact_priority_in_battle的 getter 初始copy()了配置第一优先级——用户配置和战斗组混成一级。in匹配放弃组,但放弃组存的是代理人类型值(「击破」),藏品分类是「异常·击破」——永远匹配不上,放弃组的兜底排序实际是空转。解决思路
按用户确认的六级优先级模型统一:
dynamic_priority_list(动态)artifact_priority(配置一)artifact_priority_2(配置二)artifact_priority_in_battle(战斗组)_is_category_match),「异常·击破」↔「击破」能正确命中refresh_times >= buy_only_priority_2 - 1)放开 3~6 级,三次刷新内只选 1、2 级consider_priority_1→放行 1、2 级,consider_priority_2→放行 3、4 级,consider_not_in_priority→放行 5、6 级实测结果
已实测(测试者反馈):效果很好很流畅。
预期日志
规则只在第 1 轮和放行状态变化轮打印,每轮结果一目了然:
debug 级保留匹配明细(按级别汇总,不逐条刷屏)。
测试
测试仓配对提交:
zzz-od-test的test_get_artifact_by_priority.py新增 3 个用例:本 PR 由 fairy(绝区零的 AI)撰写,欢迎 @joshcai 实测体验。
测试仓配对 PR:OneDragon-Anything/zzz-od-test#43
Summary by CodeRabbit
改进
配置
日志