Rename to BotSharp.Platform.Native

This commit is contained in:
Haiping Chen 2023-06-03 09:57:08 -05:00
parent a3530edb29
commit 2f25a55f80
9 changed files with 32 additions and 25 deletions

View file

@ -25,12 +25,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Channel.FacebookMe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.AzureAi", "src\Plugins\Platforms\BotSharp.Platform.AureAi\BotSharp.Platform.AzureAi.csproj", "{DB98D551-C74A-426E-AF15-D1D49610E00E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Community", "src\Plugins\Platforms\BotSharp.Platform.Community\BotSharp.Platform.Community.csproj", "{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.UIAdapter.ChatbotUI", "src\Plugins\UiAdapters\BotSharp.UiAdapter.ChatbotUI\BotSharp.UIAdapter.ChatbotUI.csproj", "{B49EFCCA-3E5D-4E26-8E83-4070C6FE34C8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.UIAdapter.HuggingChatUI", "src\Plugins\UiAdapters\BotSharp.UiAdapter.HuggingChatUI\BotSharp.UIAdapter.HuggingChatUI.csproj", "{CAEA84EF-B121-48AE-AE0F-AFB514A3FAFF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BotSharp.Platform.Native", "src\Plugins\Platforms\BotSharp.Platform.Native\BotSharp.Platform.Native.csproj", "{6498D3E6-6C87-4955-8686-38817EEDC23E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -87,14 +87,6 @@ Global
{DB98D551-C74A-426E-AF15-D1D49610E00E}.Release|Any CPU.Build.0 = Release|Any CPU
{DB98D551-C74A-426E-AF15-D1D49610E00E}.Release|x64.ActiveCfg = Release|Any CPU
{DB98D551-C74A-426E-AF15-D1D49610E00E}.Release|x64.Build.0 = Release|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Debug|x64.ActiveCfg = Debug|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Debug|x64.Build.0 = Debug|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Release|Any CPU.Build.0 = Release|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Release|x64.ActiveCfg = Release|Any CPU
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D}.Release|x64.Build.0 = Release|Any CPU
{B49EFCCA-3E5D-4E26-8E83-4070C6FE34C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B49EFCCA-3E5D-4E26-8E83-4070C6FE34C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B49EFCCA-3E5D-4E26-8E83-4070C6FE34C8}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -111,6 +103,14 @@ Global
{CAEA84EF-B121-48AE-AE0F-AFB514A3FAFF}.Release|Any CPU.Build.0 = Release|Any CPU
{CAEA84EF-B121-48AE-AE0F-AFB514A3FAFF}.Release|x64.ActiveCfg = Release|Any CPU
{CAEA84EF-B121-48AE-AE0F-AFB514A3FAFF}.Release|x64.Build.0 = Release|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Debug|x64.ActiveCfg = Debug|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Debug|x64.Build.0 = Debug|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Release|Any CPU.Build.0 = Release|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Release|x64.ActiveCfg = Release|Any CPU
{6498D3E6-6C87-4955-8686-38817EEDC23E}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -124,9 +124,9 @@ Global
{B99E1F96-5989-41FF-A4FB-90EFD5C3099F} = {64264688-0F5C-4AB0-8F2B-B59B717CCE00}
{1D651A53-6755-465B-93FC-FA537A5A614E} = {64264688-0F5C-4AB0-8F2B-B59B717CCE00}
{DB98D551-C74A-426E-AF15-D1D49610E00E} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
{9101ADE3-F77A-4806-B3AF-1FFC38D0C88D} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
{B49EFCCA-3E5D-4E26-8E83-4070C6FE34C8} = {42226933-0A0D-48E8-85EC-AFE773A1F841}
{CAEA84EF-B121-48AE-AE0F-AFB514A3FAFF} = {42226933-0A0D-48E8-85EC-AFE773A1F841}
{6498D3E6-6C87-4955-8686-38817EEDC23E} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {A9969D89-C98B-40A5-A12B-FC87E55B3A19}

View file

@ -11,11 +11,13 @@ namespace BotSharp.Core;
public static class BotSharpServiceCollectionExtensions
{
public static IServiceCollection AddBotSharp(this IServiceCollection services)
public static IServiceCollection AddBotSharp(this IServiceCollection services, IConfiguration config)
{
services.AddScoped<IPlatformMidware, PlatformMidware>();
services.AddSingleton<ISessionService, SessionService>();
services.AddSingleton<IConversationService, ConversationService>();
RegisterRepository(services, config);
return services;
}
@ -33,7 +35,7 @@ public static class BotSharpServiceCollectionExtensions
return app;
}
public static void RegisterRepository(this IServiceCollection services, IConfiguration config)
public static void RegisterRepository(IServiceCollection services, IConfiguration config)
{
var databaseSettings = new DatabaseSettings();
config.Bind("Database", databaseSettings);

View file

@ -1,15 +1,17 @@
using BotSharp.Abstraction.Conversations;
using BotSharp.Abstraction.Conversations.Models;
using BotSharp.Core.Repository;
using Microsoft.Extensions.DependencyInjection;
namespace BotSharp.Core.Conversations;
public class SessionService : ISessionService
{
Dictionary<string, List<string>> _sessions;
private readonly IServiceProvider _services;
public SessionService()
public SessionService(IServiceProvider services)
{
_sessions = new Dictionary<string, List<string>>();
_services = services;
}
public void DeleteSession(string sessionId)
@ -24,6 +26,8 @@ public class SessionService : ISessionService
public SessionModel NewSession(string userId)
{
var mongo = _services.CreateScope().ServiceProvider.GetRequiredService<MongoDbContext>();
return new SessionModel
{
SessionId = Guid.NewGuid().ToString()

View file

@ -1,14 +1,14 @@
using BotSharp.Abstraction;
using BotSharp.Platform.Community;
using BotSharp.Platform.Community.Handlers;
using BotSharp.Platform.Native.Handlers;
using BotSharp.Platform.Native.Settings;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace BotSharp.Core;
public static class LlamaSharplServiceCollectionExtensions
public static class BotSharplServiceCollectionExtensions
{
public static IServiceCollection AddLlamaSharp(this IServiceCollection services, IConfiguration config)
public static IServiceCollection AddBotSharpCommunityPlatform(this IServiceCollection services, IConfiguration config)
{
services.AddSingleton(x =>
{

View file

@ -1,5 +1,6 @@
using BotSharp.Abstraction;
using BotSharp.Abstraction.Models;
using BotSharp.Platform.Native.Settings;
using LLama;
using System;
using System.Collections.Generic;
@ -9,7 +10,7 @@ using System.Runtime;
using System.Text;
using System.Threading.Tasks;
namespace BotSharp.Platform.Community.Handlers;
namespace BotSharp.Platform.Native.Handlers;
public class ChatCompletionHandler : IChatCompletionHandler
{

View file

@ -1,4 +1,4 @@
namespace BotSharp.Platform.Community;
namespace BotSharp.Platform.Native.Settings;
public class LlamaSharpSettings
{

View file

@ -11,8 +11,8 @@ builder.Services.AddSwaggerGen();
builder.Services.AddHttpContextAccessor();
// Add BotSharp
builder.Services.AddBotSharp();
builder.Services.AddLlamaSharp(builder.Configuration);
builder.Services.AddBotSharp(builder.Configuration);
builder.Services.AddBotSharpCommunityPlatform(builder.Configuration);
// builder.Services.AddAzureOpenAi(builder.Configuration);
builder.Services.AddCors(options =>

View file

@ -28,7 +28,7 @@
<ItemGroup>
<ProjectReference Include="..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
<ProjectReference Include="..\Plugins\Platforms\BotSharp.Platform.AureAi\BotSharp.Platform.AzureAi.csproj" />
<ProjectReference Include="..\Plugins\Platforms\BotSharp.Platform.Community\BotSharp.Platform.Community.csproj" />
<ProjectReference Include="..\Plugins\Platforms\BotSharp.Platform.Native\BotSharp.Platform.Native.csproj" />
<ProjectReference Include="..\Plugins\UiAdapters\BotSharp.UiAdapter.ChatbotUI\BotSharp.UIAdapter.ChatbotUI.csproj" />
<ProjectReference Include="..\Plugins\UiAdapters\BotSharp.UiAdapter.HuggingChatUI\BotSharp.UIAdapter.HuggingChatUI.csproj" />
</ItemGroup>