minor change

This commit is contained in:
Jicheng Lu 2025-05-14 23:54:18 -05:00
parent bc40deed54
commit 4c4dce852d
3 changed files with 0 additions and 46 deletions

View file

@ -1,25 +0,0 @@
using BotSharp.Abstraction.Functions;
using BotSharp.Abstraction.Options;
namespace BotSharp.Core.Functions;
public class GetLocationFn : IFunctionCallback
{
private readonly IServiceProvider _services;
public GetLocationFn(IServiceProvider services)
{
_services = services;
}
public string Name => "get_location";
public string Indication => "Finding location";
public async Task<bool> Execute(RoleDialogModel message)
{
var args = JsonSerializer.Deserialize<Location>(message.FunctionArgs, BotSharpOptions.defaultJsonOptions);
message.Content = $"There are a lot of fun events here in {args.City}";
return true;
}
}

View file

@ -1,7 +1,4 @@
using BotSharp.Abstraction.Functions;
using BotSharp.Abstraction.Models;
using BotSharp.Abstraction.Options;
using BotSharp.Abstraction.SideCar;
using System.Text.Json.Serialization;
namespace BotSharp.Core.Functions;
@ -21,24 +18,9 @@ public class GetWeatherFn : IFunctionCallback
public async Task<bool> Execute(RoleDialogModel message)
{
//var args = JsonSerializer.Deserialize<Location>(message.FunctionArgs, BotSharpOptions.defaultJsonOptions);
//var sidecar = _services.GetService<IConversationSideCar>();
//var states = GetSideCarStates();
//var userMessage = $"Please find the information at location {args.City}, {args.State}";
//var response = await sidecar.SendMessage(BuiltInAgentId.Chatbot, userMessage, states: states);
message.Content = $"It is a sunny day.";
return true;
}
private List<MessageState> GetSideCarStates()
{
var sideCarStates = new List<MessageState>()
{
new("channel", "email")
};
return sideCarStates;
}
}
class Location

View file

@ -273,13 +273,10 @@ public class GoogleRealTimeProvider : IRealTimeCompletion
public async Task<string> UpdateSession(RealtimeHubConnection conn, bool isInit = false)
{
var convService = _services.GetRequiredService<IConversationService>();
var agentService = _services.GetRequiredService<IAgentService>();
var realtimeSetting = _services.GetRequiredService<RealtimeModelSettings>();
var conv = await convService.GetConversation(conn.ConversationId);
var agent = await agentService.LoadAgent(conn.CurrentAgentId);
var (prompt, request) = PrepareOptions(agent, []);
var config = request.GenerationConfig;