Add grounding_consensus: self-consistency over grounding proposals#385
Merged
Conversation
A target can be grounded several ways at once (set-of-marks / OCR / template / a11y / N model samples) and they don't always agree. ab_locator/element_scoring rank strategies by history; snap_to_element snaps a single coordinate - neither fuses simultaneous proposals. Cluster candidate points (or vote candidate elements), return the agreed point + agreement fraction + spread, and flag low-agreement targets so the agent zooms/asks instead of clicking blind.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 38 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



摘要
新增
consensus_point/consensus_element/is_confident— 對單一目標的多個 grounding 提案做自我一致性融合。一個目標可同時以多種方式 grounding(set-of-marks / OCR / 樣板 / a11y / 模型 N 次抽樣)而未必一致。ab_locator/element_scoring依歷史排序策略;action_grounding.snap_to_element只貼單一座標——兩者都不融合同時的提案並給離散度。本功能將候選點聚類(或對候選元素投票),回傳一致同意的目標 +
agreement比例 +spread,並以is_confident標記低一致度目標,讓呼叫端改為放大 / 詢問人工而非盲目點擊。純標準函式庫幾何;確定性、可無裝置測試。Qt-free。五層
utils/grounding_consensus/—ConsensusResult、consensus_point、consensus_element、is_confident。AC_consensus_point+AC_consensus_element/ MCPac_consensus_point+ac_consensus_element/ Script Builder(Native UI)。測試
test_grounding_consensus_batch.py— 多數群勝出 + n_clusters、權重影響、is_confident 門檻、consensus_element 投票最近、空輸入、wiring + facade。7 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨(consensus_element 重構為具名 helper 避免迴圈內 lambda)。