29 lines
870 B
C#
29 lines
870 B
C#
using System.Collections.Generic;
|
|
|
|
namespace LinkToolAddin.client.prompt;
|
|
|
|
public class DynamicPrompt
|
|
{
|
|
public static string GetPrompt(string name,Dictionary<string,object> args = null)
|
|
{
|
|
PromptTemplates promptTemplate = new PromptTemplates();
|
|
string template = promptTemplate.GetPrompt(name);
|
|
if (args == null)
|
|
{
|
|
return template;
|
|
}
|
|
foreach (KeyValuePair<string,object> pair in args)
|
|
{
|
|
string replaceKey = "{{"+pair.Key+"}}";
|
|
template.Replace(replaceKey, pair.Value.ToString());
|
|
}
|
|
return template;
|
|
}
|
|
|
|
public static Dictionary<string, string> GetAllPrompts()
|
|
{
|
|
PromptTemplates promptTemplate = new PromptTemplates();
|
|
Dictionary<string, string> template = promptTemplate.GetPromptsDict();
|
|
return template;
|
|
}
|
|
} |