From c03be389ca5955d950bd65776bedeaf4e8a5f5e9 Mon Sep 17 00:00:00 2001 From: Haiping Chen Date: Sun, 11 Jun 2023 10:22:48 -0500 Subject: [PATCH] Update README.md. --- README.md | 12 +++--------- .../BotSharp.Abstraction/Agents/IAgentService.cs | 11 +++++++++++ .../BotSharp.Abstraction/Agents/Models/Agent.cs | 16 ++++++++++++++++ .../BotSharp.Abstraction.csproj | 1 + src/Infrastructure/BotSharp.Abstraction/Using.cs | 3 ++- .../AzureOpenAiServiceCollectionExtensions.cs | 7 +++++-- .../BotSharp.Plugin.ChatbotUI/Chatbot-UI.md | 2 +- 7 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 src/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs create mode 100644 src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs diff --git a/README.md b/README.md index d570afc6..d49f02b1 100644 --- a/README.md +++ b/README.md @@ -28,19 +28,13 @@ BotSharp is in accordance with components principle strictly, decouples every pa * Integrate with popular message channels like Facebook Messenger, Slack and Telegram. ### Quick Started - -* Make sure that you have downloaded the related components. -* See the file "BotSharp\BotSharp.WebHost\Settings\app.json",change the path to your own project's path. - -You can use docker compose to run BotSharp quickly, make sure you've got `Docker`_ installed. - +1. Run backend service ```sh PS D:\> git clone https://github.com/dotnetcore/BotSharp PS D:\> cd BotSharp - PS D:\BotSharp\> docker-compose -f dockerfiles/docker-compose-core.yml up + PS D:\BotSharp\> dotnet run -p .\src\WebStarter ``` - -Point your web browser at http://localhost:5500 and enjoy BotSharp Core. +2. Run UI project, reference to [Chatbot UI](src\Plugins\BotSharp.Plugin.ChatbotUI\Chatbot-UI.md). ### Extension Libraries diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs new file mode 100644 index 00000000..5ca94ce6 --- /dev/null +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/IAgentService.cs @@ -0,0 +1,11 @@ +namespace BotSharp.Abstraction.Agents; + +/// +/// Agent management service +/// +public interface IAgentService +{ + void NewAgent(); + void DeleteAgent(); + void UpdateAgent(); +} diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs new file mode 100644 index 00000000..99d03bdc --- /dev/null +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs @@ -0,0 +1,16 @@ +namespace BotSharp.Abstraction.Agents.Models; + +public class Agent +{ + [StringLength(36)] + public string Id { get; set; } = string.Empty; + public string Name { get; set; } = string.Empty; + public string? Description { get; set; } + public DateTime CreatedDateTime { get; set; } + public DateTime UpdatedDateTime { get; set; } + + /// + /// Owner user id + /// + public string OwerId { get; set; } = string.Empty; +} diff --git a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj index 52345a0f..db789174 100644 --- a/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj +++ b/src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj @@ -19,6 +19,7 @@ + diff --git a/src/Infrastructure/BotSharp.Abstraction/Using.cs b/src/Infrastructure/BotSharp.Abstraction/Using.cs index 13e227ca..fd772925 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Using.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Using.cs @@ -1,4 +1,5 @@ global using System; global using System.Collections.Generic; global using System.Text; -global using System.Threading.Tasks; \ No newline at end of file +global using System.Threading.Tasks; +global using System.ComponentModel.DataAnnotations; \ No newline at end of file diff --git a/src/Plugins/BotSharp.Plugin.AzureOpenAI/AzureOpenAiServiceCollectionExtensions.cs b/src/Plugins/BotSharp.Plugin.AzureOpenAI/AzureOpenAiServiceCollectionExtensions.cs index 403cfcb1..11a10e53 100644 --- a/src/Plugins/BotSharp.Plugin.AzureOpenAI/AzureOpenAiServiceCollectionExtensions.cs +++ b/src/Plugins/BotSharp.Plugin.AzureOpenAI/AzureOpenAiServiceCollectionExtensions.cs @@ -10,13 +10,16 @@ public static class AzureOpenAiServiceCollectionExtensions { public static IServiceCollection AddAzureOpenAiPlatform(this IServiceCollection services, IConfiguration config) { + var settings = new AzureOpenAiSettings(); + config.Bind("AzureAi", settings); + services.AddSingleton(x => { - var settings = new AzureOpenAiSettings(); - config.Bind("AzureAi", settings); return settings; }); + services.AddScoped(); + return services; } } \ No newline at end of file diff --git a/src/Plugins/BotSharp.Plugin.ChatbotUI/Chatbot-UI.md b/src/Plugins/BotSharp.Plugin.ChatbotUI/Chatbot-UI.md index 9961ca37..bd204927 100644 --- a/src/Plugins/BotSharp.Plugin.ChatbotUI/Chatbot-UI.md +++ b/src/Plugins/BotSharp.Plugin.ChatbotUI/Chatbot-UI.md @@ -13,4 +13,4 @@ npm run dev # Change host to BotSharp service OPENAI_API_HOST=http://localhost:5500 ``` - +Access `http://localhost:3000`