|
|
@@ -1,40 +0,0 @@
|
|
|
-package edu.nju.software.aipaasagent.client.mcp.strategy;
|
|
|
-
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-/**
|
|
|
- * MCP 策略工厂
|
|
|
- * 根据模式名称创建对应的策略实例
|
|
|
- */
|
|
|
-public class McpStrategyFactory {
|
|
|
-
|
|
|
- private static final Map<String, McpStrategy> strategyMap = new HashMap<>();
|
|
|
-
|
|
|
- static {
|
|
|
- // 初始化策略映射
|
|
|
- strategyMap.put("auto", new AutoMcpStrategy());
|
|
|
- strategyMap.put("force", new ForceMcpStrategy());
|
|
|
- strategyMap.put("disabled", new DisabledMcpStrategy());
|
|
|
- strategyMap.put("intelligence", new IntelligenceMcpStrategy());
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 根据模式名称获取策略实例
|
|
|
- * @param mode 模式名称
|
|
|
- * @return MCP 策略实例
|
|
|
- */
|
|
|
- public static McpStrategy getStrategy(String mode) {
|
|
|
- if (mode == null || mode.isEmpty()) {
|
|
|
- mode = "auto"; // 默认使用 auto 模式
|
|
|
- }
|
|
|
-
|
|
|
- McpStrategy strategy = strategyMap.get(mode.toLowerCase());
|
|
|
- if (strategy == null) {
|
|
|
- // 如果模式不存在,使用 auto 模式作为默认值
|
|
|
- strategy = strategyMap.get("auto");
|
|
|
- }
|
|
|
-
|
|
|
- return strategy;
|
|
|
- }
|
|
|
-}
|