Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,8 @@ private fun readableSuggestionBlockReason(value: String): String = when (value)
"HIGHER_PRIORITY_OFFER_ACTIVE" -> "已有更高优先级的建议正在处理"
"WAITING_FOR_MODEL_RANKING" -> "多个合法候选正在等待模型排序"
"NO_ORGANICALLY_ELIGIBLE_ACTION" -> "没有具备自然使用历史的安全候选"
"BELOW_CONFIDENCE_THRESHOLD" -> "候选概率未达到 30%"
"BELOW_CONFIDENCE_THRESHOLD" ->
"候选概率未达到 ${(SuggestionPolicy.ORDINARY_NEXT_ACTION_MIN_CONFIDENCE * 100).roundToInt()}%"
"INSUFFICIENT_PROBABILITY_MARGIN" -> "候选领先优势不足 8 个百分点"
"NON_SUGGESTIBLE_OUTPUT_DOMINATES" -> "模型更倾向于不展示或不可推荐动作"
"CENSORED_UNTRACKED_OR_DEBUG_ROUTE" -> "进入调试或未跟踪页面,当前建议已取消"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ internal object SuggestionPolicy {
const val TARGETED_CHANGE_DEBOUNCE_MS = 250L
const val TARGETED_MIN_INTERVAL_MS = 10_000L
const val ORDINARY_MIN_INTERVAL_MS = 30_000L
const val ORDINARY_NEXT_ACTION_MIN_CONFIDENCE = 0.30f
const val ORDINARY_NEXT_ACTION_MIN_CONFIDENCE = 0.40f
const val ORDINARY_NEXT_ACTION_MIN_MARGIN = 0.08f
const val OCCUPIED_RETRY_DELAY_MS = 250L

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class SuggestionPolicyTest {
}

@Test
fun ordinaryNextActionRejectsConfidenceBelowThirtyPercent() {
fun ordinaryNextActionRejectsConfidenceBelowFortyPercent() {
val assessment = SuggestionPolicy.assessOrdinaryNextAction(
vector(
AppActionId.VIEW_SCHEDULE to 0.29f,
AppActionId.VIEW_GRADES to 0.25f
AppActionId.VIEW_SCHEDULE to 0.3999f,
AppActionId.VIEW_GRADES to 0.30f
),
setOf(AppActionId.VIEW_SCHEDULE.stableId, AppActionId.VIEW_GRADES.stableId)
)
Expand All @@ -83,6 +83,20 @@ class SuggestionPolicyTest {
assertEquals(OrdinaryNextActionGateReason.BELOW_CONFIDENCE_THRESHOLD, assessment.rejectionReason)
}

@Test
fun ordinaryNextActionConfidenceBoundaryIsInclusive() {
val assessment = SuggestionPolicy.assessOrdinaryNextAction(
vector(
AppActionId.VIEW_SCHEDULE to 0.40f,
AppActionId.VIEW_GRADES to 0.30f
),
setOf(AppActionId.VIEW_SCHEDULE.stableId, AppActionId.VIEW_GRADES.stableId)
)

assertTrue(assessment.accepted)
assertEquals(AppActionId.VIEW_SCHEDULE, assessment.candidate?.action)
}

@Test
fun ordinaryNextActionRejectsAnAmbiguousTopCandidate() {
val assessment = SuggestionPolicy.assessOrdinaryNextAction(
Expand All @@ -102,7 +116,7 @@ class SuggestionPolicyTest {
val assessment = SuggestionPolicy.assessOrdinaryNextAction(
vector(
AppActionId.SUBMIT_CARD_RECHARGE to 0.45f,
AppActionId.VIEW_SCHEDULE to 0.35f
AppActionId.VIEW_SCHEDULE to 0.40f
),
setOf(AppActionId.SUBMIT_CARD_RECHARGE.stableId, AppActionId.VIEW_SCHEDULE.stableId)
)
Expand Down
Loading