from backend.app.services.adaptive_rag_service import AdaptiveRAGService def test_feishu_no_explicit_deep_should_not_force(): should = AdaptiveRAGService._should_force_deep_for_channel( asked_via="feishu", question="不是啊,我说的是 ai 引擎驱动方式", effective_question="不是啊,我说的是 ai 引擎驱动方式", reason="correction_turn", ) assert not should def test_feishu_explicit_deep_can_force(): should = AdaptiveRAGService._should_force_deep_for_channel( asked_via="feishu", question="请深入分析调用链并给证据链", effective_question="请深入分析调用链并给证据链", reason="engine_process_query", ) assert should def test_pmflow_force_deep_kept(): should = AdaptiveRAGService._should_force_deep_for_channel( asked_via="pmflow", question="不是啊,我说的是 ai 引擎驱动方式", effective_question="不是啊,我说的是 ai 引擎驱动方式", reason="correction_turn", ) assert should def test_feishu_auto_retry_requires_explicit_deep(): allow_plain = AdaptiveRAGService._allow_auto_deep_retry_for_channel( asked_via="feishu", question="这个问题不太对", effective_question="这个问题不太对", reason="snapshot_only", ) allow_explicit = AdaptiveRAGService._allow_auto_deep_retry_for_channel( asked_via="feishu", question="请深度分析这个调用链", effective_question="请深度分析这个调用链", reason="snapshot_only", ) assert not allow_plain assert allow_explicit