QA: Refactor similarity calculation and improve state management logic

This commit is contained in:
晴猫
2025-05-01 06:07:59 +09:00
parent 2f669c7055
commit 3d001da30e
7 changed files with 91 additions and 86 deletions

View File

@@ -78,7 +78,7 @@ def calculate_replacement_probability(similarity: float) -> float:
# p = 3.5 * s - 1.4
probability = 3.5 * similarity - 1.4
return max(0.0, probability)
elif 0.6 < similarity < 0.9:
else: # 0.6 < similarity < 0.9
# p = s + 0.1
probability = similarity + 0.1
return min(1.0, max(0.0, probability))
@@ -169,7 +169,7 @@ class SubMind:
last_cycle = history_cycle[-1] if history_cycle else None
# 上一次决策信息
if last_cycle != None:
if last_cycle is not None:
last_action = last_cycle.action_type
last_reasoning = last_cycle.reasoning
is_replan = last_cycle.replanned