diff --git a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj index ddcf68cb..635d35d7 100644 --- a/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj +++ b/src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj @@ -86,7 +86,6 @@ - @@ -97,6 +96,7 @@ + @@ -188,7 +188,7 @@ PreserveNewest - + PreserveNewest diff --git a/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs b/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs index 13525fb1..e00f9158 100644 --- a/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs +++ b/src/Infrastructure/BotSharp.Core/Files/Services/Instruct/FileInstructService.SelectFile.cs @@ -65,7 +65,7 @@ public partial class FileInstructService }).ToList(); var agentId = !string.IsNullOrWhiteSpace(options.AgentId) ? options.AgentId : BuiltInAgentId.UtilityAssistant; - var template = !string.IsNullOrWhiteSpace(options.Template) ? options.Template : "select_file_prompt"; + var template = !string.IsNullOrWhiteSpace(options.Template) ? options.Template : "util-file-select_file_instruction"; var foundAgent = db.GetAgent(agentId); var prompt = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, template); diff --git a/src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/select_file_prompt.liquid b/src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-select_file_instruction.liquid similarity index 100% rename from src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/select_file_prompt.liquid rename to src/Infrastructure/BotSharp.Core/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-file-select_file_instruction.liquid diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/BotSharp.Plugin.ChartHandler.csproj b/src/Plugins/BotSharp.Plugin.ChartHandler/BotSharp.Plugin.ChartHandler.csproj index 8051876c..4e7e8a21 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/BotSharp.Plugin.ChartHandler.csproj +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/BotSharp.Plugin.ChartHandler.csproj @@ -7,18 +7,19 @@ - - + + + - + PreserveNewest - + PreserveNewest - + PreserveNewest diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/Enums/UtilityName.cs b/src/Plugins/BotSharp.Plugin.ChartHandler/Enums/UtilityName.cs index a93a17e5..ee97a4a5 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/Enums/UtilityName.cs +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/Enums/UtilityName.cs @@ -2,5 +2,5 @@ namespace BotSharp.Plugin.ChartHandler.Enums; public class UtilityName { - public const string ChartGenerator = "chart-generator"; + public const string ChartPlotter = "chart-plotter"; } diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/GenerateChartFn.cs b/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs similarity index 87% rename from src/Plugins/BotSharp.Plugin.ChartHandler/Functions/GenerateChartFn.cs rename to src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs index c7e66f1f..afda35ed 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/GenerateChartFn.cs +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/Functions/PlotChartFn.cs @@ -2,18 +2,18 @@ using BotSharp.Abstraction.Messaging.Models.RichContent.Template; namespace BotSharp.Plugin.ChartHandler.Functions; -public class GenerateChartFn : IFunctionCallback +public class PlotChartFn : IFunctionCallback { private readonly IServiceProvider _services; - private readonly ILogger _logger; + private readonly ILogger _logger; - public string Name => "util-chart-generate_chart"; - public string Indication => "Generating chart"; + public string Name => "util-chart-plot_chart"; + public string Indication => "Plotting chart"; - public GenerateChartFn( + public PlotChartFn( IServiceProvider services, - ILogger logger) + ILogger logger) { _services = services; _logger = logger; @@ -27,7 +27,7 @@ public class GenerateChartFn : IFunctionCallback var args = JsonSerializer.Deserialize(message.FunctionArgs); var agent = await agentService.GetAgent(message.CurrentAgentId); - var inst = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, "util-chart-plot-instruction"); + var inst = db.GetAgentTemplate(BuiltInAgentId.UtilityAssistant, "util-chart-plot_instruction"); var innerAgent = new Agent { Id = agent.Id, @@ -48,7 +48,7 @@ public class GenerateChartFn : IFunctionCallback } ]); - message.Content = response; + message.Content = "Here is the chart you ask for:"; message.RichContent = new RichContent { Recipient = new Recipient { Id = convService.ConversationId }, diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/Hooks/ChartHandlerUtilityHook.cs b/src/Plugins/BotSharp.Plugin.ChartHandler/Hooks/ChartHandlerUtilityHook.cs index 51600147..02793ffe 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/Hooks/ChartHandlerUtilityHook.cs +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/Hooks/ChartHandlerUtilityHook.cs @@ -2,21 +2,21 @@ namespace BotSharp.Plugin.ChartHandler.Hooks; public class ChartHandlerUtilityHook : IAgentUtilityHook { - private const string GENERATE_CHART_FN = "util-chart-generate_chart"; + private const string PLOT_CHART_FN = "util-chart-plot_chart"; public void AddUtilities(List utilities) { var item = new AgentUtility { Category = "chart", - Name = UtilityName.ChartGenerator, + Name = UtilityName.ChartPlotter, Items = [ - new UtilityItem - { - FunctionName = GENERATE_CHART_FN, - TemplateName = $"{GENERATE_CHART_FN}.fn" - } - ] + new UtilityItem + { + FunctionName = PLOT_CHART_FN, + TemplateName = $"{PLOT_CHART_FN}.fn" + } + ] }; utilities.Add(item); diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-chart-generate_chart.json b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-chart-plot_chart.json similarity index 66% rename from src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-chart-generate_chart.json rename to src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-chart-plot_chart.json index 937647f6..da950832 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-chart-generate_chart.json +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/util-chart-plot_chart.json @@ -1,12 +1,12 @@ { - "name": "util-chart-generate_chart", - "description": "If the user requests you plotting or generating chart, you can call this function to generate chart in any format that user requested.", + "name": "util-chart-plot_chart", + "description": "If the user requests you plotting or generating charts, you can call this function to generate charts in any format that user requested.", "parameters": { "type": "object", "properties": { "plotting_requirement": { "type": "string", - "description": "The requirement that user posted for plotting or generating chart." + "description": "The requirement that user posted for plotting or generating charts." } }, "required": [ "plotting_requirement" ] diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-generate_chart.fn.liquid b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-generate_chart.fn.liquid deleted file mode 100644 index c5fb2d00..00000000 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-generate_chart.fn.liquid +++ /dev/null @@ -1 +0,0 @@ -Please call function util-chart-generate_chart if user wants to generate a chart. \ No newline at end of file diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_chart.fn.liquid b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_chart.fn.liquid new file mode 100644 index 00000000..e54b3c4a --- /dev/null +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_chart.fn.liquid @@ -0,0 +1 @@ +Please call function util-chart-plot_chart if user wants to plot or generate charts. \ No newline at end of file diff --git a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot-instruction.liquid b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_instruction.liquid similarity index 91% rename from src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot-instruction.liquid rename to src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_instruction.liquid index c396d793..50a27eff 100644 --- a/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot-instruction.liquid +++ b/src/Plugins/BotSharp.Plugin.ChartHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/util-chart-plot_instruction.liquid @@ -9,4 +9,5 @@ Please take a look at "Plotting Requirement" and generate a javascript code that ** You must not create any new html element. ** You must output the javascript code only, and wrap it between the script tag. ** You need to import Plotly.js in the same script tag. The script source should be "https://cdn.plot.ly/plotly-3.0.1.min.js". +** You need to add the MODE bar for each chart you plot. ** You must not apply any styles on the div html element. \ No newline at end of file