From 7b7516a2cf9f773da278434c45396ebf128bdaa1 Mon Sep 17 00:00:00 2001
From: hchen2020 <101423@smsassist.com>
Date: Sun, 20 Aug 2023 15:20:16 -0500
Subject: [PATCH] Add ExecutionData for rich UI.
---
.../Conversations/Models/RoleDialogModel.cs | 8 +++++++-
.../Controllers/ConversationController.cs | 3 ++-
.../Conversations/MessageResponseModel.cs | 3 ++-
.../Providers/ChatCompletionProvider.cs | 13 ++++++++++++-
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs
index 3335617e..bc460159 100644
--- a/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs
+++ b/src/Infrastructure/BotSharp.Abstraction/Conversations/Models/RoleDialogModel.cs
@@ -20,10 +20,16 @@ public class RoleDialogModel
public string? FunctionArgs { get; set; }
///
- /// Function execution result
+ /// Function execution result, this result will be seen by LLM.
///
public string? ExecutionResult { get; set; }
+ ///
+ /// Function execution structured data, this data won't pass to LLM.
+ /// It's ideal to render in rich content in UI.
+ ///
+ public object ExecutionData { get; set; }
+
public bool IsConversationEnd { get; set; }
public bool NeedReloadAgent { get; set; }
diff --git a/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs b/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
index e0d60c36..469a1c88 100644
--- a/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
+++ b/src/Infrastructure/BotSharp.OpenAPI/Controllers/ConversationController.cs
@@ -59,7 +59,8 @@ public class ConversationController : ControllerBase, IApiAdapter
},
async fnExecuted =>
{
- response.Json = JsonSerializer.Deserialize