From c48f794ea48e36446f223a23c2ad0cf44aa45d93 Mon Sep 17 00:00:00 2001 From: CakeRepository Date: Mon, 28 Apr 2025 19:23:03 -0500 Subject: [PATCH 1/3] added multiagent setup to start testing with --- FlowVision/FlowVision.csproj | 2 + FlowVision/Form1.cs | 9 +- FlowVision/ToolConfigForm.Designer.cs | 21 +- FlowVision/ToolConfigForm.cs | 14 + FlowVision/lib/Classes/AgentCoordinator.cs | 106 ++++++ FlowVision/lib/Classes/ToolConfig.cs | 2 +- FlowVision/lib/Classes/ai/Actioner.cs | 42 ++- .../lib/Classes/ai/MultiAgentActioner.cs | 303 ++++++++++++++++++ FlowVision/lib/Classes/config/APIConfig.cs | 80 +++++ FlowVision/lib/Classes/config/ToolConfig.cs | 76 +++++ 10 files changed, 639 insertions(+), 16 deletions(-) create mode 100644 FlowVision/lib/Classes/AgentCoordinator.cs create mode 100644 FlowVision/lib/Classes/ai/MultiAgentActioner.cs create mode 100644 FlowVision/lib/Classes/config/APIConfig.cs create mode 100644 FlowVision/lib/Classes/config/ToolConfig.cs diff --git a/FlowVision/FlowVision.csproj b/FlowVision/FlowVision.csproj index 7888030..a7b5355 100644 --- a/FlowVision/FlowVision.csproj +++ b/FlowVision/FlowVision.csproj @@ -183,6 +183,8 @@ Form1.cs + + diff --git a/FlowVision/Form1.cs b/FlowVision/Form1.cs index 6fb827d..b32077b 100644 --- a/FlowVision/Form1.cs +++ b/FlowVision/Form1.cs @@ -341,7 +341,6 @@ private async Task GetAIResponseAsync(string userInput) // Get the current config to determine which model to use var actionerConfig = APIConfig.LoadConfig("actioner"); var githubConfig = APIConfig.LoadConfig("github"); - var toolConfig = ToolConfig.LoadConfig("toolsconfig"); // Create a StringBuilder to collect plugin output StringBuilder pluginOutput = new StringBuilder(); @@ -364,9 +363,15 @@ await TaskNotifier.RunWithNotificationAsync( "Processing your request and preparing tools", async () => { + var toolConfig = ToolConfig.LoadConfig("toolsconfig"); + // Use Actioner model with the notification infrastructure Actioner actioner = new Actioner(outputHandler); - if(toolConfig.RetainChatHistory) + + // Set multi-agent mode based on tool configuration + actioner.SetMultiAgentMode(toolConfig.EnableMultiAgentMode); + + if (toolConfig.RetainChatHistory) { actioner.SetChatHistory(chatHistory); } diff --git a/FlowVision/ToolConfigForm.Designer.cs b/FlowVision/ToolConfigForm.Designer.cs index 1ed1fc8..b0ebdd4 100644 --- a/FlowVision/ToolConfigForm.Designer.cs +++ b/FlowVision/ToolConfigForm.Designer.cs @@ -37,6 +37,7 @@ private void InitializeComponent() this.chkWindowSelectionPlugin = new System.Windows.Forms.CheckBox(); this.enablePluginLoggingCheckBox = new System.Windows.Forms.CheckBox(); this.groupBoxSettings = new System.Windows.Forms.GroupBox(); + this.chkMultiAgentMode = new System.Windows.Forms.CheckBox(); this.chkAutoInvoke = new System.Windows.Forms.CheckBox(); this.chkRetainChatHistory = new System.Windows.Forms.CheckBox(); this.numTemperature = new System.Windows.Forms.NumericUpDown(); @@ -156,6 +157,7 @@ private void InitializeComponent() // // groupBoxSettings // + this.groupBoxSettings.Controls.Add(this.chkMultiAgentMode); this.groupBoxSettings.Controls.Add(this.chkAutoInvoke); this.groupBoxSettings.Controls.Add(this.chkRetainChatHistory); this.groupBoxSettings.Controls.Add(this.numTemperature); @@ -163,11 +165,23 @@ private void InitializeComponent() this.groupBoxSettings.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.groupBoxSettings.Location = new System.Drawing.Point(12, 253); this.groupBoxSettings.Name = "groupBoxSettings"; - this.groupBoxSettings.Size = new System.Drawing.Size(436, 120); + this.groupBoxSettings.Size = new System.Drawing.Size(436, 150); this.groupBoxSettings.TabIndex = 1; this.groupBoxSettings.TabStop = false; this.groupBoxSettings.Text = "AI Settings"; // + // chkMultiAgentMode + // + this.chkMultiAgentMode.AutoSize = true; + this.chkMultiAgentMode.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkMultiAgentMode.Location = new System.Drawing.Point(17, 117); + this.chkMultiAgentMode.Name = "chkMultiAgentMode"; + this.chkMultiAgentMode.Size = new System.Drawing.Size(173, 23); + this.chkMultiAgentMode.TabIndex = 4; + this.chkMultiAgentMode.Text = "Enable Multi-Agent Mode"; + this.chkMultiAgentMode.UseVisualStyleBackColor = true; + this.chkMultiAgentMode.CheckedChanged += new System.EventHandler(this.chkMultiAgentMode_CheckedChanged); + // // chkAutoInvoke // this.chkAutoInvoke.AutoSize = true; @@ -272,7 +286,7 @@ private void InitializeComponent() this.groupBoxSpeechRecognition.Controls.Add(this.lblSpeechLanguage); this.groupBoxSpeechRecognition.Controls.Add(this.chkEnableSpeechRecognition); this.groupBoxSpeechRecognition.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxSpeechRecognition.Location = new System.Drawing.Point(12, 379); + this.groupBoxSpeechRecognition.Location = new System.Drawing.Point(12, 409); this.groupBoxSpeechRecognition.Name = "groupBoxSpeechRecognition"; this.groupBoxSpeechRecognition.Size = new System.Drawing.Size(436, 92); this.groupBoxSpeechRecognition.TabIndex = 5; @@ -327,7 +341,7 @@ private void InitializeComponent() this.groupBoxVoiceCommands.Controls.Add(this.lblVoiceCommandPhrase); this.groupBoxVoiceCommands.Controls.Add(this.chkEnableVoiceCommands); this.groupBoxVoiceCommands.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxVoiceCommands.Location = new System.Drawing.Point(12, 477); + this.groupBoxVoiceCommands.Location = new System.Drawing.Point(12, 507); this.groupBoxVoiceCommands.Name = "groupBoxVoiceCommands"; this.groupBoxVoiceCommands.Size = new System.Drawing.Size(436, 88); this.groupBoxVoiceCommands.TabIndex = 6; @@ -412,6 +426,7 @@ private void InitializeComponent() private System.Windows.Forms.Label lblTemperature; private System.Windows.Forms.CheckBox chkAutoInvoke; private System.Windows.Forms.CheckBox chkRetainChatHistory; + private System.Windows.Forms.CheckBox chkMultiAgentMode; private System.Windows.Forms.Button saveButton; private System.Windows.Forms.Button cancelButton; private System.Windows.Forms.GroupBox groupBoxSystemPrompt; diff --git a/FlowVision/ToolConfigForm.cs b/FlowVision/ToolConfigForm.cs index fb11da5..4de0249 100644 --- a/FlowVision/ToolConfigForm.cs +++ b/FlowVision/ToolConfigForm.cs @@ -97,6 +97,9 @@ private void LoadToolConfig() chkRetainChatHistory.Checked = _toolConfig.RetainChatHistory; txtSystemPrompt.Text = _toolConfig.SystemPrompt; + // Add multi-agent mode setting + chkMultiAgentMode.Checked = _toolConfig.EnableMultiAgentMode; + // Speech recognition settings chkEnableSpeechRecognition.Checked = _toolConfig.EnableSpeechRecognition; @@ -138,6 +141,9 @@ private void saveButton_Click(object sender, EventArgs e) _toolConfig.RetainChatHistory = chkRetainChatHistory.Checked; _toolConfig.SystemPrompt = txtSystemPrompt.Text; + // Save multi-agent mode setting + _toolConfig.EnableMultiAgentMode = chkMultiAgentMode.Checked; + // Save speech recognition settings _toolConfig.EnableSpeechRecognition = chkEnableSpeechRecognition.Checked; if (comboSpeechLanguage.SelectedItem != null) @@ -174,5 +180,13 @@ private void cancelButton_Click_1(object sender, EventArgs e) { this.Close(); } + + // Optional: Add an event handler for the checkbox if needed + private void chkMultiAgentMode_CheckedChanged(object sender, EventArgs e) + { + // You can add logic here if needed, for example: + // - Show/hide additional settings that are specific to multi-agent mode + // - Display a warning or information message about multi-agent mode + } } } diff --git a/FlowVision/lib/Classes/AgentCoordinator.cs b/FlowVision/lib/Classes/AgentCoordinator.cs new file mode 100644 index 0000000..774215e --- /dev/null +++ b/FlowVision/lib/Classes/AgentCoordinator.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Microsoft.SemanticKernel; +using Microsoft.SemanticKernel.ChatCompletion; + +namespace FlowVision.lib.Classes +{ + /// + /// Coordinates communication between the planner and executor agents + /// + public class AgentCoordinator + { + // Message templates for structured communication between agents + private const string PLAN_REQUEST = "PLAN_REQUEST: {0}"; + private const string PLAN_RESPONSE = "PLAN_RESPONSE: {0}"; + private const string EXECUTION_REQUEST = "EXECUTION_REQUEST: {0}"; + private const string EXECUTION_RESPONSE = "EXECUTION_RESPONSE: {0}"; + private const string STATUS_UPDATE = "STATUS_UPDATE: {0}"; + private const string TASK_COMPLETE = "TASK_COMPLETE: {0}"; + + private List messageHistory; + + public AgentCoordinator() + { + messageHistory = new List(); + } + + public void AddMessage(AgentRole sender, AgentRole recipient, string messageType, string content) + { + var message = new AgentMessage + { + Sender = sender, + Recipient = recipient, + MessageType = messageType, + Content = content, + Timestamp = DateTime.Now + }; + + messageHistory.Add(message); + } + + public List GetMessageHistory() + { + return messageHistory; + } + + public List GetMessagesForAgent(AgentRole agentRole) + { + return messageHistory.FindAll(m => m.Recipient == agentRole || m.Recipient == AgentRole.All); + } + + public string FormatPlanRequest(string userRequest) + { + return string.Format(PLAN_REQUEST, userRequest); + } + + public string FormatPlanResponse(string plan) + { + return string.Format(PLAN_RESPONSE, plan); + } + + public string FormatExecutionRequest(string step) + { + return string.Format(EXECUTION_REQUEST, step); + } + + public string FormatExecutionResponse(string result) + { + return string.Format(EXECUTION_RESPONSE, result); + } + + public string FormatStatusUpdate(string status) + { + return string.Format(STATUS_UPDATE, status); + } + + public string FormatTaskComplete(string summary) + { + return string.Format(TASK_COMPLETE, summary); + } + + public void Clear() + { + messageHistory.Clear(); + } + } + + public enum AgentRole + { + User, + Planner, + Executor, + All + } + + public class AgentMessage + { + public AgentRole Sender { get; set; } + public AgentRole Recipient { get; set; } + public string MessageType { get; set; } + public string Content { get; set; } + public DateTime Timestamp { get; set; } + } +} diff --git a/FlowVision/lib/Classes/ToolConfig.cs b/FlowVision/lib/Classes/ToolConfig.cs index 88969a2..0bdfc61 100644 --- a/FlowVision/lib/Classes/ToolConfig.cs +++ b/FlowVision/lib/Classes/ToolConfig.cs @@ -21,7 +21,7 @@ public class ToolConfig public bool AutoInvokeKernelFunctions { get; set; } = true; public bool RetainChatHistory { get; set; } = true; public string SystemPrompt { get; set; } = @"You are an AI Agent that can use tools to help the user. Use your tools to come up with novel ideas to answer the users requests you dont have the answer to. Do not restart the server"; - + public bool EnableMultiAgentMode { get; set; } = false; // Changed default to false public static string ConfigFilePath(string configName) { return Path.Combine( diff --git a/FlowVision/lib/Classes/ai/Actioner.cs b/FlowVision/lib/Classes/ai/Actioner.cs index c2d2f92..272213c 100644 --- a/FlowVision/lib/Classes/ai/Actioner.cs +++ b/FlowVision/lib/Classes/ai/Actioner.cs @@ -20,6 +20,9 @@ public class Actioner private const string ACTIONER_CONFIG = "actioner"; private const string TOOL_CONFIG = "toolsconfig"; // Added constant for tool config + private MultiAgentActioner multiAgentActioner; + private bool useMultiAgentMode = false; + public object ToolCallBehavior { get; private set; } // Update the Actioner constructor to support both the delegate and the RichTextBox approaches @@ -57,16 +60,32 @@ public Actioner(Form1.PluginOutputHandler outputHandler) } }; } + + // Initialize the multi-agent actioner with the same output handler + multiAgentActioner = new MultiAgentActioner(outputHandler); + } + + // Add method to toggle multi-agent mode + public void SetMultiAgentMode(bool enabled) + { + useMultiAgentMode = enabled; } public async Task ExecuteAction(string actionPrompt) { + // If multi-agent mode is enabled, use the multi-agent actioner + if (useMultiAgentMode) + { + return await multiAgentActioner.ExecuteAction(actionPrompt); + } + + // Otherwise use the original implementation ToolConfig toolConfig = ToolConfig.LoadConfig(TOOL_CONFIG); - + // Notify that we're starting the action execution PluginLogger.NotifyTaskStart("Action Execution", "Processing your request"); PluginLogger.StartLoadingIndicator("request"); - + try { // Add system message to actioner history @@ -85,7 +104,7 @@ public async Task ExecuteAction(string actionPrompt) PluginLogger.NotifyTaskComplete("Action Execution", false); return "Error: Actioner model not configured"; } - + // Setup the kernel for actioner with plugins var builder = Kernel.CreateBuilder(); builder.AddAzureOpenAIChatCompletion( @@ -101,33 +120,33 @@ public async Task ExecuteAction(string actionPrompt) ? Microsoft.SemanticKernel.Connectors.OpenAI.ToolCallBehavior.AutoInvokeKernelFunctions : Microsoft.SemanticKernel.Connectors.OpenAI.ToolCallBehavior.EnableKernelFunctions }; - + // Add plugins dynamically based on tool configuration if (toolConfig.EnableCMDPlugin) { builder.Plugins.AddFromType(); } - + if (toolConfig.EnablePowerShellPlugin) { builder.Plugins.AddFromType(); } - + if (toolConfig.EnableScreenCapturePlugin) { builder.Plugins.AddFromType(); } - + if (toolConfig.EnableKeyboardPlugin) { builder.Plugins.AddFromType(); } - + if (toolConfig.EnableMousePlugin) { builder.Plugins.AddFromType(); } - + if (toolConfig.EnableWindowSelectionPlugin) { builder.Plugins.AddFromType(); @@ -160,7 +179,7 @@ public async Task ExecuteAction(string actionPrompt) // Task completed successfully PluginLogger.NotifyTaskComplete("Action Execution", true); - + return responseBuilder.ToString(); } catch (Exception ex) @@ -185,6 +204,9 @@ internal void SetChatHistory(List chatHistory) actionerHistory.AddAssistantMessage(message.Content); } } + + // Also update the multi-agent chat history + multiAgentActioner.SetChatHistory(chatHistory); } } } \ No newline at end of file diff --git a/FlowVision/lib/Classes/ai/MultiAgentActioner.cs b/FlowVision/lib/Classes/ai/MultiAgentActioner.cs new file mode 100644 index 0000000..3b0d855 --- /dev/null +++ b/FlowVision/lib/Classes/ai/MultiAgentActioner.cs @@ -0,0 +1,303 @@ +ο»Ώusing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using FlowVision.lib.Plugins; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.SemanticKernel; +using Microsoft.SemanticKernel.ChatCompletion; +using Microsoft.SemanticKernel.Connectors.OpenAI; + +namespace FlowVision.lib.Classes +{ + /// + /// Multi-agent actioner that coordinates between a planner agent and an execution agent + /// + public class MultiAgentActioner + { + private IChatCompletionService plannerChat; + private IChatCompletionService executorChat; + private ChatHistory plannerHistory; + private ChatHistory executorHistory; + private Kernel plannerKernel; + private Kernel executorKernel; + + private const string PLANNER_CONFIG = "planner"; + private const string EXECUTOR_CONFIG = "executor"; + private const string ACTIONER_CONFIG = "actioner"; + private const string TOOL_CONFIG = "toolsconfig"; + + private const string PLANNER_SYSTEM_PROMPT = @"You are a planning agent responsible for breaking down complex tasks into clear steps. +Your job is to: +1. Analyze the user's request +2. Create a step-by-step plan to accomplish the goal +3. Send each step to the executor agent +4. Review the executor's results after each step +5. Adapt the plan as needed based on the results +6. Continue until the entire task is complete +7. If use is just greeting respond with hello + +YOU CANNOT EXECUTE TOOLS DIRECTLY. Only the execution agent can use tools. +You must work with the execution agent to accomplish the goals."; + + private const string EXECUTOR_SYSTEM_PROMPT = @"You are an execution agent with access to various tools. +Your job is to: +1. Execute the specific step provided by the planner agent +2. Use available tools to accomplish the requested action +3. Report back the results and any observations +4. Do not go beyond the specific step you were asked to perform +5. Be precise and thorough in your execution + +You have access to tools like CMD, PowerShell, screen capture, keyboard input, mouse control, and window selection."; + + public MultiAgentActioner(Form1.PluginOutputHandler outputHandler) + { + plannerHistory = new ChatHistory(); + executorHistory = new ChatHistory(); + + // Create a RichTextBox that isn't displayed but used for logging + var hiddenTextBox = new RichTextBox { Visible = false }; + + // Initialize the plugin logger + if (Application.OpenForms.Count > 0 && Application.OpenForms[0] is Form1 mainForm) + { + Action addMessageAction = mainForm.AddMessage; + PluginLogger.Initialize(hiddenTextBox, addMessageAction); + } + else + { + PluginLogger.Initialize(hiddenTextBox); + } + + // Override the UpdateUI method to use our output handler + if (outputHandler != null) + { + hiddenTextBox.TextChanged += (sender, e) => + { + string newText = hiddenTextBox.Lines.LastOrDefault(); + if (!string.IsNullOrEmpty(newText)) + { + outputHandler(newText); + } + }; + } + } + + public async Task ExecuteAction(string actionPrompt) + { + ToolConfig toolConfig = ToolConfig.LoadConfig(TOOL_CONFIG); + + PluginLogger.NotifyTaskStart("Multi-Agent Action", "Planning and executing your request"); + PluginLogger.StartLoadingIndicator("planning"); + + try + { + // Configure planner first + plannerHistory.Clear(); + plannerHistory.AddSystemMessage(PLANNER_SYSTEM_PROMPT); + plannerHistory.AddUserMessage(actionPrompt); + + // Configure executor for later use + executorHistory.Clear(); + executorHistory.AddSystemMessage(EXECUTOR_SYSTEM_PROMPT); + + // Load model configurations + APIConfig config = APIConfig.LoadConfig(ACTIONER_CONFIG); + + if (string.IsNullOrWhiteSpace(config.DeploymentName) || + string.IsNullOrWhiteSpace(config.EndpointURL) || + string.IsNullOrWhiteSpace(config.APIKey)) + { + PluginLogger.NotifyTaskComplete("Multi-Agent Action", false); + return "Error: Actioner model not configured"; + } + + // Setup the kernel for planner (no tools, only planning capabilities) + var plannerBuilder = Kernel.CreateBuilder(); + plannerBuilder.AddAzureOpenAIChatCompletion( + config.DeploymentName, + config.EndpointURL, + config.APIKey); + + plannerKernel = plannerBuilder.Build(); + plannerChat = plannerKernel.GetRequiredService(); + + // Setup the kernel for executor with all tools + var executorBuilder = Kernel.CreateBuilder(); + executorBuilder.AddAzureOpenAIChatCompletion( + config.DeploymentName, + config.EndpointURL, + config.APIKey); + + // Add plugins dynamically based on tool configuration + if (toolConfig.EnableCMDPlugin) + { + executorBuilder.Plugins.AddFromType(); + } + + if (toolConfig.EnablePowerShellPlugin) + { + executorBuilder.Plugins.AddFromType(); + } + + if (toolConfig.EnableScreenCapturePlugin) + { + executorBuilder.Plugins.AddFromType(); + } + + if (toolConfig.EnableKeyboardPlugin) + { + executorBuilder.Plugins.AddFromType(); + } + + if (toolConfig.EnableMousePlugin) + { + executorBuilder.Plugins.AddFromType(); + } + + if (toolConfig.EnableWindowSelectionPlugin) + { + executorBuilder.Plugins.AddFromType(); + } + + executorKernel = executorBuilder.Build(); + executorChat = executorKernel.GetRequiredService(); + + // Get initial plan from planner agent + PluginLogger.StopLoadingIndicator(); + PluginLogger.LogPluginUsage("🧠 Planning approach..."); + PluginLogger.StartLoadingIndicator("planning"); + + var planSettings = new OpenAIPromptExecutionSettings + { + Temperature = 0.2, + // No tools for planner + }; + + var executorSettings = new OpenAIPromptExecutionSettings + { + Temperature = toolConfig.Temperature, + ToolCallBehavior = toolConfig.AutoInvokeKernelFunctions + ? ToolCallBehavior.AutoInvokeKernelFunctions + : ToolCallBehavior.EnableKernelFunctions + }; + + // Get the initial plan + string plan = await GetAgentResponseAsync(plannerChat, plannerHistory, planSettings, plannerKernel); + PluginLogger.LogPluginUsage("πŸ“ Initial Plan:\n" + plan); + + // Now execute the plan step by step + bool isComplete = false; + int maxIterations = 10; // Safety limit + int currentIteration = 0; + string finalResult = ""; + + while (!isComplete && currentIteration < maxIterations) + { + currentIteration++; + PluginLogger.LogPluginUsage($"βš™οΈ Iteration {currentIteration} of {maxIterations}"); + + // Ask executor to perform the current step + executorHistory.AddUserMessage($"Please execute the following step of our plan: {plan}"); + + PluginLogger.StopLoadingIndicator(); + PluginLogger.LogPluginUsage("πŸ”§ Executing step..."); + PluginLogger.StartLoadingIndicator("executing"); + + // Get executor response with tools + string executionResult = await GetAgentResponseAsync(executorChat, executorHistory, executorSettings, executorKernel); + + PluginLogger.LogPluginUsage("πŸ“Š Execution result:\n" + executionResult); + + // Add the execution result to the planner's history + plannerHistory.AddUserMessage($"The executor agent performed the requested step. Here is the result:\n\n{executionResult}\n\nIs the task fully completed, or do we need additional steps? If additional steps are needed, provide just the next step to execute. If the task is complete, respond with 'TASK COMPLETED' followed by a summary of what was accomplished."); + + PluginLogger.StopLoadingIndicator(); + PluginLogger.LogPluginUsage("πŸ”„ Evaluating progress..."); + PluginLogger.StartLoadingIndicator("planning"); + + // Get planner's evaluation of the result + plan = await GetAgentResponseAsync(plannerChat, plannerHistory, planSettings, plannerKernel); + + // Check if the task is complete + if (plan.Contains("TASK COMPLETED")) + { + isComplete = true; + finalResult = plan; + } + + PluginLogger.LogPluginUsage("πŸ” Progress evaluation:\n" + plan); + } + + PluginLogger.StopLoadingIndicator(); + + if (isComplete) + { + PluginLogger.NotifyTaskComplete("Multi-Agent Action", true); + return finalResult; + } + else + { + PluginLogger.NotifyTaskComplete("Multi-Agent Action", false); + return $"Task execution reached maximum iterations ({maxIterations}) without completion. Last status: {plan}"; + } + } + catch (Exception ex) + { + PluginLogger.StopLoadingIndicator(); + PluginLogger.NotifyTaskComplete("Multi-Agent Action", false); + return $"Error: {ex.Message}"; + } + } + + private async Task GetAgentResponseAsync( + IChatCompletionService chatService, + ChatHistory history, + OpenAIPromptExecutionSettings settings, + Kernel kernel) + { + var responseBuilder = new StringBuilder(); + var responseStream = chatService.GetStreamingChatMessageContentsAsync(history, settings, kernel); + var enumerator = responseStream.GetAsyncEnumerator(); + + try + { + while (await enumerator.MoveNextAsync()) + { + var message = enumerator.Current; + if (message.Content == "None") continue; + responseBuilder.Append(message.Content); + } + } + finally + { + await enumerator.DisposeAsync(); + } + + string response = responseBuilder.ToString(); + history.AddAssistantMessage(response); + + return response; + } + + internal void SetChatHistory(List chatHistory) + { + plannerHistory.Clear(); + plannerHistory.AddSystemMessage(PLANNER_SYSTEM_PROMPT); + + foreach (var message in chatHistory) + { + if (message.Author == "You") + { + plannerHistory.AddUserMessage(message.Content); + } + else if (message.Author == "AI") + { + plannerHistory.AddAssistantMessage(message.Content); + } + } + } + } +} diff --git a/FlowVision/lib/Classes/config/APIConfig.cs b/FlowVision/lib/Classes/config/APIConfig.cs new file mode 100644 index 0000000..4aec3f2 --- /dev/null +++ b/FlowVision/lib/Classes/config/APIConfig.cs @@ -0,0 +1,80 @@ +// If this file doesn't exist, here's a potential implementation based on observed usage +// Otherwise, you would modify the existing file to add the new properties for the planner and executor + +using System; +using System.IO; +using System.Text.Json; + +namespace FlowVision.lib.Classes +{ + public class APIConfig + { + // Base API configuration + public string DeploymentName { get; set; } = ""; + public string EndpointURL { get; set; } = ""; + public string APIKey { get; set; } = ""; + + // Model specific settings + public int MaxTokens { get; set; } = 4000; + public float Temperature { get; set; } = 0.7f; + + // For multi-agent configurations (optional - can use same model for both) + public bool UseCustomPlannerModel { get; set; } = false; + public string PlannerDeploymentName { get; set; } = ""; + public string PlannerEndpointURL { get; set; } = ""; + public string PlannerAPIKey { get; set; } = ""; + + public bool UseCustomExecutorModel { get; set; } = false; + public string ExecutorDeploymentName { get; set; } = ""; + public string ExecutorEndpointURL { get; set; } = ""; + public string ExecutorAPIKey { get; set; } = ""; + + private static readonly string ConfigDir = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "FlowVision", "Config"); + + public static APIConfig LoadConfig(string configName) + { + try + { + string configPath = Path.Combine(ConfigDir, $"{configName}.json"); + + // If config doesn't exist, create default + if (!File.Exists(configPath)) + { + var defaultConfig = new APIConfig(); + SaveConfig(defaultConfig, configName); + return defaultConfig; + } + + string json = File.ReadAllText(configPath); + return JsonSerializer.Deserialize(json) ?? new APIConfig(); + } + catch (Exception) + { + // Return default config if loading fails + return new APIConfig(); + } + } + + public static void SaveConfig(APIConfig config, string configName) + { + try + { + // Ensure directory exists + if (!Directory.Exists(ConfigDir)) + { + Directory.CreateDirectory(ConfigDir); + } + + string configPath = Path.Combine(ConfigDir, $"{configName}.json"); + string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); + File.WriteAllText(configPath, json); + } + catch (Exception) + { + // Handle saving error if needed + } + } + } +} diff --git a/FlowVision/lib/Classes/config/ToolConfig.cs b/FlowVision/lib/Classes/config/ToolConfig.cs new file mode 100644 index 0000000..9043af0 --- /dev/null +++ b/FlowVision/lib/Classes/config/ToolConfig.cs @@ -0,0 +1,76 @@ +using System; +using System.IO; +using System.Text.Json; + +namespace FlowVision.lib.Classes +{ + public class ToolConfig + { + // Basic settings + public string SystemPrompt { get; set; } = "You are a helpful AI assistant with access to tools."; + public float Temperature { get; set; } = 0.2f; + public bool AutoInvokeKernelFunctions { get; set; } = true; + + // Plugin enablement flags + public bool EnableCMDPlugin { get; set; } = true; + public bool EnablePowerShellPlugin { get; set; } = true; + public bool EnableScreenCapturePlugin { get; set; } = true; + public bool EnableKeyboardPlugin { get; set; } = true; + public bool EnableMousePlugin { get; set; } = true; + public bool EnableWindowSelectionPlugin { get; set; } = true; + + // Multi-agent settings + public bool EnableMultiAgentMode { get; set; } = false; // Default to single-agent mode + public string PlannerSystemPrompt { get; set; } = "You are a planning agent responsible for breaking down complex tasks into steps."; + public string ExecutorSystemPrompt { get; set; } = "You are an execution agent with access to various tools."; + public int MaxAgentIterations { get; set; } = 10; + + private static readonly string ConfigDir = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "FlowVision", "Config"); + + public static ToolConfig LoadConfig(string configName) + { + try + { + string configPath = Path.Combine(ConfigDir, $"{configName}.json"); + + // If config doesn't exist, create default + if (!File.Exists(configPath)) + { + var defaultConfig = new ToolConfig(); + SaveConfig(defaultConfig, configName); + return defaultConfig; + } + + string json = File.ReadAllText(configPath); + return JsonSerializer.Deserialize(json) ?? new ToolConfig(); + } + catch (Exception) + { + // Return default config if loading fails + return new ToolConfig(); + } + } + + public static void SaveConfig(ToolConfig config, string configName) + { + try + { + // Ensure directory exists + if (!Directory.Exists(ConfigDir)) + { + Directory.CreateDirectory(ConfigDir); + } + + string configPath = Path.Combine(ConfigDir, $"{configName}.json"); + string json = JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }); + File.WriteAllText(configPath, json); + } + catch (Exception) + { + // Handle saving error if needed + } + } + } +} From 7c8a26a956bc8bfdafebd9be405e7aa5cdd205e3 Mon Sep 17 00:00:00 2001 From: CakeRepository Date: Mon, 28 Apr 2025 21:33:57 -0500 Subject: [PATCH 2/3] Fixed tool config to include better GUI --- FlowVision/ToolConfigForm.Designer.cs | 855 +++++++++++++++--- FlowVision/ToolConfigForm.cs | 750 +++++++++++++-- FlowVision/ToolConfigForm.resx | 6 + .../lib/Classes/SettingsProfileManager.cs | 106 +++ FlowVision/lib/Classes/ToolConfig.cs | 32 +- FlowVision/lib/Classes/ai/Actioner.cs | 2 +- FlowVision/lib/Classes/ai/Github_Actioner.cs | 2 +- .../lib/Classes/ai/MultiAgentActioner.cs | 83 +- FlowVision/lib/UI/ThemeManager.cs | 81 ++ 9 files changed, 1692 insertions(+), 225 deletions(-) create mode 100644 FlowVision/lib/Classes/SettingsProfileManager.cs create mode 100644 FlowVision/lib/UI/ThemeManager.cs diff --git a/FlowVision/ToolConfigForm.Designer.cs b/FlowVision/ToolConfigForm.Designer.cs index b0ebdd4..b545d5d 100644 --- a/FlowVision/ToolConfigForm.Designer.cs +++ b/FlowVision/ToolConfigForm.Designer.cs @@ -28,7 +28,14 @@ protected override void Dispose(bool disposing) /// private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); this.groupBoxPlugins = new System.Windows.Forms.GroupBox(); + this.indicatorWindow = new System.Windows.Forms.PictureBox(); + this.indicatorMouse = new System.Windows.Forms.PictureBox(); + this.indicatorKeyboard = new System.Windows.Forms.PictureBox(); + this.indicatorScreenCapture = new System.Windows.Forms.PictureBox(); + this.indicatorPowerShell = new System.Windows.Forms.PictureBox(); + this.indicatorCMD = new System.Windows.Forms.PictureBox(); this.chkMousePlugin = new System.Windows.Forms.CheckBox(); this.chkKeyboardPlugin = new System.Windows.Forms.CheckBox(); this.chkScreenCapturePlugin = new System.Windows.Forms.CheckBox(); @@ -37,6 +44,8 @@ private void InitializeComponent() this.chkWindowSelectionPlugin = new System.Windows.Forms.CheckBox(); this.enablePluginLoggingCheckBox = new System.Windows.Forms.CheckBox(); this.groupBoxSettings = new System.Windows.Forms.GroupBox(); + this.indicatorAutoInvoke = new System.Windows.Forms.PictureBox(); + this.indicatorMultiAgent = new System.Windows.Forms.PictureBox(); this.chkMultiAgentMode = new System.Windows.Forms.CheckBox(); this.chkAutoInvoke = new System.Windows.Forms.CheckBox(); this.chkRetainChatHistory = new System.Windows.Forms.CheckBox(); @@ -44,139 +53,297 @@ private void InitializeComponent() this.lblTemperature = new System.Windows.Forms.Label(); this.saveButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); - this.groupBoxSystemPrompt = new System.Windows.Forms.GroupBox(); - this.txtSystemPrompt = new System.Windows.Forms.TextBox(); this.groupBoxSpeechRecognition = new System.Windows.Forms.GroupBox(); - this.chkEnableSpeechRecognition = new System.Windows.Forms.CheckBox(); - this.lblSpeechLanguage = new System.Windows.Forms.Label(); + this.indicatorSpeech = new System.Windows.Forms.PictureBox(); this.comboSpeechLanguage = new System.Windows.Forms.ComboBox(); + this.lblSpeechLanguage = new System.Windows.Forms.Label(); + this.chkEnableSpeechRecognition = new System.Windows.Forms.CheckBox(); this.groupBoxVoiceCommands = new System.Windows.Forms.GroupBox(); - this.chkEnableVoiceCommands = new System.Windows.Forms.CheckBox(); - this.lblVoiceCommandPhrase = new System.Windows.Forms.Label(); + this.indicatorVoiceCmd = new System.Windows.Forms.PictureBox(); this.txtVoiceCommandPhrase = new System.Windows.Forms.TextBox(); + this.lblVoiceCommandPhrase = new System.Windows.Forms.Label(); + this.chkEnableVoiceCommands = new System.Windows.Forms.CheckBox(); + this.tabControlMain = new System.Windows.Forms.TabControl(); + this.tabPlugins = new System.Windows.Forms.TabPage(); + this.tabAISettings = new System.Windows.Forms.TabPage(); + this.tabVoice = new System.Windows.Forms.TabPage(); + this.tabMultiAgent = new System.Windows.Forms.TabPage(); + this.grpMultiAgentConfig = new System.Windows.Forms.GroupBox(); + this.lblPlannerPrompt = new System.Windows.Forms.Label(); + this.txtPlannerSystemPrompt = new System.Windows.Forms.TextBox(); + this.lblExecutorPrompt = new System.Windows.Forms.Label(); + this.txtExecutorSystemPrompt = new System.Windows.Forms.TextBox(); + this.chkUseCustomPlannerConfig = new System.Windows.Forms.CheckBox(); + this.comboPlannerConfig = new System.Windows.Forms.ComboBox(); + this.btnConfigurePlanner = new System.Windows.Forms.Button(); + this.chkUseCustomExecutorConfig = new System.Windows.Forms.CheckBox(); + this.comboExecutorConfig = new System.Windows.Forms.ComboBox(); + this.btnConfigureExecutor = new System.Windows.Forms.Button(); + this.tabAppearance = new System.Windows.Forms.TabPage(); + this.groupBoxTheme = new System.Windows.Forms.GroupBox(); + this.labelTheme = new System.Windows.Forms.Label(); + this.cbTheme = new System.Windows.Forms.ComboBox(); + this.tabProfiles = new System.Windows.Forms.TabPage(); + this.groupBoxProfiles = new System.Windows.Forms.GroupBox(); + this.btnDeleteProfile = new System.Windows.Forms.Button(); + this.btnLoadProfile = new System.Windows.Forms.Button(); + this.btnSaveProfile = new System.Windows.Forms.Button(); + this.labelProfile = new System.Windows.Forms.Label(); + this.cmbProfiles = new System.Windows.Forms.ComboBox(); + this.imageListStatus = new System.Windows.Forms.ImageList(this.components); + this.panelSearch = new System.Windows.Forms.Panel(); + this.searchResultLabel = new System.Windows.Forms.Label(); + this.txtSearchSettings = new System.Windows.Forms.TextBox(); + this.lblSearchSettings = new System.Windows.Forms.Label(); + this.saveNotification = new System.Windows.Forms.Panel(); + this.lblSaveNotification = new System.Windows.Forms.Label(); + this.saveNotificationTimer = new System.Windows.Forms.Timer(this.components); this.groupBoxPlugins.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorWindow)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorMouse)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorKeyboard)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorScreenCapture)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorPowerShell)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorCMD)).BeginInit(); this.groupBoxSettings.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorAutoInvoke)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorMultiAgent)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numTemperature)).BeginInit(); - this.groupBoxSystemPrompt.SuspendLayout(); this.groupBoxSpeechRecognition.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorSpeech)).BeginInit(); this.groupBoxVoiceCommands.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorVoiceCmd)).BeginInit(); + this.tabControlMain.SuspendLayout(); + this.tabPlugins.SuspendLayout(); + this.tabAISettings.SuspendLayout(); + this.tabVoice.SuspendLayout(); + this.tabMultiAgent.SuspendLayout(); + this.grpMultiAgentConfig.SuspendLayout(); + this.tabAppearance.SuspendLayout(); + this.groupBoxTheme.SuspendLayout(); + this.tabProfiles.SuspendLayout(); + this.groupBoxProfiles.SuspendLayout(); + this.panelSearch.SuspendLayout(); + this.saveNotification.SuspendLayout(); this.SuspendLayout(); // // groupBoxPlugins // + this.groupBoxPlugins.Controls.Add(this.indicatorWindow); + this.groupBoxPlugins.Controls.Add(this.indicatorMouse); + this.groupBoxPlugins.Controls.Add(this.indicatorKeyboard); + this.groupBoxPlugins.Controls.Add(this.indicatorScreenCapture); + this.groupBoxPlugins.Controls.Add(this.indicatorPowerShell); + this.groupBoxPlugins.Controls.Add(this.indicatorCMD); this.groupBoxPlugins.Controls.Add(this.chkMousePlugin); this.groupBoxPlugins.Controls.Add(this.chkKeyboardPlugin); this.groupBoxPlugins.Controls.Add(this.chkScreenCapturePlugin); this.groupBoxPlugins.Controls.Add(this.chkPowerShellPlugin); this.groupBoxPlugins.Controls.Add(this.chkCMDPlugin); this.groupBoxPlugins.Controls.Add(this.chkWindowSelectionPlugin); - this.groupBoxPlugins.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxPlugins.Location = new System.Drawing.Point(12, 12); + this.groupBoxPlugins.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBoxPlugins.Location = new System.Drawing.Point(6, 6); this.groupBoxPlugins.Name = "groupBoxPlugins"; this.groupBoxPlugins.Size = new System.Drawing.Size(436, 200); this.groupBoxPlugins.TabIndex = 0; this.groupBoxPlugins.TabStop = false; this.groupBoxPlugins.Text = "Available Plugins"; // + // indicatorWindow + // + this.indicatorWindow.BackColor = System.Drawing.Color.Transparent; + this.indicatorWindow.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorWindow.Location = new System.Drawing.Point(390, 171); + this.indicatorWindow.Name = "indicatorWindow"; + this.indicatorWindow.Size = new System.Drawing.Size(24, 24); + this.indicatorWindow.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorWindow.TabIndex = 11; + this.indicatorWindow.TabStop = false; + // + // indicatorMouse + // + this.indicatorMouse.BackColor = System.Drawing.Color.Transparent; + this.indicatorMouse.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorMouse.Location = new System.Drawing.Point(390, 142); + this.indicatorMouse.Name = "indicatorMouse"; + this.indicatorMouse.Size = new System.Drawing.Size(24, 24); + this.indicatorMouse.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorMouse.TabIndex = 10; + this.indicatorMouse.TabStop = false; + // + // indicatorKeyboard + // + this.indicatorKeyboard.BackColor = System.Drawing.Color.Transparent; + this.indicatorKeyboard.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorKeyboard.Location = new System.Drawing.Point(390, 113); + this.indicatorKeyboard.Name = "indicatorKeyboard"; + this.indicatorKeyboard.Size = new System.Drawing.Size(24, 24); + this.indicatorKeyboard.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorKeyboard.TabIndex = 9; + this.indicatorKeyboard.TabStop = false; + // + // indicatorScreenCapture + // + this.indicatorScreenCapture.BackColor = System.Drawing.Color.Transparent; + this.indicatorScreenCapture.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorScreenCapture.Location = new System.Drawing.Point(390, 84); + this.indicatorScreenCapture.Name = "indicatorScreenCapture"; + this.indicatorScreenCapture.Size = new System.Drawing.Size(24, 24); + this.indicatorScreenCapture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorScreenCapture.TabIndex = 8; + this.indicatorScreenCapture.TabStop = false; + // + // indicatorPowerShell + // + this.indicatorPowerShell.BackColor = System.Drawing.Color.Transparent; + this.indicatorPowerShell.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorPowerShell.Location = new System.Drawing.Point(390, 55); + this.indicatorPowerShell.Name = "indicatorPowerShell"; + this.indicatorPowerShell.Size = new System.Drawing.Size(24, 24); + this.indicatorPowerShell.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorPowerShell.TabIndex = 7; + this.indicatorPowerShell.TabStop = false; + // + // indicatorCMD + // + this.indicatorCMD.BackColor = System.Drawing.Color.Transparent; + this.indicatorCMD.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorCMD.Location = new System.Drawing.Point(390, 26); + this.indicatorCMD.Name = "indicatorCMD"; + this.indicatorCMD.Size = new System.Drawing.Size(24, 24); + this.indicatorCMD.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorCMD.TabIndex = 6; + this.indicatorCMD.TabStop = false; + // // chkMousePlugin // this.chkMousePlugin.AutoSize = true; - this.chkMousePlugin.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkMousePlugin.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkMousePlugin.Location = new System.Drawing.Point(17, 142); this.chkMousePlugin.Name = "chkMousePlugin"; - this.chkMousePlugin.Size = new System.Drawing.Size(288, 23); + this.chkMousePlugin.Size = new System.Drawing.Size(287, 23); this.chkMousePlugin.TabIndex = 4; this.chkMousePlugin.Text = "Enable Mouse Plugin (Mouse Automation)"; this.chkMousePlugin.UseVisualStyleBackColor = true; + this.chkMousePlugin.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // chkKeyboardPlugin // this.chkKeyboardPlugin.AutoSize = true; - this.chkKeyboardPlugin.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkKeyboardPlugin.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkKeyboardPlugin.Location = new System.Drawing.Point(17, 113); this.chkKeyboardPlugin.Name = "chkKeyboardPlugin"; - this.chkKeyboardPlugin.Size = new System.Drawing.Size(328, 23); + this.chkKeyboardPlugin.Size = new System.Drawing.Size(319, 23); this.chkKeyboardPlugin.TabIndex = 3; this.chkKeyboardPlugin.Text = "Enable Keyboard Plugin (Keyboard Automation)"; this.chkKeyboardPlugin.UseVisualStyleBackColor = true; + this.chkKeyboardPlugin.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // chkScreenCapturePlugin // this.chkScreenCapturePlugin.AutoSize = true; - this.chkScreenCapturePlugin.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkScreenCapturePlugin.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkScreenCapturePlugin.Location = new System.Drawing.Point(17, 84); this.chkScreenCapturePlugin.Name = "chkScreenCapturePlugin"; - this.chkScreenCapturePlugin.Size = new System.Drawing.Size(313, 23); + this.chkScreenCapturePlugin.Size = new System.Drawing.Size(292, 23); this.chkScreenCapturePlugin.TabIndex = 2; this.chkScreenCapturePlugin.Text = "Enable Screen Capture Plugin (Screenshots)"; this.chkScreenCapturePlugin.UseVisualStyleBackColor = true; + this.chkScreenCapturePlugin.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // chkPowerShellPlugin // this.chkPowerShellPlugin.AutoSize = true; - this.chkPowerShellPlugin.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkPowerShellPlugin.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkPowerShellPlugin.Location = new System.Drawing.Point(17, 55); this.chkPowerShellPlugin.Name = "chkPowerShellPlugin"; - this.chkPowerShellPlugin.Size = new System.Drawing.Size(343, 23); + this.chkPowerShellPlugin.Size = new System.Drawing.Size(330, 23); this.chkPowerShellPlugin.TabIndex = 1; this.chkPowerShellPlugin.Text = "Enable PowerShell Plugin (PowerShell Commands)"; this.chkPowerShellPlugin.UseVisualStyleBackColor = true; + this.chkPowerShellPlugin.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // chkCMDPlugin // this.chkCMDPlugin.AutoSize = true; - this.chkCMDPlugin.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkCMDPlugin.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkCMDPlugin.Location = new System.Drawing.Point(17, 26); this.chkCMDPlugin.Name = "chkCMDPlugin"; - this.chkCMDPlugin.Size = new System.Drawing.Size(268, 23); + this.chkCMDPlugin.Size = new System.Drawing.Size(272, 23); this.chkCMDPlugin.TabIndex = 0; this.chkCMDPlugin.Text = "Enable CMD Plugin (Command Prompt)"; this.chkCMDPlugin.UseVisualStyleBackColor = true; + this.chkCMDPlugin.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // chkWindowSelectionPlugin // this.chkWindowSelectionPlugin.AutoSize = true; - this.chkWindowSelectionPlugin.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkWindowSelectionPlugin.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkWindowSelectionPlugin.Location = new System.Drawing.Point(17, 171); this.chkWindowSelectionPlugin.Name = "chkWindowSelectionPlugin"; - this.chkWindowSelectionPlugin.Size = new System.Drawing.Size(351, 23); + this.chkWindowSelectionPlugin.Size = new System.Drawing.Size(337, 23); this.chkWindowSelectionPlugin.TabIndex = 5; this.chkWindowSelectionPlugin.Text = "Enable Window Selection Plugin (Window Handles)"; this.chkWindowSelectionPlugin.UseVisualStyleBackColor = true; + this.chkWindowSelectionPlugin.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // enablePluginLoggingCheckBox // this.enablePluginLoggingCheckBox.AutoSize = true; - this.enablePluginLoggingCheckBox.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.enablePluginLoggingCheckBox.Location = new System.Drawing.Point(12, 218); + this.enablePluginLoggingCheckBox.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.enablePluginLoggingCheckBox.Location = new System.Drawing.Point(23, 212); this.enablePluginLoggingCheckBox.Name = "enablePluginLoggingCheckBox"; - this.enablePluginLoggingCheckBox.Size = new System.Drawing.Size(133, 23); + this.enablePluginLoggingCheckBox.Size = new System.Drawing.Size(135, 23); this.enablePluginLoggingCheckBox.TabIndex = 6; this.enablePluginLoggingCheckBox.Text = "Log Plugin Usage"; this.enablePluginLoggingCheckBox.UseVisualStyleBackColor = true; // // groupBoxSettings // + this.groupBoxSettings.Controls.Add(this.indicatorAutoInvoke); + this.groupBoxSettings.Controls.Add(this.indicatorMultiAgent); this.groupBoxSettings.Controls.Add(this.chkMultiAgentMode); this.groupBoxSettings.Controls.Add(this.chkAutoInvoke); this.groupBoxSettings.Controls.Add(this.chkRetainChatHistory); this.groupBoxSettings.Controls.Add(this.numTemperature); this.groupBoxSettings.Controls.Add(this.lblTemperature); - this.groupBoxSettings.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxSettings.Location = new System.Drawing.Point(12, 253); + this.groupBoxSettings.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBoxSettings.Location = new System.Drawing.Point(6, 6); this.groupBoxSettings.Name = "groupBoxSettings"; this.groupBoxSettings.Size = new System.Drawing.Size(436, 150); this.groupBoxSettings.TabIndex = 1; this.groupBoxSettings.TabStop = false; this.groupBoxSettings.Text = "AI Settings"; // + // indicatorAutoInvoke + // + this.indicatorAutoInvoke.BackColor = System.Drawing.Color.Transparent; + this.indicatorAutoInvoke.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorAutoInvoke.Location = new System.Drawing.Point(390, 59); + this.indicatorAutoInvoke.Name = "indicatorAutoInvoke"; + this.indicatorAutoInvoke.Size = new System.Drawing.Size(24, 24); + this.indicatorAutoInvoke.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorAutoInvoke.TabIndex = 12; + this.indicatorAutoInvoke.TabStop = false; + // + // indicatorMultiAgent + // + this.indicatorMultiAgent.BackColor = System.Drawing.Color.Transparent; + this.indicatorMultiAgent.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorMultiAgent.Location = new System.Drawing.Point(390, 117); + this.indicatorMultiAgent.Name = "indicatorMultiAgent"; + this.indicatorMultiAgent.Size = new System.Drawing.Size(24, 24); + this.indicatorMultiAgent.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorMultiAgent.TabIndex = 5; + this.indicatorMultiAgent.TabStop = false; + // // chkMultiAgentMode // this.chkMultiAgentMode.AutoSize = true; - this.chkMultiAgentMode.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkMultiAgentMode.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkMultiAgentMode.Location = new System.Drawing.Point(17, 117); this.chkMultiAgentMode.Name = "chkMultiAgentMode"; - this.chkMultiAgentMode.Size = new System.Drawing.Size(173, 23); + this.chkMultiAgentMode.Size = new System.Drawing.Size(187, 23); this.chkMultiAgentMode.TabIndex = 4; this.chkMultiAgentMode.Text = "Enable Multi-Agent Mode"; this.chkMultiAgentMode.UseVisualStyleBackColor = true; @@ -185,21 +352,22 @@ private void InitializeComponent() // chkAutoInvoke // this.chkAutoInvoke.AutoSize = true; - this.chkAutoInvoke.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkAutoInvoke.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkAutoInvoke.Location = new System.Drawing.Point(17, 59); this.chkAutoInvoke.Name = "chkAutoInvoke"; - this.chkAutoInvoke.Size = new System.Drawing.Size(415, 23); + this.chkAutoInvoke.Size = new System.Drawing.Size(385, 23); this.chkAutoInvoke.TabIndex = 2; this.chkAutoInvoke.Text = "Auto-Invoke Functions (Let AI execute tools automatically)"; this.chkAutoInvoke.UseVisualStyleBackColor = true; + this.chkAutoInvoke.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // // chkRetainChatHistory // this.chkRetainChatHistory.AutoSize = true; - this.chkRetainChatHistory.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkRetainChatHistory.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkRetainChatHistory.Location = new System.Drawing.Point(17, 88); this.chkRetainChatHistory.Name = "chkRetainChatHistory"; - this.chkRetainChatHistory.Size = new System.Drawing.Size(419, 23); + this.chkRetainChatHistory.Size = new System.Drawing.Size(392, 23); this.chkRetainChatHistory.TabIndex = 3; this.chkRetainChatHistory.Text = "Retain Chat History (Keep chat messages between sessions)"; this.chkRetainChatHistory.UseVisualStyleBackColor = true; @@ -207,7 +375,7 @@ private void InitializeComponent() // numTemperature // this.numTemperature.DecimalPlaces = 1; - this.numTemperature.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.numTemperature.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.numTemperature.Increment = new decimal(new int[] { 1, 0, @@ -220,7 +388,7 @@ private void InitializeComponent() 0, 0}); this.numTemperature.Name = "numTemperature"; - this.numTemperature.Size = new System.Drawing.Size(60, 26); + this.numTemperature.Size = new System.Drawing.Size(60, 25); this.numTemperature.TabIndex = 1; this.numTemperature.Value = new decimal(new int[] { 2, @@ -231,17 +399,17 @@ private void InitializeComponent() // lblTemperature // this.lblTemperature.AutoSize = true; - this.lblTemperature.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblTemperature.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblTemperature.Location = new System.Drawing.Point(14, 29); this.lblTemperature.Name = "lblTemperature"; - this.lblTemperature.Size = new System.Drawing.Size(192, 19); + this.lblTemperature.Size = new System.Drawing.Size(179, 19); this.lblTemperature.TabIndex = 0; this.lblTemperature.Text = "Temperature (Randomness):"; // // saveButton // - this.saveButton.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.saveButton.Location = new System.Drawing.Point(236, 725); + this.saveButton.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.saveButton.Location = new System.Drawing.Point(452, 450); this.saveButton.Name = "saveButton"; this.saveButton.Size = new System.Drawing.Size(98, 30); this.saveButton.TabIndex = 2; @@ -251,8 +419,8 @@ private void InitializeComponent() // // cancelButton // - this.cancelButton.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.cancelButton.Location = new System.Drawing.Point(340, 725); + this.cancelButton.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cancelButton.Location = new System.Drawing.Point(556, 450); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(98, 30); this.cancelButton.TabIndex = 3; @@ -260,64 +428,35 @@ private void InitializeComponent() this.cancelButton.UseVisualStyleBackColor = true; this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click_1); // - // groupBoxSystemPrompt - // - this.groupBoxSystemPrompt.Controls.Add(this.txtSystemPrompt); - this.groupBoxSystemPrompt.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxSystemPrompt.Location = new System.Drawing.Point(12, 571); - this.groupBoxSystemPrompt.Name = "groupBoxSystemPrompt"; - this.groupBoxSystemPrompt.Size = new System.Drawing.Size(436, 146); - this.groupBoxSystemPrompt.TabIndex = 4; - this.groupBoxSystemPrompt.TabStop = false; - this.groupBoxSystemPrompt.Text = "System Prompt"; - // - // txtSystemPrompt - // - this.txtSystemPrompt.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtSystemPrompt.Location = new System.Drawing.Point(17, 29); - this.txtSystemPrompt.Multiline = true; - this.txtSystemPrompt.Name = "txtSystemPrompt"; - this.txtSystemPrompt.Size = new System.Drawing.Size(402, 100); - this.txtSystemPrompt.TabIndex = 0; - // // groupBoxSpeechRecognition // + this.groupBoxSpeechRecognition.Controls.Add(this.indicatorSpeech); this.groupBoxSpeechRecognition.Controls.Add(this.comboSpeechLanguage); this.groupBoxSpeechRecognition.Controls.Add(this.lblSpeechLanguage); this.groupBoxSpeechRecognition.Controls.Add(this.chkEnableSpeechRecognition); - this.groupBoxSpeechRecognition.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxSpeechRecognition.Location = new System.Drawing.Point(12, 409); + this.groupBoxSpeechRecognition.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBoxSpeechRecognition.Location = new System.Drawing.Point(6, 6); this.groupBoxSpeechRecognition.Name = "groupBoxSpeechRecognition"; this.groupBoxSpeechRecognition.Size = new System.Drawing.Size(436, 92); this.groupBoxSpeechRecognition.TabIndex = 5; this.groupBoxSpeechRecognition.TabStop = false; this.groupBoxSpeechRecognition.Text = "Speech Recognition"; // - // chkEnableSpeechRecognition + // indicatorSpeech // - this.chkEnableSpeechRecognition.AutoSize = true; - this.chkEnableSpeechRecognition.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.chkEnableSpeechRecognition.Location = new System.Drawing.Point(17, 29); - this.chkEnableSpeechRecognition.Name = "chkEnableSpeechRecognition"; - this.chkEnableSpeechRecognition.Size = new System.Drawing.Size(192, 23); - this.chkEnableSpeechRecognition.TabIndex = 0; - this.chkEnableSpeechRecognition.Text = "Enable Speech Recognition"; - this.chkEnableSpeechRecognition.UseVisualStyleBackColor = true; - // - // lblSpeechLanguage - // - this.lblSpeechLanguage.AutoSize = true; - this.lblSpeechLanguage.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblSpeechLanguage.Location = new System.Drawing.Point(14, 59); - this.lblSpeechLanguage.Name = "lblSpeechLanguage"; - this.lblSpeechLanguage.Size = new System.Drawing.Size(160, 19); - this.lblSpeechLanguage.TabIndex = 1; - this.lblSpeechLanguage.Text = "Recognition Language:"; + this.indicatorSpeech.BackColor = System.Drawing.Color.Transparent; + this.indicatorSpeech.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorSpeech.Location = new System.Drawing.Point(390, 29); + this.indicatorSpeech.Name = "indicatorSpeech"; + this.indicatorSpeech.Size = new System.Drawing.Size(24, 24); + this.indicatorSpeech.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorSpeech.TabIndex = 13; + this.indicatorSpeech.TabStop = false; // // comboSpeechLanguage // this.comboSpeechLanguage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboSpeechLanguage.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.comboSpeechLanguage.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.comboSpeechLanguage.FormattingEnabled = true; this.comboSpeechLanguage.Items.AddRange(new object[] { "en-US", @@ -332,64 +471,483 @@ private void InitializeComponent() "ru-RU"}); this.comboSpeechLanguage.Location = new System.Drawing.Point(180, 56); this.comboSpeechLanguage.Name = "comboSpeechLanguage"; - this.comboSpeechLanguage.Size = new System.Drawing.Size(239, 27); + this.comboSpeechLanguage.Size = new System.Drawing.Size(239, 25); this.comboSpeechLanguage.TabIndex = 2; // + // lblSpeechLanguage + // + this.lblSpeechLanguage.AutoSize = true; + this.lblSpeechLanguage.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblSpeechLanguage.Location = new System.Drawing.Point(14, 59); + this.lblSpeechLanguage.Name = "lblSpeechLanguage"; + this.lblSpeechLanguage.Size = new System.Drawing.Size(148, 19); + this.lblSpeechLanguage.TabIndex = 1; + this.lblSpeechLanguage.Text = "Recognition Language:"; + // + // chkEnableSpeechRecognition + // + this.chkEnableSpeechRecognition.AutoSize = true; + this.chkEnableSpeechRecognition.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkEnableSpeechRecognition.Location = new System.Drawing.Point(17, 29); + this.chkEnableSpeechRecognition.Name = "chkEnableSpeechRecognition"; + this.chkEnableSpeechRecognition.Size = new System.Drawing.Size(191, 23); + this.chkEnableSpeechRecognition.TabIndex = 0; + this.chkEnableSpeechRecognition.Text = "Enable Speech Recognition"; + this.chkEnableSpeechRecognition.UseVisualStyleBackColor = true; + this.chkEnableSpeechRecognition.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); + // // groupBoxVoiceCommands // + this.groupBoxVoiceCommands.Controls.Add(this.indicatorVoiceCmd); this.groupBoxVoiceCommands.Controls.Add(this.txtVoiceCommandPhrase); this.groupBoxVoiceCommands.Controls.Add(this.lblVoiceCommandPhrase); this.groupBoxVoiceCommands.Controls.Add(this.chkEnableVoiceCommands); - this.groupBoxVoiceCommands.Font = new System.Drawing.Font("Comic Sans MS", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.groupBoxVoiceCommands.Location = new System.Drawing.Point(12, 507); + this.groupBoxVoiceCommands.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBoxVoiceCommands.Location = new System.Drawing.Point(6, 104); this.groupBoxVoiceCommands.Name = "groupBoxVoiceCommands"; this.groupBoxVoiceCommands.Size = new System.Drawing.Size(436, 88); this.groupBoxVoiceCommands.TabIndex = 6; this.groupBoxVoiceCommands.TabStop = false; this.groupBoxVoiceCommands.Text = "Voice Commands"; // + // indicatorVoiceCmd + // + this.indicatorVoiceCmd.BackColor = System.Drawing.Color.Transparent; + this.indicatorVoiceCmd.Font = new System.Drawing.Font("Segoe UI Symbol", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.indicatorVoiceCmd.Location = new System.Drawing.Point(390, 29); + this.indicatorVoiceCmd.Name = "indicatorVoiceCmd"; + this.indicatorVoiceCmd.Size = new System.Drawing.Size(24, 24); + this.indicatorVoiceCmd.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.indicatorVoiceCmd.TabIndex = 14; + this.indicatorVoiceCmd.TabStop = false; + // + // txtVoiceCommandPhrase + // + this.txtVoiceCommandPhrase.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtVoiceCommandPhrase.Location = new System.Drawing.Point(180, 56); + this.txtVoiceCommandPhrase.Name = "txtVoiceCommandPhrase"; + this.txtVoiceCommandPhrase.Size = new System.Drawing.Size(239, 25); + this.txtVoiceCommandPhrase.TabIndex = 2; + // + // lblVoiceCommandPhrase + // + this.lblVoiceCommandPhrase.AutoSize = true; + this.lblVoiceCommandPhrase.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblVoiceCommandPhrase.Location = new System.Drawing.Point(14, 59); + this.lblVoiceCommandPhrase.Name = "lblVoiceCommandPhrase"; + this.lblVoiceCommandPhrase.Size = new System.Drawing.Size(157, 19); + this.lblVoiceCommandPhrase.TabIndex = 1; + this.lblVoiceCommandPhrase.Text = "Voice Command Phrase:"; + // // chkEnableVoiceCommands // this.chkEnableVoiceCommands.AutoSize = true; - this.chkEnableVoiceCommands.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkEnableVoiceCommands.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.chkEnableVoiceCommands.Location = new System.Drawing.Point(17, 29); this.chkEnableVoiceCommands.Name = "chkEnableVoiceCommands"; - this.chkEnableVoiceCommands.Size = new System.Drawing.Size(173, 23); + this.chkEnableVoiceCommands.Size = new System.Drawing.Size(178, 23); this.chkEnableVoiceCommands.TabIndex = 0; this.chkEnableVoiceCommands.Text = "Enable Voice Commands"; this.chkEnableVoiceCommands.UseVisualStyleBackColor = true; + this.chkEnableVoiceCommands.CheckedChanged += new System.EventHandler(this.chkPluginStatus_CheckedChanged); // - // lblVoiceCommandPhrase + // tabControlMain // - this.lblVoiceCommandPhrase.AutoSize = true; - this.lblVoiceCommandPhrase.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblVoiceCommandPhrase.Location = new System.Drawing.Point(14, 59); - this.lblVoiceCommandPhrase.Name = "lblVoiceCommandPhrase"; - this.lblVoiceCommandPhrase.Size = new System.Drawing.Size(151, 19); - this.lblVoiceCommandPhrase.TabIndex = 1; - this.lblVoiceCommandPhrase.Text = "Voice Command Phrase:"; + this.tabControlMain.Controls.Add(this.tabPlugins); + this.tabControlMain.Controls.Add(this.tabAISettings); + this.tabControlMain.Controls.Add(this.tabVoice); + this.tabControlMain.Controls.Add(this.tabMultiAgent); + this.tabControlMain.Controls.Add(this.tabAppearance); + this.tabControlMain.Controls.Add(this.tabProfiles); + this.tabControlMain.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.tabControlMain.Location = new System.Drawing.Point(12, 45); + this.tabControlMain.Name = "tabControlMain"; + this.tabControlMain.SelectedIndex = 0; + this.tabControlMain.Size = new System.Drawing.Size(642, 393); + this.tabControlMain.TabIndex = 8; // - // txtVoiceCommandPhrase + // tabPlugins // - this.txtVoiceCommandPhrase.Font = new System.Drawing.Font("Comic Sans MS", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.txtVoiceCommandPhrase.Location = new System.Drawing.Point(180, 56); - this.txtVoiceCommandPhrase.Name = "txtVoiceCommandPhrase"; - this.txtVoiceCommandPhrase.Size = new System.Drawing.Size(239, 26); - this.txtVoiceCommandPhrase.TabIndex = 2; + this.tabPlugins.Controls.Add(this.groupBoxPlugins); + this.tabPlugins.Controls.Add(this.enablePluginLoggingCheckBox); + this.tabPlugins.Location = new System.Drawing.Point(4, 26); + this.tabPlugins.Name = "tabPlugins"; + this.tabPlugins.Padding = new System.Windows.Forms.Padding(3); + this.tabPlugins.Size = new System.Drawing.Size(634, 363); + this.tabPlugins.TabIndex = 0; + this.tabPlugins.Text = "Plugins"; + this.tabPlugins.UseVisualStyleBackColor = true; + // + // tabAISettings + // + this.tabAISettings.Controls.Add(this.groupBoxSettings); + this.tabAISettings.Location = new System.Drawing.Point(4, 26); + this.tabAISettings.Name = "tabAISettings"; + this.tabAISettings.Padding = new System.Windows.Forms.Padding(3); + this.tabAISettings.Size = new System.Drawing.Size(634, 363); + this.tabAISettings.TabIndex = 1; + this.tabAISettings.Text = "AI Settings"; + this.tabAISettings.UseVisualStyleBackColor = true; + // + // tabVoice + // + this.tabVoice.Controls.Add(this.groupBoxSpeechRecognition); + this.tabVoice.Controls.Add(this.groupBoxVoiceCommands); + this.tabVoice.Location = new System.Drawing.Point(4, 26); + this.tabVoice.Name = "tabVoice"; + this.tabVoice.Size = new System.Drawing.Size(634, 363); + this.tabVoice.TabIndex = 2; + this.tabVoice.Text = "Voice"; + this.tabVoice.UseVisualStyleBackColor = true; + // + // tabMultiAgent + // + this.tabMultiAgent.Controls.Add(this.grpMultiAgentConfig); + this.tabMultiAgent.Location = new System.Drawing.Point(4, 26); + this.tabMultiAgent.Name = "tabMultiAgent"; + this.tabMultiAgent.Size = new System.Drawing.Size(634, 363); + this.tabMultiAgent.TabIndex = 3; + this.tabMultiAgent.Text = "Multi-Agent"; + this.tabMultiAgent.UseVisualStyleBackColor = true; + // + // grpMultiAgentConfig + // + this.grpMultiAgentConfig.Controls.Add(this.lblPlannerPrompt); + this.grpMultiAgentConfig.Controls.Add(this.txtPlannerSystemPrompt); + this.grpMultiAgentConfig.Controls.Add(this.lblExecutorPrompt); + this.grpMultiAgentConfig.Controls.Add(this.txtExecutorSystemPrompt); + this.grpMultiAgentConfig.Controls.Add(this.chkUseCustomPlannerConfig); + this.grpMultiAgentConfig.Controls.Add(this.comboPlannerConfig); + this.grpMultiAgentConfig.Controls.Add(this.btnConfigurePlanner); + this.grpMultiAgentConfig.Controls.Add(this.chkUseCustomExecutorConfig); + this.grpMultiAgentConfig.Controls.Add(this.comboExecutorConfig); + this.grpMultiAgentConfig.Controls.Add(this.btnConfigureExecutor); + this.grpMultiAgentConfig.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.grpMultiAgentConfig.Location = new System.Drawing.Point(6, 6); + this.grpMultiAgentConfig.Name = "grpMultiAgentConfig"; + this.grpMultiAgentConfig.Size = new System.Drawing.Size(577, 381); + this.grpMultiAgentConfig.TabIndex = 15; + this.grpMultiAgentConfig.TabStop = false; + this.grpMultiAgentConfig.Text = "System Prompts Configuration"; + // + // lblPlannerPrompt + // + this.lblPlannerPrompt.AutoSize = true; + this.lblPlannerPrompt.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblPlannerPrompt.Location = new System.Drawing.Point(8, 24); + this.lblPlannerPrompt.Name = "lblPlannerPrompt"; + this.lblPlannerPrompt.Size = new System.Drawing.Size(156, 19); + this.lblPlannerPrompt.TabIndex = 16; + this.lblPlannerPrompt.Text = "Planner System Prompt:"; + // + // txtPlannerSystemPrompt + // + this.txtPlannerSystemPrompt.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtPlannerSystemPrompt.Location = new System.Drawing.Point(8, 40); + this.txtPlannerSystemPrompt.Multiline = true; + this.txtPlannerSystemPrompt.Name = "txtPlannerSystemPrompt"; + this.txtPlannerSystemPrompt.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtPlannerSystemPrompt.Size = new System.Drawing.Size(555, 100); + this.txtPlannerSystemPrompt.TabIndex = 17; + // + // lblExecutorPrompt + // + this.lblExecutorPrompt.AutoSize = true; + this.lblExecutorPrompt.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblExecutorPrompt.Location = new System.Drawing.Point(8, 150); + this.lblExecutorPrompt.Name = "lblExecutorPrompt"; + this.lblExecutorPrompt.Size = new System.Drawing.Size(477, 19); + this.lblExecutorPrompt.TabIndex = 18; + this.lblExecutorPrompt.Text = "Executor System Prompt (also used as system prompt in single agent mode):"; + // + // txtExecutorSystemPrompt + // + this.txtExecutorSystemPrompt.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtExecutorSystemPrompt.Location = new System.Drawing.Point(8, 166); + this.txtExecutorSystemPrompt.Multiline = true; + this.txtExecutorSystemPrompt.Name = "txtExecutorSystemPrompt"; + this.txtExecutorSystemPrompt.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtExecutorSystemPrompt.Size = new System.Drawing.Size(555, 100); + this.txtExecutorSystemPrompt.TabIndex = 19; + // + // chkUseCustomPlannerConfig + // + this.chkUseCustomPlannerConfig.AutoSize = true; + this.chkUseCustomPlannerConfig.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkUseCustomPlannerConfig.Location = new System.Drawing.Point(8, 284); + this.chkUseCustomPlannerConfig.Name = "chkUseCustomPlannerConfig"; + this.chkUseCustomPlannerConfig.Size = new System.Drawing.Size(240, 23); + this.chkUseCustomPlannerConfig.TabIndex = 20; + this.chkUseCustomPlannerConfig.Text = "Use Custom Planner Model Config"; + this.chkUseCustomPlannerConfig.UseVisualStyleBackColor = true; + this.chkUseCustomPlannerConfig.CheckedChanged += new System.EventHandler(this.chkUseCustomPlannerConfig_CheckedChanged); + // + // comboPlannerConfig + // + this.comboPlannerConfig.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboPlannerConfig.Enabled = false; + this.comboPlannerConfig.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.comboPlannerConfig.FormattingEnabled = true; + this.comboPlannerConfig.Location = new System.Drawing.Point(256, 280); + this.comboPlannerConfig.Name = "comboPlannerConfig"; + this.comboPlannerConfig.Size = new System.Drawing.Size(200, 25); + this.comboPlannerConfig.TabIndex = 21; + // + // btnConfigurePlanner + // + this.btnConfigurePlanner.Enabled = false; + this.btnConfigurePlanner.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnConfigurePlanner.Location = new System.Drawing.Point(463, 277); + this.btnConfigurePlanner.Name = "btnConfigurePlanner"; + this.btnConfigurePlanner.Size = new System.Drawing.Size(100, 30); + this.btnConfigurePlanner.TabIndex = 22; + this.btnConfigurePlanner.Text = "Configure"; + this.btnConfigurePlanner.UseVisualStyleBackColor = true; + this.btnConfigurePlanner.Click += new System.EventHandler(this.btnConfigurePlanner_Click); + // + // chkUseCustomExecutorConfig + // + this.chkUseCustomExecutorConfig.AutoSize = true; + this.chkUseCustomExecutorConfig.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.chkUseCustomExecutorConfig.Location = new System.Drawing.Point(6, 315); + this.chkUseCustomExecutorConfig.Name = "chkUseCustomExecutorConfig"; + this.chkUseCustomExecutorConfig.Size = new System.Drawing.Size(246, 23); + this.chkUseCustomExecutorConfig.TabIndex = 23; + this.chkUseCustomExecutorConfig.Text = "Use Custom Executor Model Config"; + this.chkUseCustomExecutorConfig.UseVisualStyleBackColor = true; + this.chkUseCustomExecutorConfig.CheckedChanged += new System.EventHandler(this.chkUseCustomExecutorConfig_CheckedChanged); + // + // comboExecutorConfig + // + this.comboExecutorConfig.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboExecutorConfig.Enabled = false; + this.comboExecutorConfig.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.comboExecutorConfig.FormattingEnabled = true; + this.comboExecutorConfig.Location = new System.Drawing.Point(257, 315); + this.comboExecutorConfig.Name = "comboExecutorConfig"; + this.comboExecutorConfig.Size = new System.Drawing.Size(200, 25); + this.comboExecutorConfig.TabIndex = 24; + // + // btnConfigureExecutor + // + this.btnConfigureExecutor.Enabled = false; + this.btnConfigureExecutor.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnConfigureExecutor.Location = new System.Drawing.Point(463, 313); + this.btnConfigureExecutor.Name = "btnConfigureExecutor"; + this.btnConfigureExecutor.Size = new System.Drawing.Size(100, 30); + this.btnConfigureExecutor.TabIndex = 25; + this.btnConfigureExecutor.Text = "Configure"; + this.btnConfigureExecutor.UseVisualStyleBackColor = true; + this.btnConfigureExecutor.Click += new System.EventHandler(this.btnConfigureExecutor_Click); + // + // tabAppearance + // + this.tabAppearance.Controls.Add(this.groupBoxTheme); + this.tabAppearance.Location = new System.Drawing.Point(4, 26); + this.tabAppearance.Name = "tabAppearance"; + this.tabAppearance.Size = new System.Drawing.Size(634, 363); + this.tabAppearance.TabIndex = 4; + this.tabAppearance.Text = "Appearance"; + this.tabAppearance.UseVisualStyleBackColor = true; + // + // groupBoxTheme + // + this.groupBoxTheme.Controls.Add(this.labelTheme); + this.groupBoxTheme.Controls.Add(this.cbTheme); + this.groupBoxTheme.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBoxTheme.Location = new System.Drawing.Point(6, 6); + this.groupBoxTheme.Name = "groupBoxTheme"; + this.groupBoxTheme.Size = new System.Drawing.Size(436, 75); + this.groupBoxTheme.TabIndex = 0; + this.groupBoxTheme.TabStop = false; + this.groupBoxTheme.Text = "Theme Settings"; + // + // labelTheme + // + this.labelTheme.AutoSize = true; + this.labelTheme.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelTheme.Location = new System.Drawing.Point(14, 34); + this.labelTheme.Name = "labelTheme"; + this.labelTheme.Size = new System.Drawing.Size(104, 19); + this.labelTheme.TabIndex = 1; + this.labelTheme.Text = "Current Theme:"; + // + // cbTheme + // + this.cbTheme.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbTheme.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cbTheme.FormattingEnabled = true; + this.cbTheme.Items.AddRange(new object[] { + "Light", + "Dark"}); + this.cbTheme.Location = new System.Drawing.Point(122, 31); + this.cbTheme.Name = "cbTheme"; + this.cbTheme.Size = new System.Drawing.Size(150, 25); + this.cbTheme.TabIndex = 0; + this.cbTheme.SelectedIndexChanged += new System.EventHandler(this.cbTheme_SelectedIndexChanged); + // + // tabProfiles + // + this.tabProfiles.Controls.Add(this.groupBoxProfiles); + this.tabProfiles.Location = new System.Drawing.Point(4, 26); + this.tabProfiles.Name = "tabProfiles"; + this.tabProfiles.Size = new System.Drawing.Size(634, 363); + this.tabProfiles.TabIndex = 5; + this.tabProfiles.Text = "Profiles"; + this.tabProfiles.UseVisualStyleBackColor = true; + // + // groupBoxProfiles + // + this.groupBoxProfiles.Controls.Add(this.btnDeleteProfile); + this.groupBoxProfiles.Controls.Add(this.btnLoadProfile); + this.groupBoxProfiles.Controls.Add(this.btnSaveProfile); + this.groupBoxProfiles.Controls.Add(this.labelProfile); + this.groupBoxProfiles.Controls.Add(this.cmbProfiles); + this.groupBoxProfiles.Font = new System.Drawing.Font("Segoe UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.groupBoxProfiles.Location = new System.Drawing.Point(6, 6); + this.groupBoxProfiles.Name = "groupBoxProfiles"; + this.groupBoxProfiles.Size = new System.Drawing.Size(436, 136); + this.groupBoxProfiles.TabIndex = 0; + this.groupBoxProfiles.TabStop = false; + this.groupBoxProfiles.Text = "Configuration Profiles"; + // + // btnDeleteProfile + // + this.btnDeleteProfile.Font = new System.Drawing.Font("Segoe UI", 10F); + this.btnDeleteProfile.Location = new System.Drawing.Point(297, 92); + this.btnDeleteProfile.Name = "btnDeleteProfile"; + this.btnDeleteProfile.Size = new System.Drawing.Size(121, 30); + this.btnDeleteProfile.TabIndex = 4; + this.btnDeleteProfile.Text = "Delete Profile"; + this.btnDeleteProfile.UseVisualStyleBackColor = true; + this.btnDeleteProfile.Click += new System.EventHandler(this.btnDeleteProfile_Click); + // + // btnLoadProfile + // + this.btnLoadProfile.Font = new System.Drawing.Font("Segoe UI", 10F); + this.btnLoadProfile.Location = new System.Drawing.Point(156, 92); + this.btnLoadProfile.Name = "btnLoadProfile"; + this.btnLoadProfile.Size = new System.Drawing.Size(121, 30); + this.btnLoadProfile.TabIndex = 3; + this.btnLoadProfile.Text = "Load Profile"; + this.btnLoadProfile.UseVisualStyleBackColor = true; + this.btnLoadProfile.Click += new System.EventHandler(this.btnLoadProfile_Click); + // + // btnSaveProfile + // + this.btnSaveProfile.Font = new System.Drawing.Font("Segoe UI", 10F); + this.btnSaveProfile.Location = new System.Drawing.Point(17, 92); + this.btnSaveProfile.Name = "btnSaveProfile"; + this.btnSaveProfile.Size = new System.Drawing.Size(121, 30); + this.btnSaveProfile.TabIndex = 2; + this.btnSaveProfile.Text = "Save As New..."; + this.btnSaveProfile.UseVisualStyleBackColor = true; + this.btnSaveProfile.Click += new System.EventHandler(this.btnSaveProfile_Click); + // + // labelProfile + // + this.labelProfile.AutoSize = true; + this.labelProfile.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelProfile.Location = new System.Drawing.Point(14, 44); + this.labelProfile.Name = "labelProfile"; + this.labelProfile.Size = new System.Drawing.Size(89, 19); + this.labelProfile.TabIndex = 1; + this.labelProfile.Text = "Select Profile:"; + // + // cmbProfiles + // + this.cmbProfiles.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cmbProfiles.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.cmbProfiles.FormattingEnabled = true; + this.cmbProfiles.Location = new System.Drawing.Point(122, 41); + this.cmbProfiles.Name = "cmbProfiles"; + this.cmbProfiles.Size = new System.Drawing.Size(296, 25); + this.cmbProfiles.TabIndex = 0; + // + // imageListStatus + // + this.imageListStatus.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this.imageListStatus.ImageSize = new System.Drawing.Size(16, 16); + this.imageListStatus.TransparentColor = System.Drawing.Color.Transparent; + // + // panelSearch + // + this.panelSearch.Controls.Add(this.searchResultLabel); + this.panelSearch.Controls.Add(this.txtSearchSettings); + this.panelSearch.Controls.Add(this.lblSearchSettings); + this.panelSearch.Location = new System.Drawing.Point(12, 8); + this.panelSearch.Name = "panelSearch"; + this.panelSearch.Size = new System.Drawing.Size(642, 31); + this.panelSearch.TabIndex = 9; + // + // searchResultLabel + // + this.searchResultLabel.AutoSize = true; + this.searchResultLabel.Font = new System.Drawing.Font("Segoe UI", 9F); + this.searchResultLabel.ForeColor = System.Drawing.Color.RoyalBlue; + this.searchResultLabel.Location = new System.Drawing.Point(460, 8); + this.searchResultLabel.Name = "searchResultLabel"; + this.searchResultLabel.Size = new System.Drawing.Size(0, 15); + this.searchResultLabel.TabIndex = 2; + this.searchResultLabel.Visible = false; + // + // txtSearchSettings + // + this.txtSearchSettings.Font = new System.Drawing.Font("Segoe UI", 10F); + this.txtSearchSettings.Location = new System.Drawing.Point(83, 3); + this.txtSearchSettings.Name = "txtSearchSettings"; + this.txtSearchSettings.Size = new System.Drawing.Size(365, 25); + this.txtSearchSettings.TabIndex = 1; + this.txtSearchSettings.TextChanged += new System.EventHandler(this.txtSearchSettings_TextChanged); + // + // lblSearchSettings + // + this.lblSearchSettings.AutoSize = true; + this.lblSearchSettings.Font = new System.Drawing.Font("Segoe UI", 10F); + this.lblSearchSettings.Location = new System.Drawing.Point(3, 6); + this.lblSearchSettings.Name = "lblSearchSettings"; + this.lblSearchSettings.Size = new System.Drawing.Size(73, 19); + this.lblSearchSettings.TabIndex = 0; + this.lblSearchSettings.Text = "Search for:"; + // + // saveNotification + // + this.saveNotification.BackColor = System.Drawing.Color.LightGreen; + this.saveNotification.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.saveNotification.Controls.Add(this.lblSaveNotification); + this.saveNotification.Location = new System.Drawing.Point(254, 390); + this.saveNotification.Name = "saveNotification"; + this.saveNotification.Size = new System.Drawing.Size(250, 45); + this.saveNotification.TabIndex = 10; + this.saveNotification.Visible = false; + // + // lblSaveNotification + // + this.lblSaveNotification.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblSaveNotification.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblSaveNotification.ForeColor = System.Drawing.Color.DarkGreen; + this.lblSaveNotification.Location = new System.Drawing.Point(0, 0); + this.lblSaveNotification.Name = "lblSaveNotification"; + this.lblSaveNotification.Size = new System.Drawing.Size(248, 43); + this.lblSaveNotification.TabIndex = 0; + this.lblSaveNotification.Text = "βœ“ Settings saved successfully!"; + this.lblSaveNotification.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // saveNotificationTimer + // + this.saveNotificationTimer.Interval = 3000; + this.saveNotificationTimer.Tick += new System.EventHandler(this.saveNotificationTimer_Tick); // // ToolConfigForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(450, 766); - this.Controls.Add(this.enablePluginLoggingCheckBox); - this.Controls.Add(this.groupBoxVoiceCommands); - this.Controls.Add(this.groupBoxSpeechRecognition); - this.Controls.Add(this.groupBoxSystemPrompt); - this.Controls.Add(this.cancelButton); + this.ClientSize = new System.Drawing.Size(668, 497); + this.Controls.Add(this.tabControlMain); + this.Controls.Add(this.panelSearch); + this.Controls.Add(this.saveNotification); this.Controls.Add(this.saveButton); - this.Controls.Add(this.groupBoxSettings); - this.Controls.Add(this.groupBoxPlugins); + this.Controls.Add(this.cancelButton); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ToolConfigForm"; @@ -398,30 +956,63 @@ private void InitializeComponent() this.Text = "Tool Configuration"; this.groupBoxPlugins.ResumeLayout(false); this.groupBoxPlugins.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorWindow)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorMouse)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorKeyboard)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorScreenCapture)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorPowerShell)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorCMD)).EndInit(); this.groupBoxSettings.ResumeLayout(false); this.groupBoxSettings.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorAutoInvoke)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorMultiAgent)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numTemperature)).EndInit(); - this.groupBoxSystemPrompt.ResumeLayout(false); - this.groupBoxSystemPrompt.PerformLayout(); this.groupBoxSpeechRecognition.ResumeLayout(false); this.groupBoxSpeechRecognition.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorSpeech)).EndInit(); this.groupBoxVoiceCommands.ResumeLayout(false); this.groupBoxVoiceCommands.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.indicatorVoiceCmd)).EndInit(); + this.tabControlMain.ResumeLayout(false); + this.tabPlugins.ResumeLayout(false); + this.tabPlugins.PerformLayout(); + this.tabAISettings.ResumeLayout(false); + this.tabVoice.ResumeLayout(false); + this.tabMultiAgent.ResumeLayout(false); + this.grpMultiAgentConfig.ResumeLayout(false); + this.grpMultiAgentConfig.PerformLayout(); + this.tabAppearance.ResumeLayout(false); + this.groupBoxTheme.ResumeLayout(false); + this.groupBoxTheme.PerformLayout(); + this.tabProfiles.ResumeLayout(false); + this.groupBoxProfiles.ResumeLayout(false); + this.groupBoxProfiles.PerformLayout(); + this.panelSearch.ResumeLayout(false); + this.panelSearch.PerformLayout(); + this.saveNotification.ResumeLayout(false); this.ResumeLayout(false); - this.PerformLayout(); } #endregion private System.Windows.Forms.GroupBox groupBoxPlugins; + private System.Windows.Forms.PictureBox indicatorWindow; + private System.Windows.Forms.PictureBox indicatorMouse; + private System.Windows.Forms.PictureBox indicatorKeyboard; + private System.Windows.Forms.PictureBox indicatorScreenCapture; + private System.Windows.Forms.PictureBox indicatorPowerShell; + private System.Windows.Forms.PictureBox indicatorCMD; private System.Windows.Forms.CheckBox chkMousePlugin; private System.Windows.Forms.CheckBox chkKeyboardPlugin; private System.Windows.Forms.CheckBox chkScreenCapturePlugin; private System.Windows.Forms.CheckBox chkPowerShellPlugin; private System.Windows.Forms.CheckBox chkCMDPlugin; private System.Windows.Forms.CheckBox chkWindowSelectionPlugin; + private System.Windows.Forms.CheckBox enablePluginLoggingCheckBox; private System.Windows.Forms.GroupBox groupBoxSettings; + private System.Windows.Forms.PictureBox indicatorAutoInvoke; + private System.Windows.Forms.PictureBox indicatorMultiAgent; private System.Windows.Forms.NumericUpDown numTemperature; private System.Windows.Forms.Label lblTemperature; private System.Windows.Forms.CheckBox chkAutoInvoke; @@ -429,16 +1020,50 @@ private void InitializeComponent() private System.Windows.Forms.CheckBox chkMultiAgentMode; private System.Windows.Forms.Button saveButton; private System.Windows.Forms.Button cancelButton; - private System.Windows.Forms.GroupBox groupBoxSystemPrompt; - private System.Windows.Forms.TextBox txtSystemPrompt; - private System.Windows.Forms.CheckBox enablePluginLoggingCheckBox; private System.Windows.Forms.GroupBox groupBoxSpeechRecognition; + private System.Windows.Forms.PictureBox indicatorSpeech; private System.Windows.Forms.CheckBox chkEnableSpeechRecognition; private System.Windows.Forms.Label lblSpeechLanguage; private System.Windows.Forms.ComboBox comboSpeechLanguage; private System.Windows.Forms.GroupBox groupBoxVoiceCommands; + private System.Windows.Forms.PictureBox indicatorVoiceCmd; private System.Windows.Forms.CheckBox chkEnableVoiceCommands; private System.Windows.Forms.Label lblVoiceCommandPhrase; private System.Windows.Forms.TextBox txtVoiceCommandPhrase; + private System.Windows.Forms.TabControl tabControlMain; + private System.Windows.Forms.TabPage tabPlugins; + private System.Windows.Forms.TabPage tabAISettings; + private System.Windows.Forms.TabPage tabVoice; + private System.Windows.Forms.TabPage tabMultiAgent; + private System.Windows.Forms.GroupBox grpMultiAgentConfig; + private System.Windows.Forms.Label lblPlannerPrompt; + private System.Windows.Forms.TextBox txtPlannerSystemPrompt; + private System.Windows.Forms.Label lblExecutorPrompt; + private System.Windows.Forms.TextBox txtExecutorSystemPrompt; + private System.Windows.Forms.CheckBox chkUseCustomPlannerConfig; + private System.Windows.Forms.ComboBox comboPlannerConfig; + private System.Windows.Forms.Button btnConfigurePlanner; + private System.Windows.Forms.CheckBox chkUseCustomExecutorConfig; + private System.Windows.Forms.ComboBox comboExecutorConfig; + private System.Windows.Forms.Button btnConfigureExecutor; + private System.Windows.Forms.TabPage tabAppearance; + private System.Windows.Forms.GroupBox groupBoxTheme; + private System.Windows.Forms.Label labelTheme; + private System.Windows.Forms.ComboBox cbTheme; + private System.Windows.Forms.TabPage tabProfiles; + private System.Windows.Forms.GroupBox groupBoxProfiles; + private System.Windows.Forms.Button btnDeleteProfile; + private System.Windows.Forms.Button btnLoadProfile; + private System.Windows.Forms.Button btnSaveProfile; + private System.Windows.Forms.Label labelProfile; + private System.Windows.Forms.ComboBox cmbProfiles; + private System.Windows.Forms.ImageList imageListStatus; + private System.Windows.Forms.Panel panelSearch; + private System.Windows.Forms.Label searchResultLabel; + private System.Windows.Forms.TextBox txtSearchSettings; + private System.Windows.Forms.Label lblSearchSettings; + private System.Windows.Forms.Panel saveNotification; + private System.Windows.Forms.Label lblSaveNotification; + private System.Windows.Forms.Timer saveNotificationTimer; } } \ No newline at end of file diff --git a/FlowVision/ToolConfigForm.cs b/FlowVision/ToolConfigForm.cs index 4de0249..168d1b0 100644 --- a/FlowVision/ToolConfigForm.cs +++ b/FlowVision/ToolConfigForm.cs @@ -10,6 +10,7 @@ using System.Threading.Tasks; using System.Windows.Forms; using FlowVision.lib.Classes; +using FlowVision.lib.UI; namespace FlowVision { @@ -18,17 +19,48 @@ public partial class ToolConfigForm : Form private string toolFileName = "toolsconfig"; private ToolConfig _toolConfig; private bool _isNewConfiguration = false; + private ThemeManager _themeManager; + private SettingsProfileManager _profileManager; + private ToolTip _formToolTip; public ToolConfigForm(bool openAsNew = false) { InitializeComponent(); _isNewConfiguration = openAsNew; + // Initialize theme manager + _themeManager = new ThemeManager(); + + // Initialize profile manager + _profileManager = new SettingsProfileManager(); + + // Initialize tooltip + InitializeToolTips(); + + // Populate theme options + cbTheme.Items.Clear(); + cbTheme.Items.Add("Light"); + cbTheme.Items.Add("Dark"); + // Populate speech recognition language options PopulateSpeechLanguages(); + // Populate available API configuration files + PopulateAPIConfigurations(); + + // Populate configuration profiles + PopulateConfigurationProfiles(); + LoadToolConfig(); + // Apply current theme + ApplyTheme(_themeManager.CurrentTheme); + + // Make sure the executor prompt is always editable by forcing the tab to be enabled + tabMultiAgent.Enabled = true; + txtExecutorSystemPrompt.Enabled = true; + lblExecutorPrompt.Enabled = true; + // If this is a new configuration being opened automatically, // show a helpful message to the user if (_isNewConfiguration) @@ -42,87 +74,366 @@ public ToolConfigForm(bool openAsNew = false) } } - private void PopulateSpeechLanguages() + private void InitializeToolTips() + { + _formToolTip = new ToolTip + { + AutoPopDelay = 5000, + InitialDelay = 1000, + ReshowDelay = 500, + ShowAlways = true + }; + + // Define tooltips in a dictionary for easier management + var tooltips = new Dictionary + { + { chkCMDPlugin, "Enable command prompt access for the AI assistant" }, + { chkPowerShellPlugin, "Enable PowerShell script execution for the AI assistant" }, + { chkScreenCapturePlugin, "Allow the AI assistant to capture screenshots" }, + { chkKeyboardPlugin, "Allow the AI assistant to control keyboard input" }, + { chkMousePlugin, "Allow the AI assistant to control mouse movements" }, + { chkWindowSelectionPlugin, "Allow the AI assistant to interact with specific windows" }, + { enablePluginLoggingCheckBox, "Record all plugin activities for troubleshooting" }, + { numTemperature, "Controls AI randomness: Higher values = more creative, lower values = more deterministic" }, + { chkMultiAgentMode, "Enable planner and executor agent mode for complex tasks" }, + { chkAutoInvoke, "Allow AI to automatically execute tools without confirmation" }, + { chkRetainChatHistory, "Save conversation history between sessions" }, + { chkEnableSpeechRecognition, "Enable voice input recognition" }, + { comboSpeechLanguage, "Select language for speech recognition" }, + { chkEnableVoiceCommands, "Enable voice command activation" }, + { txtVoiceCommandPhrase, "Phrase to activate voice commands (e.g. 'Hey Assistant')" }, + { cbTheme, "Choose light or dark theme for the interface" }, + { cmbProfiles, "Load or save different configuration profiles" } + }; + + foreach (var kvp in tooltips) + { + _formToolTip.SetToolTip(kvp.Key, kvp.Value); + } + } + + private void PopulateConfigurationProfiles() + { + var profiles = _profileManager.GetAvailableProfiles(); + cmbProfiles.Items.Clear(); + foreach (var profile in profiles) + { + cmbProfiles.Items.Add(profile); + } + + if (cmbProfiles.Items.Count > 0) + { + cmbProfiles.SelectedIndex = 0; + } + } + + private void ApplyTheme(string themeName) + { + if (themeName == "Dark") + { + ApplyDarkTheme(); + } + else + { + ApplyLightTheme(); + } + } + + private void ApplyLightTheme() + { + // Set light theme colors + this.BackColor = Color.White; + this.ForeColor = Color.Black; + + // Apply to all tab pages + foreach (TabPage tab in tabControlMain.TabPages) + { + tab.BackColor = Color.White; + tab.ForeColor = Color.Black; + } + + // Apply to group boxes + foreach (Control control in this.Controls) + { + if (control is GroupBox) + { + control.BackColor = Color.White; + control.ForeColor = Color.Black; + } + } + + // Update status indicator + UpdateStatusIndicators(); + } + + private void ApplyDarkTheme() + { + // Set dark theme colors + this.BackColor = Color.FromArgb(45, 45, 48); + this.ForeColor = Color.White; + + // Apply to all tab pages + foreach (TabPage tab in tabControlMain.TabPages) + { + tab.BackColor = Color.FromArgb(45, 45, 48); + tab.ForeColor = Color.White; + } + + // Apply to group boxes + foreach (Control control in this.Controls) + { + if (control is GroupBox) + { + control.BackColor = Color.FromArgb(45, 45, 48); + control.ForeColor = Color.White; + } + } + + // Update status indicator + UpdateStatusIndicators(); + } + + private void PopulateAPIConfigurations() { - // Try to get installed recognizers if possible try { - comboSpeechLanguage.Items.Clear(); + string configDir = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "FlowVision", "Config"); - foreach (var recognizerInfo in SpeechRecognitionEngine.InstalledRecognizers()) + if (!Directory.Exists(configDir)) { - comboSpeechLanguage.Items.Add(recognizerInfo.Culture.Name); + Directory.CreateDirectory(configDir); + } + + string[] configFiles = Directory.GetFiles(configDir, "*.json"); + var configNames = configFiles.Select(Path.GetFileNameWithoutExtension).ToList(); + + if (!configNames.Contains("actioner")) configNames.Add("actioner"); + if (!configNames.Contains("planner")) configNames.Add("planner"); + if (!configNames.Contains("executor")) configNames.Add("executor"); + + comboPlannerConfig.Items.Clear(); + comboExecutorConfig.Items.Clear(); + + foreach (var name in configNames) + { + comboPlannerConfig.Items.Add(name); + comboExecutorConfig.Items.Add(name); + } + + if (comboPlannerConfig.Items.Count > 0) + { + comboPlannerConfig.SelectedItem = comboPlannerConfig.Items.Contains("planner") ? + "planner" : comboPlannerConfig.Items[0]; } + + if (comboExecutorConfig.Items.Count > 0) + { + comboExecutorConfig.SelectedItem = comboExecutorConfig.Items.Contains("executor") ? + "executor" : comboExecutorConfig.Items[0]; + } + } + catch (Exception ex) + { + MessageBox.Show($"Error populating API configurations: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } - // If no recognizers found, use the default items - if (comboSpeechLanguage.Items.Count == 0) + private void PopulateSpeechLanguages() + { + comboSpeechLanguage.Items.Clear(); + + try + { + foreach (var recognizerInfo in SpeechRecognitionEngine.InstalledRecognizers()) { - comboSpeechLanguage.Items.AddRange(new object[] { - "en-US", - "en-GB", - "en-AU", - "fr-FR", - "es-ES", - "de-DE" - }); + comboSpeechLanguage.Items.Add(recognizerInfo.Culture.Name); } } catch (Exception ex) { - // Fall back to default items if there's an error - Console.WriteLine($"Error populating speech recognizers: {ex.Message}"); + Console.WriteLine($"Error getting speech recognizers: {ex.Message}"); + } + + // If no recognizers found or an error occurred, add default items + if (comboSpeechLanguage.Items.Count == 0) + { + comboSpeechLanguage.Items.AddRange(new object[] { + "en-US", + "en-GB", + "en-AU", + "fr-FR", + "es-ES", + "de-DE" + }); + } + + // Select the first item if none is selected + if (comboSpeechLanguage.SelectedIndex == -1 && comboSpeechLanguage.Items.Count > 0) + { + comboSpeechLanguage.SelectedIndex = 0; } } private void LoadToolConfig() { - // Check if config file exists - string configPath = ToolConfig.ConfigFilePath(toolFileName); - bool configExists = File.Exists(configPath); + try + { + string configPath = ToolConfig.ConfigFilePath(toolFileName); + bool configExists = File.Exists(configPath); + + _toolConfig = ToolConfig.LoadConfig(toolFileName) ?? new ToolConfig(); + + // Safely update UI elements + chkCMDPlugin.Checked = _toolConfig.EnableCMDPlugin; + chkPowerShellPlugin.Checked = _toolConfig.EnablePowerShellPlugin; + chkScreenCapturePlugin.Checked = _toolConfig.EnableScreenCapturePlugin; + chkKeyboardPlugin.Checked = _toolConfig.EnableKeyboardPlugin; + chkMousePlugin.Checked = _toolConfig.EnableMousePlugin; + chkWindowSelectionPlugin.Checked = _toolConfig.EnableWindowSelectionPlugin; + enablePluginLoggingCheckBox.Checked = _toolConfig.EnablePluginLogging; - _toolConfig = ToolConfig.LoadConfig(toolFileName); + numTemperature.Value = (decimal)_toolConfig.Temperature; + chkAutoInvoke.Checked = _toolConfig.AutoInvokeKernelFunctions; + chkRetainChatHistory.Checked = _toolConfig.RetainChatHistory; + chkMultiAgentMode.Checked = _toolConfig.EnableMultiAgentMode; + chkEnableSpeechRecognition.Checked = _toolConfig.EnableSpeechRecognition; + chkEnableVoiceCommands.Checked = _toolConfig.EnableVoiceCommands; + txtVoiceCommandPhrase.Text = _toolConfig.VoiceCommandPhrase; - // Existing plugins configuration - chkCMDPlugin.Checked = _toolConfig.EnableCMDPlugin; - chkPowerShellPlugin.Checked = _toolConfig.EnablePowerShellPlugin; - chkScreenCapturePlugin.Checked = _toolConfig.EnableScreenCapturePlugin; - chkKeyboardPlugin.Checked = _toolConfig.EnableKeyboardPlugin; - chkMousePlugin.Checked = _toolConfig.EnableMousePlugin; - chkWindowSelectionPlugin.Checked = _toolConfig.EnableWindowSelectionPlugin; - enablePluginLoggingCheckBox.Checked = _toolConfig.EnablePluginLogging; + // Check if the item exists in the combo box before setting it + if (comboSpeechLanguage.Items.Contains(_toolConfig.SpeechRecognitionLanguage)) + { + comboSpeechLanguage.SelectedItem = _toolConfig.SpeechRecognitionLanguage; + } + else if (comboSpeechLanguage.Items.Count > 0) + { + comboSpeechLanguage.SelectedIndex = 0; + } - // AI settings - numTemperature.Value = (decimal)_toolConfig.Temperature; - chkAutoInvoke.Checked = _toolConfig.AutoInvokeKernelFunctions; - chkRetainChatHistory.Checked = _toolConfig.RetainChatHistory; - txtSystemPrompt.Text = _toolConfig.SystemPrompt; + txtPlannerSystemPrompt.Text = _toolConfig.PlannerSystemPrompt; + txtExecutorSystemPrompt.Text = _toolConfig.ExecutorSystemPrompt; + chkUseCustomPlannerConfig.Checked = _toolConfig.UseCustomPlannerConfig; + chkUseCustomExecutorConfig.Checked = _toolConfig.UseCustomExecutorConfig; + + // Check if the item exists in the combo box before setting it + if (comboPlannerConfig.Items.Contains(_toolConfig.PlannerConfigName)) + { + comboPlannerConfig.SelectedItem = _toolConfig.PlannerConfigName; + } + else if (comboPlannerConfig.Items.Count > 0) + { + comboPlannerConfig.SelectedIndex = 0; + } - // Add multi-agent mode setting - chkMultiAgentMode.Checked = _toolConfig.EnableMultiAgentMode; + if (comboExecutorConfig.Items.Contains(_toolConfig.ExecutorConfigName)) + { + comboExecutorConfig.SelectedItem = _toolConfig.ExecutorConfigName; + } + else if (comboExecutorConfig.Items.Count > 0) + { + comboExecutorConfig.SelectedIndex = 0; + } - // Speech recognition settings - chkEnableSpeechRecognition.Checked = _toolConfig.EnableSpeechRecognition; + // Set the theme in the combo box + if (cbTheme.Items.Contains(_toolConfig.ThemeName)) + { + cbTheme.SelectedItem = _toolConfig.ThemeName; + } + else + { + cbTheme.SelectedIndex = 0; // Default to the first item + } - // Voice command settings - chkEnableVoiceCommands.Checked = _toolConfig.EnableVoiceCommands; - txtVoiceCommandPhrase.Text = _toolConfig.VoiceCommandPhrase; + UpdateMultiAgentUIState(); + UpdatePlannerConfigUIState(); + UpdateExecutorConfigUIState(); + UpdateStatusIndicators(); - // Set speech language if it exists in items - if (comboSpeechLanguage.Items.Contains(_toolConfig.SpeechRecognitionLanguage)) + if (_isNewConfiguration && !configExists) + { + _toolConfig.SaveConfig(toolFileName); + } + } + catch (Exception ex) { - comboSpeechLanguage.SelectedItem = _toolConfig.SpeechRecognitionLanguage; + MessageBox.Show($"Error loading configuration: {ex.Message}", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } - else if (comboSpeechLanguage.Items.Count > 0) + } + + private void UpdateStatusIndicators() + { + var statusMappings = new Dictionary { - // Default to first item if language not in list - comboSpeechLanguage.SelectedIndex = 0; + { chkCMDPlugin, indicatorCMD }, + { chkPowerShellPlugin, indicatorPowerShell }, + { chkScreenCapturePlugin, indicatorScreenCapture }, + { chkKeyboardPlugin, indicatorKeyboard }, + { chkMousePlugin, indicatorMouse }, + { chkWindowSelectionPlugin, indicatorWindow }, + { chkMultiAgentMode, indicatorMultiAgent }, + { chkEnableSpeechRecognition, indicatorSpeech }, + { chkEnableVoiceCommands, indicatorVoiceCmd }, + { chkAutoInvoke, indicatorAutoInvoke } + }; + + foreach (var mapping in statusMappings) + { + UpdateStatusIndicator(mapping.Key, mapping.Value); } + } - // If this is a new configuration being created, save the default values - if (_isNewConfiguration && !configExists) + private void UpdateStatusIndicator(CheckBox checkBox, PictureBox indicator) + { + if (checkBox.Checked) { - _toolConfig.SaveConfig(toolFileName); + // Use a green checkmark emoji for enabled status + indicator.Image = null; + indicator.BackColor = Color.Transparent; + indicator.Text = "βœ…"; + indicator.Visible = true; } + else + { + // Use a red X emoji for disabled status + indicator.Image = null; + indicator.BackColor = Color.Transparent; + indicator.Text = "❌"; + indicator.Visible = true; + } + } + + private void UpdateMultiAgentUIState() + { + // Instead of disabling the entire tab, only disable planner-specific controls + // while keeping executor-related controls enabled + tabMultiAgent.Enabled = true; // Always enable the tab + + // Only enable planner-specific controls when multi-agent mode is checked + txtPlannerSystemPrompt.Enabled = chkMultiAgentMode.Checked; + lblPlannerPrompt.Enabled = chkMultiAgentMode.Checked; + chkUseCustomPlannerConfig.Enabled = chkMultiAgentMode.Checked; + comboPlannerConfig.Enabled = chkMultiAgentMode.Checked && chkUseCustomPlannerConfig.Checked; + btnConfigurePlanner.Enabled = chkMultiAgentMode.Checked && chkUseCustomPlannerConfig.Checked; + + // Executor controls remain enabled regardless of multi-agent mode + + UpdateStatusIndicator(chkMultiAgentMode, indicatorMultiAgent); + } + + private void UpdatePlannerConfigUIState() + { + // Enable or disable the planner config dropdown based on checkbox + comboPlannerConfig.Enabled = chkUseCustomPlannerConfig.Checked; + btnConfigurePlanner.Enabled = chkUseCustomPlannerConfig.Checked; + } + + private void UpdateExecutorConfigUIState() + { + // Enable or disable the executor config dropdown based on checkbox + comboExecutorConfig.Enabled = chkUseCustomExecutorConfig.Checked; + btnConfigureExecutor.Enabled = chkUseCustomExecutorConfig.Checked; } private void saveButton_Click(object sender, EventArgs e) @@ -139,7 +450,6 @@ private void saveButton_Click(object sender, EventArgs e) _toolConfig.Temperature = (double)numTemperature.Value; _toolConfig.AutoInvokeKernelFunctions = chkAutoInvoke.Checked; _toolConfig.RetainChatHistory = chkRetainChatHistory.Checked; - _toolConfig.SystemPrompt = txtSystemPrompt.Text; // Save multi-agent mode setting _toolConfig.EnableMultiAgentMode = chkMultiAgentMode.Checked; @@ -155,25 +465,73 @@ private void saveButton_Click(object sender, EventArgs e) _toolConfig.EnableVoiceCommands = chkEnableVoiceCommands.Checked; _toolConfig.VoiceCommandPhrase = txtVoiceCommandPhrase.Text; + // Save planner and executor settings + _toolConfig.PlannerSystemPrompt = txtPlannerSystemPrompt.Text; + _toolConfig.ExecutorSystemPrompt = txtExecutorSystemPrompt.Text; + + // Save custom model configuration options + _toolConfig.UseCustomPlannerConfig = chkUseCustomPlannerConfig.Checked; + _toolConfig.UseCustomExecutorConfig = chkUseCustomExecutorConfig.Checked; + + if (comboPlannerConfig.SelectedItem != null) + { + _toolConfig.PlannerConfigName = comboPlannerConfig.SelectedItem.ToString(); + } + + if (comboExecutorConfig.SelectedItem != null) + { + _toolConfig.ExecutorConfigName = comboExecutorConfig.SelectedItem.ToString(); + } + + // Save theme configuration + if (cbTheme.SelectedItem != null) + { + _toolConfig.ThemeName = cbTheme.SelectedItem.ToString(); + _themeManager.CurrentTheme = cbTheme.SelectedItem.ToString(); + } + _toolConfig.SaveConfig(toolFileName); // Update any active speech recognition services with the new command phrase - foreach (Form form in Application.OpenForms) - { - if (form is Form1 mainForm) + try { + foreach (Form form in Application.OpenForms) { - var field = typeof(Form1).GetField("speechRecognition", - System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - if (field != null) + if (form is Form1 mainForm) { - var speechService = field.GetValue(mainForm) as SpeechRecognitionService; - speechService?.UpdateCommandPhrase(_toolConfig.VoiceCommandPhrase); + var field = typeof(Form1).GetField("speechRecognition", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); + if (field != null) + { + var speechService = field.GetValue(mainForm) as SpeechRecognitionService; + speechService?.UpdateCommandPhrase(_toolConfig.VoiceCommandPhrase); + } } } } + catch (Exception ex) + { + Console.WriteLine($"Failed to update speech service: {ex.Message}"); + } - MessageBox.Show("Configuration saved successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); - this.Close(); + // Show save notification + ShowSaveNotification(); + } + + private void ShowSaveNotification() + { + // Show save notification with fade effect + saveNotification.Visible = true; + saveNotification.BringToFront(); + + // Start the timer to hide the notification + saveNotificationTimer.Start(); + } + + private void saveNotificationTimer_Tick(object sender, EventArgs e) + { + // Hide notification after timer expires + saveNotification.Visible = false; + saveNotificationTimer.Stop(); } private void cancelButton_Click_1(object sender, EventArgs e) @@ -181,12 +539,274 @@ private void cancelButton_Click_1(object sender, EventArgs e) this.Close(); } - // Optional: Add an event handler for the checkbox if needed + // Event handler for multi-agent mode checkbox private void chkMultiAgentMode_CheckedChanged(object sender, EventArgs e) { - // You can add logic here if needed, for example: - // - Show/hide additional settings that are specific to multi-agent mode - // - Display a warning or information message about multi-agent mode + // Update UI state when the multi-agent checkbox is toggled + UpdateMultiAgentUIState(); + } + + // Event handlers for custom config checkboxes + private void chkUseCustomPlannerConfig_CheckedChanged(object sender, EventArgs e) + { + UpdatePlannerConfigUIState(); + } + + private void chkUseCustomExecutorConfig_CheckedChanged(object sender, EventArgs e) + { + UpdateExecutorConfigUIState(); + } + + // Event handlers for config buttons + private void btnConfigurePlanner_Click(object sender, EventArgs e) + { + if (comboPlannerConfig.SelectedItem != null) + { + string configName = comboPlannerConfig.SelectedItem.ToString(); + OpenAPIConfigForm(configName); + } + } + + private void btnConfigureExecutor_Click(object sender, EventArgs e) + { + if (comboExecutorConfig.SelectedItem != null) + { + string configName = comboExecutorConfig.SelectedItem.ToString(); + OpenAPIConfigForm(configName); + } + } + + // Helper method to open API config form + private void OpenAPIConfigForm(string configName) + { + using (var apiConfigForm = new ConfigForm(configName)) + { + apiConfigForm.ShowDialog(); + + // Refresh the API configurations after editing + PopulateAPIConfigurations(); + } + } + + // Event handler for theme selection + private void cbTheme_SelectedIndexChanged(object sender, EventArgs e) + { + if (cbTheme.SelectedItem != null) + { + string selectedTheme = cbTheme.SelectedItem.ToString(); + _themeManager.CurrentTheme = selectedTheme; + ApplyTheme(selectedTheme); + } + } + + // Event handlers for profile management + private void btnSaveProfile_Click(object sender, EventArgs e) + { + using (var inputDialog = new InputDialog("Save Profile", "Enter profile name:")) + { + if (inputDialog.ShowDialog() == DialogResult.OK) + { + string profileName = inputDialog.InputText; + if (!string.IsNullOrEmpty(profileName)) + { + // Save current settings to profile + _profileManager.SaveProfile(profileName, _toolConfig); + + // Refresh profile list + PopulateConfigurationProfiles(); + + // Select the newly created profile + cmbProfiles.SelectedItem = profileName; + + // Show confirmation + MessageBox.Show($"Profile '{profileName}' saved successfully.", + "Profile Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + } + + private void btnLoadProfile_Click(object sender, EventArgs e) + { + if (cmbProfiles.SelectedItem != null) + { + string profileName = cmbProfiles.SelectedItem.ToString(); + + // Load the selected profile + ToolConfig profileConfig = _profileManager.LoadProfile(profileName); + if (profileConfig != null) + { + _toolConfig = profileConfig; + LoadToolConfig(); // Refresh UI with loaded config + + // Show confirmation + MessageBox.Show($"Profile '{profileName}' loaded successfully.", + "Profile Loaded", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + private void btnDeleteProfile_Click(object sender, EventArgs e) + { + if (cmbProfiles.SelectedItem != null) + { + string profileName = cmbProfiles.SelectedItem.ToString(); + + // Confirm deletion + if (MessageBox.Show($"Are you sure you want to delete profile '{profileName}'?", + "Confirm Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) + { + // Delete the profile + _profileManager.DeleteProfile(profileName); + + // Refresh profile list + PopulateConfigurationProfiles(); + + // Show confirmation + MessageBox.Show($"Profile '{profileName}' deleted.", + "Profile Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); + } + } + } + + private void txtSearchSettings_TextChanged(object sender, EventArgs e) + { + string searchText = txtSearchSettings.Text.ToLower(); + if (string.IsNullOrWhiteSpace(searchText)) + { + // If search is empty, show all tabs and reset visuals + foreach (TabPage tab in tabControlMain.TabPages) + { + tab.Text = tab.Name.Replace("tab", ""); + } + + searchResultLabel.Visible = false; + return; + } + + // Search through all controls on all tabs + int matchCount = 0; + List matchedTabs = new List(); + + foreach (TabPage tab in tabControlMain.TabPages) + { + bool tabHasMatch = false; + + // Check tab name/title first + if (tab.Text.ToLower().Contains(searchText)) + { + tabHasMatch = true; + matchCount++; + } + + // Check all controls in this tab + foreach (Control control in tab.Controls) + { + // Check if control text/name contains search text + if (control.Text.ToLower().Contains(searchText)) + { + tabHasMatch = true; + matchCount++; + } + + // For group boxes, check their child controls + if (control is GroupBox groupBox) + { + foreach (Control childControl in groupBox.Controls) + { + if (childControl.Text.ToLower().Contains(searchText)) + { + tabHasMatch = true; + matchCount++; + } + } + } + } + + if (tabHasMatch) + { + matchedTabs.Add(tab.Name); + tab.Text = "βœ“ " + tab.Name.Replace("tab", ""); + } + else + { + tab.Text = tab.Name.Replace("tab", ""); + } + } + + // Display results + searchResultLabel.Text = $"Found {matchCount} matches in {matchedTabs.Count} tabs"; + searchResultLabel.Visible = true; + + // If there's a match and only one tab has matches, switch to that tab + if (matchedTabs.Count == 1) + { + TabPage matchedTab = tabControlMain.TabPages[matchedTabs[0]]; + tabControlMain.SelectedTab = matchedTab; + } + } + + private void chkPluginStatus_CheckedChanged(object sender, EventArgs e) + { + // Update status indicators when any plugin checkbox changes + UpdateStatusIndicators(); + } + } + + // Simple input dialog for profile name entry + public class InputDialog : Form + { + private TextBox textBox; + private Button okButton; + private Button cancelButton; + private Label promptLabel; + + public string InputText + { + get { return textBox.Text; } + } + + public InputDialog(string title, string prompt) + { + this.Text = title; + this.FormBorderStyle = FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.StartPosition = FormStartPosition.CenterParent; + this.Width = 350; + this.Height = 150; + + promptLabel = new Label(); + promptLabel.Text = prompt; + promptLabel.Left = 10; + promptLabel.Top = 10; + promptLabel.Width = 330; + this.Controls.Add(promptLabel); + + textBox = new TextBox(); + textBox.Left = 10; + textBox.Top = 40; + textBox.Width = 330; + this.Controls.Add(textBox); + + okButton = new Button(); + okButton.Text = "OK"; + okButton.Left = 180; + okButton.Top = 80; + okButton.Width = 75; + okButton.DialogResult = DialogResult.OK; + this.Controls.Add(okButton); + + cancelButton = new Button(); + cancelButton.Text = "Cancel"; + cancelButton.Left = 265; + cancelButton.Top = 80; + cancelButton.Width = 75; + cancelButton.DialogResult = DialogResult.Cancel; + this.Controls.Add(cancelButton); + + this.AcceptButton = okButton; + this.CancelButton = cancelButton; } } } diff --git a/FlowVision/ToolConfigForm.resx b/FlowVision/ToolConfigForm.resx index 1af7de1..a63a8e4 100644 --- a/FlowVision/ToolConfigForm.resx +++ b/FlowVision/ToolConfigForm.resx @@ -117,4 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 17, 17 + + + 154, 17 + \ No newline at end of file diff --git a/FlowVision/lib/Classes/SettingsProfileManager.cs b/FlowVision/lib/Classes/SettingsProfileManager.cs new file mode 100644 index 0000000..92c4e04 --- /dev/null +++ b/FlowVision/lib/Classes/SettingsProfileManager.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; + +namespace FlowVision.lib.Classes +{ + /// + /// Manages user configuration profiles + /// + public class SettingsProfileManager + { + private readonly string _profilesDirectory; + + public SettingsProfileManager() + { + // Create profiles directory path + _profilesDirectory = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "FlowVision", "Profiles"); + + // Ensure the profiles directory exists + Directory.CreateDirectory(_profilesDirectory); + } + + /// + /// Gets a list of available profile names + /// + public List GetAvailableProfiles() + { + try + { + // Get all profile files and extract names + return Directory.GetFiles(_profilesDirectory, "*.json") + .Select(Path.GetFileNameWithoutExtension) + .ToList(); + } + catch (Exception ex) + { + Console.WriteLine($"Error getting profiles: {ex.Message}"); + return new List(); + } + } + + /// + /// Saves the current configuration to a named profile + /// + public void SaveProfile(string profileName, ToolConfig config) + { + try + { + string profilePath = Path.Combine(_profilesDirectory, $"{profileName}.json"); + var options = new JsonSerializerOptions { WriteIndented = true }; + string jsonContent = JsonSerializer.Serialize(config, options); + File.WriteAllText(profilePath, jsonContent); + } + catch (Exception ex) + { + Console.WriteLine($"Error saving profile: {ex.Message}"); + } + } + + /// + /// Loads a configuration from a named profile + /// + public ToolConfig LoadProfile(string profileName) + { + try + { + string profilePath = Path.Combine(_profilesDirectory, $"{profileName}.json"); + if (File.Exists(profilePath)) + { + string jsonContent = File.ReadAllText(profilePath); + return JsonSerializer.Deserialize(jsonContent) ?? new ToolConfig(); + } + } + catch (Exception ex) + { + Console.WriteLine($"Error loading profile: {ex.Message}"); + } + + // Return default config if profile can't be loaded + return new ToolConfig(); + } + + /// + /// Deletes a named profile + /// + public void DeleteProfile(string profileName) + { + try + { + string profilePath = Path.Combine(_profilesDirectory, $"{profileName}.json"); + if (File.Exists(profilePath)) + { + File.Delete(profilePath); + } + } + catch (Exception ex) + { + Console.WriteLine($"Error deleting profile: {ex.Message}"); + } + } + } +} diff --git a/FlowVision/lib/Classes/ToolConfig.cs b/FlowVision/lib/Classes/ToolConfig.cs index 0bdfc61..4e576d6 100644 --- a/FlowVision/lib/Classes/ToolConfig.cs +++ b/FlowVision/lib/Classes/ToolConfig.cs @@ -20,8 +20,38 @@ public class ToolConfig public double Temperature { get; set; } = 0.2; public bool AutoInvokeKernelFunctions { get; set; } = true; public bool RetainChatHistory { get; set; } = true; - public string SystemPrompt { get; set; } = @"You are an AI Agent that can use tools to help the user. Use your tools to come up with novel ideas to answer the users requests you dont have the answer to. Do not restart the server"; public bool EnableMultiAgentMode { get; set; } = false; // Changed default to false + public string ThemeName { get; set; } = "Light"; // Added theme property + + // New properties for planner and executor configuration + public string PlannerSystemPrompt { get; set; } = @"You are a planning agent responsible for breaking down complex tasks into clear steps. +Your job is to: +1. Analyze the user's request +2. Create a step-by-step plan to accomplish the goal +3. Send each step to the executor agent +4. Review the executor's results after each step +5. Adapt the plan as needed based on the results +6. Continue until the entire task is complete +7. If use is just greeting respond with hello + +YOU CANNOT EXECUTE TOOLS DIRECTLY. Only the execution agent can use tools. +You must work with the execution agent to accomplish the goals."; + + public string ExecutorSystemPrompt { get; set; } = @"You are an execution agent with access to various tools. +Your job is to: +1. Execute the specific step provided by the planner agent +2. Use available tools to accomplish the requested action +3. Report back the results and any observations +4. Do not go beyond the specific step you were asked to perform +5. Be precise and thorough in your execution + +You have access to tools like CMD, PowerShell, screen capture, keyboard input, mouse control, and window selection."; + + public bool UseCustomPlannerConfig { get; set; } = false; + public bool UseCustomExecutorConfig { get; set; } = false; + public string PlannerConfigName { get; set; } = "planner"; + public string ExecutorConfigName { get; set; } = "executor"; + public static string ConfigFilePath(string configName) { return Path.Combine( diff --git a/FlowVision/lib/Classes/ai/Actioner.cs b/FlowVision/lib/Classes/ai/Actioner.cs index 272213c..3a799b9 100644 --- a/FlowVision/lib/Classes/ai/Actioner.cs +++ b/FlowVision/lib/Classes/ai/Actioner.cs @@ -89,7 +89,7 @@ public async Task ExecuteAction(string actionPrompt) try { // Add system message to actioner history - actionerHistory.AddSystemMessage(toolConfig.SystemPrompt); + actionerHistory.AddSystemMessage(toolConfig.ExecutorSystemPrompt); // Add action prompt to actioner history actionerHistory.AddUserMessage(actionPrompt); diff --git a/FlowVision/lib/Classes/ai/Github_Actioner.cs b/FlowVision/lib/Classes/ai/Github_Actioner.cs index 855683d..1af6d19 100644 --- a/FlowVision/lib/Classes/ai/Github_Actioner.cs +++ b/FlowVision/lib/Classes/ai/Github_Actioner.cs @@ -33,7 +33,7 @@ public Github_Actioner(RichTextBox outputTextBox) ToolConfig toolConfig = ToolConfig.LoadConfig(TOOL_CONFIG); // Set system message from config - _history.AddSystemMessage(toolConfig.SystemPrompt); + _history.AddSystemMessage(toolConfig.ExecutorSystemPrompt); } public async Task ExecuteAction(string actionPrompt) diff --git a/FlowVision/lib/Classes/ai/MultiAgentActioner.cs b/FlowVision/lib/Classes/ai/MultiAgentActioner.cs index 3b0d855..db1ee0b 100644 --- a/FlowVision/lib/Classes/ai/MultiAgentActioner.cs +++ b/FlowVision/lib/Classes/ai/MultiAgentActioner.cs @@ -24,38 +24,20 @@ public class MultiAgentActioner private Kernel plannerKernel; private Kernel executorKernel; - private const string PLANNER_CONFIG = "planner"; - private const string EXECUTOR_CONFIG = "executor"; - private const string ACTIONER_CONFIG = "actioner"; + // Configuration constants private const string TOOL_CONFIG = "toolsconfig"; + private const string ACTIONER_CONFIG = "actioner"; + + // ToolConfig instance to store and access configuration + private ToolConfig toolConfig; - private const string PLANNER_SYSTEM_PROMPT = @"You are a planning agent responsible for breaking down complex tasks into clear steps. -Your job is to: -1. Analyze the user's request -2. Create a step-by-step plan to accomplish the goal -3. Send each step to the executor agent -4. Review the executor's results after each step -5. Adapt the plan as needed based on the results -6. Continue until the entire task is complete -7. If use is just greeting respond with hello - -YOU CANNOT EXECUTE TOOLS DIRECTLY. Only the execution agent can use tools. -You must work with the execution agent to accomplish the goals."; - - private const string EXECUTOR_SYSTEM_PROMPT = @"You are an execution agent with access to various tools. -Your job is to: -1. Execute the specific step provided by the planner agent -2. Use available tools to accomplish the requested action -3. Report back the results and any observations -4. Do not go beyond the specific step you were asked to perform -5. Be precise and thorough in your execution - -You have access to tools like CMD, PowerShell, screen capture, keyboard input, mouse control, and window selection."; - public MultiAgentActioner(Form1.PluginOutputHandler outputHandler) { plannerHistory = new ChatHistory(); executorHistory = new ChatHistory(); + + // Load tool configuration when the MultiAgentActioner is initialized + toolConfig = ToolConfig.LoadConfig(TOOL_CONFIG); // Create a RichTextBox that isn't displayed but used for logging var hiddenTextBox = new RichTextBox { Visible = false }; @@ -87,7 +69,8 @@ public MultiAgentActioner(Form1.PluginOutputHandler outputHandler) public async Task ExecuteAction(string actionPrompt) { - ToolConfig toolConfig = ToolConfig.LoadConfig(TOOL_CONFIG); + // Reload tool configuration to ensure we have the most recent settings + toolConfig = ToolConfig.LoadConfig(TOOL_CONFIG); PluginLogger.NotifyTaskStart("Multi-Agent Action", "Planning and executing your request"); PluginLogger.StartLoadingIndicator("planning"); @@ -96,30 +79,46 @@ public async Task ExecuteAction(string actionPrompt) { // Configure planner first plannerHistory.Clear(); - plannerHistory.AddSystemMessage(PLANNER_SYSTEM_PROMPT); + plannerHistory.AddSystemMessage(toolConfig.PlannerSystemPrompt); plannerHistory.AddUserMessage(actionPrompt); // Configure executor for later use executorHistory.Clear(); - executorHistory.AddSystemMessage(EXECUTOR_SYSTEM_PROMPT); + executorHistory.AddSystemMessage(toolConfig.ExecutorSystemPrompt); + + // Load model configurations - use either custom configs or default + APIConfig plannerConfig = toolConfig.UseCustomPlannerConfig + ? APIConfig.LoadConfig(toolConfig.PlannerConfigName) + : APIConfig.LoadConfig(ACTIONER_CONFIG); + + APIConfig executorConfig = toolConfig.UseCustomExecutorConfig + ? APIConfig.LoadConfig(toolConfig.ExecutorConfigName) + : APIConfig.LoadConfig(ACTIONER_CONFIG); - // Load model configurations - APIConfig config = APIConfig.LoadConfig(ACTIONER_CONFIG); + // Verify planner config + if (string.IsNullOrWhiteSpace(plannerConfig.DeploymentName) || + string.IsNullOrWhiteSpace(plannerConfig.EndpointURL) || + string.IsNullOrWhiteSpace(plannerConfig.APIKey)) + { + PluginLogger.NotifyTaskComplete("Multi-Agent Action", false); + return "Error: Planner model not configured"; + } - if (string.IsNullOrWhiteSpace(config.DeploymentName) || - string.IsNullOrWhiteSpace(config.EndpointURL) || - string.IsNullOrWhiteSpace(config.APIKey)) + // Verify executor config + if (string.IsNullOrWhiteSpace(executorConfig.DeploymentName) || + string.IsNullOrWhiteSpace(executorConfig.EndpointURL) || + string.IsNullOrWhiteSpace(executorConfig.APIKey)) { PluginLogger.NotifyTaskComplete("Multi-Agent Action", false); - return "Error: Actioner model not configured"; + return "Error: Executor model not configured"; } // Setup the kernel for planner (no tools, only planning capabilities) var plannerBuilder = Kernel.CreateBuilder(); plannerBuilder.AddAzureOpenAIChatCompletion( - config.DeploymentName, - config.EndpointURL, - config.APIKey); + plannerConfig.DeploymentName, + plannerConfig.EndpointURL, + plannerConfig.APIKey); plannerKernel = plannerBuilder.Build(); plannerChat = plannerKernel.GetRequiredService(); @@ -127,9 +126,9 @@ public async Task ExecuteAction(string actionPrompt) // Setup the kernel for executor with all tools var executorBuilder = Kernel.CreateBuilder(); executorBuilder.AddAzureOpenAIChatCompletion( - config.DeploymentName, - config.EndpointURL, - config.APIKey); + executorConfig.DeploymentName, + executorConfig.EndpointURL, + executorConfig.APIKey); // Add plugins dynamically based on tool configuration if (toolConfig.EnableCMDPlugin) @@ -285,7 +284,7 @@ private async Task GetAgentResponseAsync( internal void SetChatHistory(List chatHistory) { plannerHistory.Clear(); - plannerHistory.AddSystemMessage(PLANNER_SYSTEM_PROMPT); + plannerHistory.AddSystemMessage(toolConfig.PlannerSystemPrompt); foreach (var message in chatHistory) { diff --git a/FlowVision/lib/UI/ThemeManager.cs b/FlowVision/lib/UI/ThemeManager.cs new file mode 100644 index 0000000..4b394e6 --- /dev/null +++ b/FlowVision/lib/UI/ThemeManager.cs @@ -0,0 +1,81 @@ +using System; +using System.IO; +using System.Text.Json; + +namespace FlowVision.lib.UI +{ + /// + /// Manages application themes and theme-related settings + /// + public class ThemeManager + { + private const string DefaultTheme = "Light"; + private string _currentTheme; + private readonly string _themePath; + + public ThemeManager() + { + // Create theme settings path + _themePath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), + "FlowVision", "Settings", "theme.json"); + + // Create directory if it doesn't exist + Directory.CreateDirectory(Path.GetDirectoryName(_themePath)); + + // Load theme from file or use default + _currentTheme = LoadThemeFromFile(); + } + + /// + /// Gets or sets the current theme + /// + public string CurrentTheme + { + get => _currentTheme; + set + { + _currentTheme = value; + SaveThemeToFile(_currentTheme); + } + } + + private string LoadThemeFromFile() + { + try + { + if (File.Exists(_themePath)) + { + string jsonContent = File.ReadAllText(_themePath); + var themeSetting = JsonSerializer.Deserialize(jsonContent); + return themeSetting?.Name ?? DefaultTheme; + } + } + catch (Exception ex) + { + Console.WriteLine($"Error loading theme: {ex.Message}"); + } + + return DefaultTheme; + } + + private void SaveThemeToFile(string themeName) + { + try + { + var themeSetting = new ThemeSetting { Name = themeName }; + string jsonContent = JsonSerializer.Serialize(themeSetting, new JsonSerializerOptions { WriteIndented = true }); + File.WriteAllText(_themePath, jsonContent); + } + catch (Exception ex) + { + Console.WriteLine($"Error saving theme: {ex.Message}"); + } + } + + private class ThemeSetting + { + public string Name { get; set; } + } + } +} From e00d6b0f7a472014604394acebed11e35768d441 Mon Sep 17 00:00:00 2001 From: CakeRepository Date: Mon, 28 Apr 2025 22:42:59 -0500 Subject: [PATCH 3/3] darkmode merging to keep main clean --- FlowVision/Form1.cs | 167 ++++++++++++++------ FlowVision/ToolConfigForm.Designer.cs | 2 +- FlowVision/lib/Classes/config/APIConfig.cs | 80 ---------- FlowVision/lib/Classes/config/ToolConfig.cs | 76 --------- FlowVision/lib/UI/ThemeColors.cs | 41 +++++ FlowVision/lib/UI/ThemeManager.cs | 114 +++++++++++++ 6 files changed, 279 insertions(+), 201 deletions(-) delete mode 100644 FlowVision/lib/Classes/config/APIConfig.cs delete mode 100644 FlowVision/lib/Classes/config/ToolConfig.cs create mode 100644 FlowVision/lib/UI/ThemeColors.cs diff --git a/FlowVision/Form1.cs b/FlowVision/Form1.cs index b32077b..4a64b3d 100644 --- a/FlowVision/Form1.cs +++ b/FlowVision/Form1.cs @@ -11,6 +11,7 @@ using Microsoft.SemanticKernel.ChatCompletion; // Add System.Speech namespace using System.Speech.Recognition; +using FlowVision.lib.UI; namespace FlowVision { @@ -24,6 +25,7 @@ public partial class Form1 : Form // Speech recognition components private SpeechRecognitionService speechRecognition; private bool isListening = false; + private ThemeManager _themeManager; // Add ThemeManager field declaration // Add a delegate for handling plugin output messages public delegate void PluginOutputHandler(string message); @@ -49,6 +51,60 @@ private void azureOpenAIToolStripMenuItem_Click(object sender, EventArgs e) } } + private void ApplyTheme(string themeName = null) // Fix ApplyTheme method to handle parameter + { + // Initialize ThemeManager if it doesn't exist yet + if (_themeManager == null) + { + _themeManager = new ThemeManager(); + } + + // Use provided theme name or current theme from ThemeManager + string theme = themeName ?? _themeManager.CurrentTheme; + + if (theme == "Dark") + { + ApplyDarkTheme(); + } + else + { + ApplyLightTheme(); + } + } + + private void ApplyLightTheme() + { + // Let ThemeManager handle applying the light theme to all controls + _themeManager.ApplyThemeToControls(this); + + // Update status indicator + UpdateStatusIndicators(); + } + + private void ApplyDarkTheme() + { + // Let ThemeManager handle applying the dark theme to all controls + _themeManager.ApplyThemeToControls(this); + + // Apply specific overrides for any controls that need special handling + + // Update status indicator + UpdateStatusIndicators(); + } + + private void UpdateStatusIndicators() // Add missing UpdateStatusIndicators method + { + // Update any status indicators based on current state + // This can be extended later if more indicators are added + + // Update microphone button appearance based on isListening state + if (microphoneButton != null) + { + microphoneButton.Text = isListening ? "⏹️" : "🎀"; + microphoneButton.BackColor = isListening ? Color.Red : SystemColors.Control; + } + } + private void Form1_Load(object sender, EventArgs e) { // Check if tools are configured, if not, create default configuration @@ -59,7 +115,9 @@ private void Form1_Load(object sender, EventArgs e) var defaultConfig = new ToolConfig(); defaultConfig.SaveConfig(toolConfigName); } - + // Add this call after initializing UI components + ApplyTheme(); + // Create messages panel as a FlowLayoutPanel with auto-scroll messagesPanel = new FlowLayoutPanel { @@ -114,7 +172,7 @@ private void Form1_Load(object sender, EventArgs e) // Initialize speech recognition service InitializeSpeechRecognition(); - + // Handle window resize to adjust message widths this.Resize += (s, args) => { @@ -147,17 +205,18 @@ private void InitializeSpeechRecognition() try { var toolConfig = ToolConfig.LoadConfig("toolsconfig"); - + // Only initialize if speech recognition is enabled in config if (toolConfig.EnableSpeechRecognition) { speechRecognition = new SpeechRecognitionService(); - speechRecognition.SpeechRecognized += (sender, result) => + speechRecognition.SpeechRecognized += (sender, result) => { // Use Invoke to update UI from a different thread if (this.InvokeRequired) { - this.Invoke(new Action((text) => { + this.Invoke(new Action((text) => + { userInputTextBox.Text = text; }), result); } @@ -166,7 +225,7 @@ private void InitializeSpeechRecognition() userInputTextBox.Text = result; } }; - + // Add handler for voice commands if (toolConfig.EnableVoiceCommands) { @@ -174,7 +233,8 @@ private void InitializeSpeechRecognition() { if (this.InvokeRequired) { - this.Invoke(new Action(() => { + this.Invoke(new Action(() => + { if (!string.IsNullOrWhiteSpace(userInputTextBox.Text)) { AddMessage("System", $"Voice command recognized: \"{command}\"", true); @@ -191,7 +251,7 @@ private void InitializeSpeechRecognition() } } }; - + // Start continuous listening if voice commands are enabled if (toolConfig.EnableVoiceCommands) { @@ -234,21 +294,21 @@ private void StartListening() try { var toolConfig = ToolConfig.LoadConfig("toolsconfig"); - + // Clear existing text before starting to listen userInputTextBox.Text = ""; - + // Change button appearance to indicate recording microphoneButton.Text = "⏹️"; microphoneButton.BackColor = Color.Red; isListening = true; - + // Start listening speechRecognition.StartListening(); - + // Add temporary message to indicate we're listening - AddMessage("System", "Listening... Speak now." + - (toolConfig.EnableVoiceCommands ? + AddMessage("System", "Listening... Speak now." + + (toolConfig.EnableVoiceCommands ? $" Say \"{toolConfig.VoiceCommandPhrase}\" to send your message." : ""), true); } catch (Exception ex) @@ -266,13 +326,13 @@ private void StopListening() microphoneButton.Text = "🎀"; microphoneButton.BackColor = SystemColors.Control; isListening = false; - + // Stop listening speechRecognition.StopListening(); - + // Remove the listening message RemoveMessagesByAuthor("System"); - + // If we have recognized text, send it automatically if (!string.IsNullOrWhiteSpace(userInputTextBox.Text)) { @@ -312,7 +372,7 @@ private async void SendButton_Click(object sender, EventArgs e) { string aiResponse = await GetAIResponseAsync(userInput); AddMessage("AI", aiResponse, true); - + // Check if we should retain chat history var toolConfig = ToolConfig.LoadConfig("toolsconfig"); if (!toolConfig.RetainChatHistory) @@ -327,7 +387,7 @@ private async void SendButton_Click(object sender, EventArgs e) catch (Exception ex) { MessageBox.Show($"Error communicating with AI: {ex.Message}", "Error"); - + allowUserInput(true); } @@ -344,22 +404,23 @@ private async Task GetAIResponseAsync(string userInput) // Create a StringBuilder to collect plugin output StringBuilder pluginOutput = new StringBuilder(); - + // Define a plugin output handler that adds messages to the plugin output - PluginOutputHandler outputHandler = (message) => { + PluginOutputHandler outputHandler = (message) => + { pluginOutput.AppendLine(message); }; // Show a pre-execution notification to the user in the UI AddMessage("System", "Your request is being processed. Please wait...", true); - + string aiResponse = string.Empty; - + // Use TaskNotifier to wrap the action execution with notifications try { await TaskNotifier.RunWithNotificationAsync( - "Request Processing", + "Request Processing", "Processing your request and preparing tools", async () => { @@ -367,25 +428,25 @@ await TaskNotifier.RunWithNotificationAsync( // Use Actioner model with the notification infrastructure Actioner actioner = new Actioner(outputHandler); - + // Set multi-agent mode based on tool configuration actioner.SetMultiAgentMode(toolConfig.EnableMultiAgentMode); - + if (toolConfig.RetainChatHistory) { actioner.SetChatHistory(chatHistory); } - + // Execute the action and get the AI response aiResponse = await actioner.ExecuteAction(userInput); }); - + // If there's plugin output, prepend it to the AI response if (pluginOutput.Length > 0) { aiResponse = $"{pluginOutput}\n\n{aiResponse}"; } - + // Remove the "processing" message from the UI RemoveMessageIfSystem(); return aiResponse; @@ -394,15 +455,31 @@ await TaskNotifier.RunWithNotificationAsync( { // Remove the "processing" message from the UI RemoveMessageIfSystem(); - + return $"Error processing request: {ex.Message}"; } } - // Helper method to remove system messages - private void RemoveMessageIfSystem() + private void RemoveMessageIfSystem() // Add missing RemoveMessageIfSystem method { + // Find and remove any "System" messages that indicate processing + for (int i = messagesPanel.Controls.Count - 1; i >= 0; i--) + { + Control c = messagesPanel.Controls[i]; + if (c is Panel bubble) + { + Label authorLabel = bubble.Controls.OfType