Conversation
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Pull request overview
This PR improves ship selection reliability by strengthening OCR-based level parsing and by normalizing ship-name matching so level filtering aligns with name hits, adding bounded retries when OCR noise is too high.
Changes:
- Add stricter level parsing with OCR-noise detection, plus a retry signal/error path when noise exceeds a threshold.
- Update choose-ship flow to normalize names before matching and to retry when level OCR requests a re-screenshot.
- Bump package version to
2.1.9.post6.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| autowsgr/ui/utils/ship_list.py | Expands level regex/coercion, adds noisy-OCR retry exception, and pairs level hits with name hits using bbox x-coordinates plus a local probing fallback. |
| autowsgr/ui/choose_ship_page.py | Normalizes ship-name matching (remove “·改” and trailing parenthetical alias) and handles bounded retries on noisy level OCR. |
| autowsgr/init.py | Version bump for release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| { | ||
| 'I': '1', | ||
| 'i': '1', | ||
| 'l': '1', |
There was a problem hiding this comment.
_LEVEL_PATTERN/_LEVEL_NOISY_PATTERN allow uppercase L in the captured level digits ([0-9ILilOo]), but _coerce_level_digits() does not translate 'L' -> '1'. If OCR returns something like Lv.L8, the L will be dropped by the isdigit() filter and the parsed level can become incorrect. Add 'L': '1' to the translation table (or remove L from the capture set if it should never be treated as a digit).
| 'l': '1', | |
| 'l': '1', | |
| 'L': '1', |
| collect_levels(binary_rgb) | ||
|
|
||
| if not parsed_levels and noisy_level_hits > _MAX_NOISY_LEVEL_HITS_BEFORE_RETRY: | ||
| raise LevelOCRRetryNeededError( | ||
| f'等级 OCR 噪声过高: {noisy_level_hits} 条异常等级文本 (阈值 {_MAX_NOISY_LEVEL_HITS_BEFORE_RETRY})', | ||
| ) |
There was a problem hiding this comment.
The retry signal is currently only raised when no levels were parsed (if not parsed_levels and noisy_level_hits > ...). This conflicts with the PR’s stated fallback policy (“If noisy level-like hits exceed threshold, raise retry signal”), and can allow returning a level even when the OCR output is clearly too noisy. Consider triggering LevelOCRRetryNeededError whenever noisy_level_hits exceeds the threshold (regardless of parsed_levels), or document why noisy hits are ignored when a level is also parsed.
Summary
Fallback policy
What changed
Files
Notes