allow user secret
This commit is contained in:
parent
472bf46a2f
commit
ff7d207114
|
|
@ -4,7 +4,7 @@ namespace BotSharp.Abstraction.Realtime;
|
|||
|
||||
public interface IRealtimeHook
|
||||
{
|
||||
Task OnModeReady(Agent agent, IRealTimeCompletion completer);
|
||||
Task OnModelReady(Agent agent, IRealTimeCompletion completer);
|
||||
string[] OnModelTranscriptPrompt(Agent agent);
|
||||
Task OnTranscribeCompleted(RoleDialogModel message, TranscriptionData data);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,8 +58,7 @@ public class RealtimeHub : IRealtimeHub
|
|||
var instruction = await _completer.UpdateSession(_conn);
|
||||
var data = _conn.OnModelReady();
|
||||
await responseToUser(data);
|
||||
await HookEmitter.Emit<IRealtimeHook>(_services, async hook => await hook.OnModeReady(agent, _completer));
|
||||
|
||||
await HookEmitter.Emit<IRealtimeHook>(_services, async hook => await hook.OnModelReady(agent, _completer));
|
||||
},
|
||||
onModelAudioDeltaReceived: async (audioDeltaData, itemId) =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,21 +4,28 @@ using BotSharp.Core.Plugins;
|
|||
using BotSharp.Logger;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BotSharp.OpenAPI;
|
||||
|
||||
public class ServiceBuilder
|
||||
{
|
||||
public static IServiceProvider CreateHostBuilder()
|
||||
public static IServiceProvider CreateHostBuilder(Assembly? startUp = null)
|
||||
{
|
||||
Console.WriteLine("Creating host builder...");
|
||||
|
||||
// Set up configuration
|
||||
var configuration = new ConfigurationBuilder()
|
||||
var configurationBuilder = new ConfigurationBuilder()
|
||||
.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
.AddEnvironmentVariables();
|
||||
|
||||
if (startUp != null)
|
||||
{
|
||||
configurationBuilder.AddUserSecrets(startUp);
|
||||
}
|
||||
|
||||
var configuration = configurationBuilder.Build();
|
||||
|
||||
// Create host builder
|
||||
var builder = Host.CreateDefaultBuilder()
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
<TargetFramework>net8.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<UserSecretsId>d7da3ed7-20a7-4acc-8018-ef9b705fea40</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -3,8 +3,9 @@ using BotSharp.Abstraction.Conversations.Models;
|
|||
using BotSharp.Abstraction.Conversations;
|
||||
using BotSharp.OpenAPI;
|
||||
using System.Text.Json;
|
||||
using System.Reflection;
|
||||
|
||||
var services = ServiceBuilder.CreateHostBuilder();
|
||||
var services = ServiceBuilder.CreateHostBuilder(Assembly.GetExecutingAssembly());
|
||||
var channel = services.GetRequiredService<IStreamChannel>();
|
||||
|
||||
Console.WriteLine("PCM-16 Microphone Capture (24kHz Sample Rate)");
|
||||
|
|
|
|||
Loading…
Reference in a new issue