refine response format
This commit is contained in:
parent
fdfaffb478
commit
0b54cfa4fa
|
|
@ -48,13 +48,14 @@ public class PlotChartFn : IFunctionCallback
|
|||
}
|
||||
]);
|
||||
|
||||
message.Content = "Here is the chart you ask for:";
|
||||
var obj = response.JsonContent<LlmContextOut>();
|
||||
message.Content = obj?.GreetingMessage ?? "Here is the chart you ask for:";
|
||||
message.RichContent = new RichContent<IRichMessage>
|
||||
{
|
||||
Recipient = new Recipient { Id = convService.ConversationId },
|
||||
Message = new JsCodeTemplateMessage
|
||||
{
|
||||
Text = response
|
||||
Text = obj?.JsCode ?? string.Empty
|
||||
}
|
||||
};
|
||||
message.StopCompletion = true;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BotSharp.Plugin.ChartHandler.LlmContext;
|
||||
|
||||
public class LlmContextOut
|
||||
{
|
||||
[JsonPropertyName("greeting_message")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? GreetingMessage { get; set; }
|
||||
|
||||
[JsonPropertyName("js_code")]
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? JsCode { get; set; }
|
||||
}
|
||||
|
|
@ -10,4 +10,11 @@ Please take a look at "Plotting Requirement" and generate a javascript code that
|
|||
** You must output the javascript code only, and wrap it between one pair of script tags.
|
||||
** 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.
|
||||
** You must not apply any styles on the div html element.
|
||||
|
||||
*** Response Format ***
|
||||
You must output the response in the following JSON format:
|
||||
{
|
||||
"greeting_message": "A short polite message that informs user that the charts have been generated.",
|
||||
"js_code": "The javascript code wrapped in a pair of script tags"
|
||||
}
|
||||
Loading…
Reference in a new issue