using System.Collections.Generic; using LinkToolAddin.host; using LinkToolAddin.host.prompt; namespace LinkToolAddin.client.prompt; public class DynamicPrompt { public static string GetPrompt(string name,Dictionary args = null) { PromptServerList promptServerList = new PromptServerList(); string template = promptServerList.GetPromptServer(name).Content; if (args == null) { return template; } foreach (KeyValuePair pair in args) { string replaceKey = "{{"+pair.Key+"}}"; template = template.Replace(replaceKey, pair.Value.ToString()); } return template; } public static List GetAllPrompts() { PromptServerList promptServerList = new PromptServerList(); List prompts = new List(); Dictionary promptDefinitions = promptServerList.GetPromptsDict(); foreach (KeyValuePair pair in promptDefinitions) { prompts.Add(new UserPrompt() { Name = pair.Value.Name, Description = pair.Value.Description, Arguments = pair.Value.Arguments }); } return prompts; } }