Add ExecutionData for rich UI.
This commit is contained in:
parent
0da5bd36f7
commit
7b7516a2cf
|
|
@ -20,10 +20,16 @@ public class RoleDialogModel
|
|||
public string? FunctionArgs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Function execution result
|
||||
/// Function execution result, this result will be seen by LLM.
|
||||
/// </summary>
|
||||
public string? ExecutionResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Function execution structured data, this data won't pass to LLM.
|
||||
/// It's ideal to render in rich content in UI.
|
||||
/// </summary>
|
||||
public object ExecutionData { get; set; }
|
||||
|
||||
public bool IsConversationEnd { get; set; }
|
||||
|
||||
public bool NeedReloadAgent { get; set; }
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ public class ConversationController : ControllerBase, IApiAdapter
|
|||
},
|
||||
async fnExecuted =>
|
||||
{
|
||||
response.Json = JsonSerializer.Deserialize<object>(fnExecuted.ExecutionResult);
|
||||
response.Function = fnExecuted.FunctionName;
|
||||
response.Data = fnExecuted.ExecutionData;
|
||||
});
|
||||
|
||||
response.Text = string.Join("\r\n", stackMsg.Select(x => x.Content));
|
||||
|
|
|
|||
|
|
@ -3,5 +3,6 @@ namespace BotSharp.OpenAPI.ViewModels.Conversations;
|
|||
public class MessageResponseModel
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public object Json { get; set; }
|
||||
public string Function { get; set; }
|
||||
public object Data { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,18 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
chatCompletionsOptions.Temperature = 0.5f;
|
||||
chatCompletionsOptions.NucleusSamplingFactor = 0.5f;
|
||||
|
||||
_logger.LogInformation(string.Join("\n", chatCompletionsOptions.Messages.Select(x => $"{x.Role}: {x.Content}")));
|
||||
var verbose = string.Join("\n", chatCompletionsOptions.Messages.Select(x =>
|
||||
{
|
||||
if (x.Role == ChatRole.Function)
|
||||
{
|
||||
return $"{x.Role}: {x.Name} {x.Content}";
|
||||
}
|
||||
else
|
||||
{
|
||||
return $"{x.Role}: {x.Content}";
|
||||
}
|
||||
}));
|
||||
_logger.LogInformation(verbose);
|
||||
return chatCompletionsOptions;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue