Merge pull request #1169 from iceljc/features/refine-model-settings
Features/refine model settings
This commit is contained in:
commit
bc35112e1a
|
|
@ -15,9 +15,6 @@
|
|||
******************************************************************************/
|
||||
|
||||
using BotSharp.Core.Infrastructures;
|
||||
using NetTopologySuite.Index.KdTree;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace BotSharp.Core.SideCar.Services;
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
limitations under the License.
|
||||
******************************************************************************/
|
||||
|
||||
using BotSharp.Abstraction.Conversations.Enums;
|
||||
using BotSharp.Abstraction.Hooks;
|
||||
using BotSharp.Abstraction.Options;
|
||||
using BotSharp.Abstraction.SideCar;
|
||||
|
||||
|
|
|
|||
|
|
@ -37,11 +37,11 @@ public class GetWeatherFn : IFunctionCallback
|
|||
await Task.Delay(1500);
|
||||
|
||||
#if DEBUG
|
||||
var temp = RoleDialogModel.From(message, AgentRole.Assistant, $"Here is your weather in {args?.City}");
|
||||
var intermediateMsg = RoleDialogModel.From(message, AgentRole.Assistant, $"Here is your weather in {args?.City}");
|
||||
messageHub.Push(new()
|
||||
{
|
||||
EventName = ChatEvent.OnIntermediateMessageReceivedFromAssistant,
|
||||
Data = temp,
|
||||
Data = intermediateMsg,
|
||||
RefId = conv.ConversationId,
|
||||
SaveDataToDb = true
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,6 +30,8 @@ public class ConversationObserver : BotSharpObserverBase<HubObserveData<RoleDial
|
|||
public override void OnNext(HubObserveData<RoleDialogModel> value)
|
||||
{
|
||||
var conv = _services.GetRequiredService<IConversationService>();
|
||||
var storage = _services.GetRequiredService<IConversationStorage>();
|
||||
var routeCtx = _services.GetRequiredService<IRoutingContext>();
|
||||
|
||||
if (value.EventName == ChatEvent.OnIndicationReceived)
|
||||
{
|
||||
|
|
@ -41,5 +43,16 @@ public class ConversationObserver : BotSharpObserverBase<HubObserveData<RoleDial
|
|||
func(value).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
else if (value.EventName == ChatEvent.OnIntermediateMessageReceivedFromAssistant)
|
||||
{
|
||||
var dialogs = routeCtx.GetDialogs();
|
||||
dialogs.Add(value.Data);
|
||||
routeCtx.SetDialogs(dialogs);
|
||||
|
||||
if (value.SaveDataToDb)
|
||||
{
|
||||
storage.Append(conv.ConversationId, value.Data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,12 +140,6 @@ public class ChatHubObserver : BotSharpObserverBase<HubObserveData<RoleDialogMod
|
|||
Role = AgentRole.Assistant
|
||||
}
|
||||
};
|
||||
|
||||
if (value.SaveDataToDb)
|
||||
{
|
||||
var storage = _services.GetRequiredService<IConversationStorage>();
|
||||
storage.Append(conv.ConversationId, message);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue