diff --git a/src/agentkit/router/intent.py b/src/agentkit/router/intent.py index ffa85a1..579b5e3 100644 --- a/src/agentkit/router/intent.py +++ b/src/agentkit/router/intent.py @@ -101,8 +101,8 @@ class IntentRouter: if not candidates: return None - # 按得分降序排序,得分相同时按 skill 名称字母序稳定排序 - candidates.sort(key=lambda c: (-c[2], c[0].name)) + # 按得分降序排序;得分相同时保持列表顺序(Python sort 稳定) + candidates.sort(key=lambda c: -c[2]) best_skill, best_kws, _best_score = candidates[0] confidence = min(1.0, 0.5 + 0.1 * len(best_kws))