1616public class TaskPlanner {
1717 // Legacy synchronous clients (for backward compatibility)
1818 private final LongCatClient longCatClient ;
19+ private final IFlowClient iflowClient ;
1920 private final DeepSeekClient deepSeekClient ;
2021 private final OpenAIClient openAIClient ;
2122 private final GeminiClient geminiClient ;
2223 private final GroqClient groqClient ;
2324
2425 // NEW: Async resilient clients
2526 private final AsyncLLMClient asyncLongCatClient ;
27+ private final AsyncLLMClient asyncIFlowClient ;
2628 private final AsyncLLMClient asyncDeepSeekClient ;
2729 private final AsyncLLMClient asyncOpenAIClient ;
2830 private final AsyncLLMClient asyncGeminiClient ;
@@ -33,6 +35,7 @@ public class TaskPlanner {
3335 public TaskPlanner () {
3436 // Legacy clients (always initialize - these work without external dependencies)
3537 this .longCatClient = new LongCatClient ();
38+ this .iflowClient = new IFlowClient ();
3639 this .deepSeekClient = new DeepSeekClient ();
3740 this .openAIClient = new OpenAIClient ();
3841 this .geminiClient = new GeminiClient ();
@@ -42,6 +45,7 @@ public TaskPlanner() {
4245 LLMCache tempCache = null ;
4346 LLMFallbackHandler tempFallback = null ;
4447 AsyncLLMClient tempAsyncLongCat = null ;
48+ AsyncLLMClient tempAsyncIFlow = null ;
4549 AsyncLLMClient tempAsyncDeepSeek = null ;
4650 AsyncLLMClient tempAsyncOpenAI = null ;
4751 AsyncLLMClient tempAsyncGemini = null ;
@@ -63,6 +67,13 @@ public TaskPlanner() {
6367 temperature
6468 );
6569
70+ AsyncLLMClient baseIFlow = new AsyncIFlowClient (
71+ SteveConfig .IFLOW_API_KEY .get (),
72+ SteveConfig .IFLOW_MODEL .get (),
73+ maxTokens ,
74+ temperature
75+ );
76+
6677 AsyncLLMClient baseDeepSeek = new AsyncDeepSeekClient (
6778 SteveConfig .DEEPSEEK_API_KEY .get (),
6879 SteveConfig .DEEPSEEK_MODEL .get (),
@@ -93,6 +104,7 @@ public TaskPlanner() {
93104
94105 // Wrap with resilience patterns (caching, retries, circuit breaker)
95106 tempAsyncLongCat = new ResilientLLMClient (baseLongCat , tempCache , tempFallback );
107+ tempAsyncIFlow = new ResilientLLMClient (baseIFlow , tempCache , tempFallback );
96108 tempAsyncDeepSeek = new ResilientLLMClient (baseDeepSeek , tempCache , tempFallback );
97109 tempAsyncOpenAI = new ResilientLLMClient (baseOpenAI , tempCache , tempFallback );
98110 tempAsyncGemini = new ResilientLLMClient (baseGemini , tempCache , tempFallback );
@@ -106,6 +118,7 @@ public TaskPlanner() {
106118 this .llmCache = tempCache ;
107119 this .fallbackHandler = tempFallback ;
108120 this .asyncLongCatClient = tempAsyncLongCat ;
121+ this .asyncIFlowClient = tempAsyncIFlow ;
109122 this .asyncDeepSeekClient = tempAsyncDeepSeek ;
110123 this .asyncOpenAIClient = tempAsyncOpenAI ;
111124 this .asyncGeminiClient = tempAsyncGemini ;
@@ -146,6 +159,7 @@ public ResponseParser.ParsedResponse planTasks(SteveEntity steve, String command
146159 private String getAIResponse (String provider , String systemPrompt , String userPrompt ) {
147160 String response = switch (provider ) {
148161 case "longcat" -> longCatClient .sendRequest (systemPrompt , userPrompt );
162+ case "iflow" -> iflowClient .sendRequest (systemPrompt , userPrompt );
149163 case "deepseek" -> deepSeekClient .sendRequest (systemPrompt , userPrompt );
150164 case "openai" -> openAIClient .sendRequest (systemPrompt , userPrompt );
151165 case "gemini" -> geminiClient .sendRequest (systemPrompt , userPrompt );
@@ -193,6 +207,7 @@ public CompletableFuture<ResponseParser.ParsedResponse> planTasksAsync(SteveEnti
193207 // Build params map with provider-specific model
194208 String modelForProvider = switch (provider ) {
195209 case "longcat" -> SteveConfig .LONGCAT_MODEL .get ();
210+ case "iflow" -> SteveConfig .IFLOW_MODEL .get ();
196211 case "deepseek" -> SteveConfig .DEEPSEEK_MODEL .get ();
197212 case "openai" -> SteveConfig .OPENAI_MODEL .get ();
198213 case "gemini" -> SteveConfig .GEMINI_MODEL .get ();
@@ -276,6 +291,7 @@ public CompletableFuture<ResponseParser.ParsedResponse> planTasksAsync(SteveEnti
276291 private AsyncLLMClient getAsyncClient (String provider ) {
277292 AsyncLLMClient client = switch (provider ) {
278293 case "longcat" -> asyncLongCatClient ;
294+ case "iflow" -> asyncIFlowClient ;
279295 case "deepseek" -> asyncDeepSeekClient ;
280296 case "openai" -> asyncOpenAIClient ;
281297 case "gemini" -> asyncGeminiClient ;
@@ -289,8 +305,9 @@ private AsyncLLMClient getAsyncClient(String provider) {
289305 // Null check - if preferred client is null, try fallback options
290306 if (client == null ) {
291307 SteveMod .LOGGER .warn ("[Async] Client for provider '{}' is null, trying fallbacks" , provider );
292- // Try fallback order: longcat -> deepseek -> openai -> gemini -> groq
308+ // Try fallback order: longcat -> iflow -> deepseek -> openai -> gemini -> groq
293309 if (asyncLongCatClient != null ) return asyncLongCatClient ;
310+ if (asyncIFlowClient != null ) return asyncIFlowClient ;
294311 if (asyncDeepSeekClient != null ) return asyncDeepSeekClient ;
295312 if (asyncOpenAIClient != null ) return asyncOpenAIClient ;
296313 if (asyncGeminiClient != null ) return asyncGeminiClient ;
0 commit comments