19 Commits

Author SHA1 Message Date
z060142
7035aadaa6 update something 2025-05-17 04:16:36 +08:00
z060142
f9457bf992 Replace text deduplication with difflib-based similarity matching to reduce false negatives 2025-05-17 02:16:41 +08:00
z060142
2ac63718a9 Implement perceptual image hash deduplication for bubble processing
- Added `simple_bubble_dedup.py` module using perceptual hashing (pHash) to detect duplicate chat bubbles based on visual similarity.
- System keeps recent N (default 5) hashes and skips bubbles with Hamming distance below threshold (default 5).
- Integrated into `run_ui_monitoring_loop()`:
  - Hash is computed upon bubble snapshot capture.
  - Duplicate check occurs before message enqueue.
  - Sender info is optionally attached to matching hash entries after successful processing.
- Deduplication state is persisted in `simple_bubble_dedup.json`.
- F7 (`clear_history`) and F8 (`reset_state`) now also clear image-based hash history.
- Removed or commented out legacy `recent_texts` text-based deduplication logic.

This visual deduplication system reduces false negatives caused by slight text variations and ensures higher confidence in skipping repeated bubble interactions.
2025-05-16 02:02:31 +08:00
z060142
890772f70e Add message deduplication system and UI fallback handling for updated game states
- Implemented `MessageDeduplication` class to suppress duplicate bot replies:
  - Normalizes sender and message content for reliable comparison.
  - Tracks processed messages with timestamp-based expiry (default 1 hour).
  - Integrated into `run_ui_monitoring_loop()` with support for F7/F8-based history resets.
  - Periodic cleanup thread purges expired entries every 10 minutes.

- Added new UI fallback handling logic to address post-update game state changes:
  - Detects `chat_option.png` overlay before bubble detection and presses ESC to dismiss.
  - Detects `update_confirm.png` when chat room state is unavailable and clicks it to proceed.
  - Both behaviors improve UI stability following game version changes.

- Updated `essential_templates` dictionary and constants with the two new template paths:
  - `chat_option.png`
  - `update_confirm.png`

These improvements reduce redundant bot responses and enhance UI resilience against inconsistent or obstructed states in the latest game versions.
2025-05-15 02:16:24 +08:00
z060142
65df12a20e Fix encoding issues, enhance ChromaDB reader with ID query and embedding model selection 2025-05-09 11:29:56 +08:00
z060142
cfe935bb58 Improve reply-type detection and remove redundant logic 2025-05-01 22:45:33 +08:00
z060142
bb1753796b commit message:
Refactor keyword detection with dual-template matching and coordinate correction

- Overhauled `find_keyword_in_region` in `DetectionModule` to act as a wrapper for a new dual-method detection system.
- Introduced `find_keyword_dual_method`, now the default detection method (enabled via `use_dual_method=True`):
  - Performs template matching (`cv2.matchTemplate`) on both grayscale and CLAHE-enhanced versions of screenshots and templates.
  - Handles inverted images (`cv2.bitwise_not`) for robustness under dark/light themes.
  - Coordinates returned by matching are corrected from relative region space to absolute screen coordinates to match `pyautogui`.
  - Combines matching results using a tiered fallback system:
    1. Prefer overlapping results from both methods within a pixel threshold.
    2. Fallback to high-confidence single-method results.
- Maintains `_find_keyword_legacy` for backward compatibility using `pyautogui.locateAllOnScreen`.
- Simplified keyword template set to focus on three core types: `keyword_wolf_lower`, `keyword_Wolf_upper`, and `keyword_wolf_reply`.
- Integrated runtime performance tracking via counters and `print_detection_stats()` for debugging and optimization.
- Adds debug visualization at `DEBUG_LEVEL >= 3` to save processed images and detected points for analysis.
- Improves detection robustness across varying lighting, contrast, and UI themes while maintaining precise click alignment.

This upgrade significantly strengthens keyword recognition reliability and unifies coordinate handling across all detection phases.
2025-05-01 21:57:14 +08:00
z060142
da5f7f4358 Add island-based bubble detection method with color masks; refactor system prompt and streamline detection config
- Introduced a new bubble detection method based on color-based connected components ("island detection").
  - Operates in a predefined region (150, 330, 600, 880) using HSV color masks.
  - Mask settings and area thresholds per bubble type (user, bot, etc.) are configurable via `bubble_colors.json`.
  - Supports optional image downscaling for performance; thresholds scale accordingly.
  - Default setting remains off (`self.use_color_detection = False`), can be enabled manually in `DetectionModule`.

- Added keyword image matching for "wolf"/"Wolf" within detected bubbles.
- Improved precision in reply content extraction and sender identification by relocating based on snapshot offsets.

- Removed redundant portions of the system prompt to reduce token usage and improve response clarity.
- Modularized and simplified configuration for bubble type addition and detection tuning.
2025-05-01 02:58:41 +08:00
z060142
c357dfdae2 commit message:
Add ESC fallback actions, improve empty LLM reply handling, and provide ChromaDB backup scripts

- Implemented additional ESC key actions to help close unexpected homepage advertisements that previously could not be dismissed.
- Improved canned response handling when LLM returns empty or null replies, ensuring smoother conversational flow.
- Added optional utility scripts for backing up and restoring ChromaDB memory storage.
- These changes aim to enhance system robustness, reduce interruption from UI anomalies, and provide better data management options.
2025-04-30 01:53:10 +08:00
z060142
96f53ecdfc Fix Game monitor not restart game issue 2025-04-25 23:50:32 +08:00
z060142
6a96ab455a Feat Restrict screen recognition scope for different use cases 2025-04-21 23:14:27 +08:00
z060142
cca194160d Remove MCP server dependencies, Add LLM test script, Refactor Slightly adjust UI navigation speed 2025-04-21 19:00:49 +08:00
z060142
2510a64d22 Add Keyworld detection for Reply. Improve Multu-person chat is now handled better 2025-04-20 15:50:46 +08:00
z060142
3403c14e13 Improve LLM performance 2025-04-20 14:46:04 +08:00
z060142
e25e3177c2 Improve Element detection stability 2025-04-19 13:00:22 +08:00
z060142
3ec4017a1e Add Reply to specific conversation. Fix Conversation bubble detection 2025-04-19 01:37:57 +08:00
z060142
9f981a0621 Added the function of dismissing positions. Improved the stability of chat bubble detection. 2025-04-18 21:38:24 +08:00
z060142
6a4b56682c Modularize existing work logic 2025-04-18 13:17:48 +08:00
z060142
d5d7b87727 first commit 2025-04-17 01:28:22 +08:00