diff --git a/dockerfiles/.env b/dockerfiles/.env new file mode 100644 index 00000000..71898228 --- /dev/null +++ b/dockerfiles/.env @@ -0,0 +1,13 @@ +# MongoDB Configuration +ENV_MONGO_DB_HOST=botsharp_mongo +ENV_MONGO_DB_PORT=27017 +ENV_MONGO_DB_DATABASE=botsharp +ENV_MONGO_INITDB_ROOT_USERNAME=root +ENV_MONGO_INITDB_ROOT_PASSWORD=admin +ASPNETCORE_HTTP_PORTS=5500 + + + + + + diff --git a/dockerfiles/ARTICULATE.Dockerfile b/dockerfiles/ARTICULATE.Dockerfile deleted file mode 100644 index e4c684f2..00000000 --- a/dockerfiles/ARTICULATE.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# stage 1: build -FROM microsoft/dotnet AS botsharp-articulate -WORKDIR /source - -# copies the rest of your code -COPY . . - -# RUN dotnet build -RUN dotnet publish BotSharp.WebHost/BotSharp.WebHost.csproj --configuration ARTICULATE --output /app - -# copy Settings folder -WORKDIR /app -RUN mkdir App_Data/Projects - -# stage 2: run -ENTRYPOINT [ "dotnet", "BotSharp.WebHost.dll" ] diff --git a/dockerfiles/DIALOGFLOW.Dockerfile b/dockerfiles/DIALOGFLOW.Dockerfile deleted file mode 100644 index 716defb9..00000000 --- a/dockerfiles/DIALOGFLOW.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# stage 1: build -FROM microsoft/dotnet AS botsharp-dialogflow -WORKDIR /source - -# copies the rest of your code -COPY . . - -# RUN dotnet build -RUN dotnet publish BotSharp.WebHost/BotSharp.WebHost.csproj --configuration DIALOGFLOW --output /app - -# copy Settings folder -WORKDIR /app -RUN mkdir App_Data/Projects - -# stage 2: run -ENTRYPOINT [ "dotnet", "BotSharp.WebHost.dll" ] diff --git a/dockerfiles/RASA.Dockerfile b/dockerfiles/RASA.Dockerfile deleted file mode 100644 index c9a5b707..00000000 --- a/dockerfiles/RASA.Dockerfile +++ /dev/null @@ -1,16 +0,0 @@ -# stage 1: build -FROM microsoft/dotnet AS botsharp-rasa -WORKDIR /source - -# copies the rest of your code -COPY . . - -# RUN dotnet build -RUN dotnet publish BotSharp.WebHost/BotSharp.WebHost.csproj --configuration RASA --output /app - -# copy Settings folder -WORKDIR /app -RUN mkdir App_Data/Projects - -# stage 2: run -ENTRYPOINT [ "dotnet", "BotSharp.WebHost.dll" ] diff --git a/dockerfiles/Readme.md b/dockerfiles/Readme.md new file mode 100644 index 00000000..23bdac8c --- /dev/null +++ b/dockerfiles/Readme.md @@ -0,0 +1,16 @@ +## Run Container + +# Prerequisites: +1. Install Powershell +2. Install Docker Environment + +# start container + +``` +run-docker-compose.ps1 +``` + +# stop container +``` +stop-docker-compose.ps1 +``` diff --git a/dockerfiles/WebStarter.Dockerfile b/dockerfiles/WebStarter.Dockerfile new file mode 100644 index 00000000..550e52c2 --- /dev/null +++ b/dockerfiles/WebStarter.Dockerfile @@ -0,0 +1,49 @@ +#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +FROM mcr.microsoft.com/dotnet/aspnet:8.0-alpine AS base +USER app +WORKDIR /app +EXPOSE 5500 + +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["Directory.Build.props", "."] +COPY ["src/WebStarter/WebStarter.csproj", "src/WebStarter/"] +COPY ["tests/BotSharp.Plugin.PizzaBot/BotSharp.Plugin.PizzaBot.csproj", "tests/BotSharp.Plugin.PizzaBot/"] +COPY ["src/Infrastructure/BotSharp.Core/BotSharp.Core.csproj", "src/Infrastructure/BotSharp.Core/"] +COPY ["src/Infrastructure/BotSharp.Abstraction/BotSharp.Abstraction.csproj", "src/Infrastructure/BotSharp.Abstraction/"] +COPY ["src/Infrastructure/BotSharp.Logger/BotSharp.Logger.csproj", "src/Infrastructure/BotSharp.Logger/"] +COPY ["src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj", "src/Infrastructure/BotSharp.OpenAPI/"] +COPY ["src/Plugins/BotSharp.Plugin.GoogleAI/BotSharp.Plugin.GoogleAI.csproj", "src/Plugins/BotSharp.Plugin.GoogleAI/"] +COPY ["src/Plugins/BotSharp.Plugin.MongoStorage/BotSharp.Plugin.MongoStorage.csproj", "src/Plugins/BotSharp.Plugin.MongoStorage/"] +COPY ["src/Plugins/BotSharp.Plugin.AzureOpenAI/BotSharp.Plugin.AzureOpenAI.csproj", "src/Plugins/BotSharp.Plugin.AzureOpenAI/"] +COPY ["src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj", "src/Plugins/BotSharp.Plugin.ChatbotUI/"] +COPY ["src/Plugins/BotSharp.Plugin.HuggingFace/BotSharp.Plugin.HuggingFace.csproj", "src/Plugins/BotSharp.Plugin.HuggingFace/"] +COPY ["src/Plugins/BotSharp.Plugin.KnowledgeBase/BotSharp.Plugin.KnowledgeBase.csproj", "src/Plugins/BotSharp.Plugin.KnowledgeBase/"] +COPY ["src/Plugins/BotSharp.Plugin.MetaAI/BotSharp.Plugin.MetaAI.csproj", "src/Plugins/BotSharp.Plugin.MetaAI/"] +COPY ["src/Plugins/BotSharp.Plugin.MetaMessenger/BotSharp.Plugin.MetaMessenger.csproj", "src/Plugins/BotSharp.Plugin.MetaMessenger/"] +COPY ["src/Plugins/BotSharp.Plugin.Qdrant/BotSharp.Plugin.Qdrant.csproj", "src/Plugins/BotSharp.Plugin.Qdrant/"] +COPY ["src/Plugins/BotSharp.Plugin.RoutingSpeeder/BotSharp.Plugin.RoutingSpeeder.csproj", "src/Plugins/BotSharp.Plugin.RoutingSpeeder/"] +COPY ["src/Plugins/BotSharp.Plugin.WeChat/BotSharp.Plugin.WeChat.csproj", "src/Plugins/BotSharp.Plugin.WeChat/"] +COPY ["src/Plugins/BotSharp.Plugin.SemanticKernel/BotSharp.Plugin.SemanticKernel.csproj", "src/Plugins/BotSharp.Plugin.SemanticKernel/"] +COPY ["src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj", "src/Plugins/BotSharp.Plugin.Twilio/"] +COPY ["src/Plugins/BotSharp.Plugin.TelegramBots/BotSharp.Plugin.TelegramBots.csproj", "src/Plugins/BotSharp.Plugin.TelegramBots/"] +COPY ["src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj", "src/Plugins/BotSharp.Plugin.ChatHub/"] +COPY ["src/Plugins/BotSharp.Plugin.HttpHandler/BotSharp.Plugin.HttpHandler.csproj", "src/Plugins/BotSharp.Plugin.HttpHandler/"] +COPY ["src/Plugins/BotSharp.Plugin.LLamaSharp/BotSharp.Plugin.LLamaSharp.csproj", "src/Plugins/BotSharp.Plugin.LLamaSharp/"] +COPY ["src/Plugins/BotSharp.Plugin.SqlDriver/BotSharp.Plugin.SqlDriver.csproj", "src/Plugins/BotSharp.Plugin.SqlDriver/"] +COPY ["src/Plugins/BotSharp.Plugin.WebDriver/BotSharp.Plugin.WebDriver.csproj", "src/Plugins/BotSharp.Plugin.WebDriver/"] +RUN dotnet restore "./src/WebStarter/./WebStarter.csproj" +COPY . . +WORKDIR "/src/src/WebStarter" +RUN dotnet build "./WebStarter.csproj" -c $BUILD_CONFIGURATION -o /app/build /p:SolutionName=BotSharp + +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./WebStarter.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false /p:SolutionName=BotSharp + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "WebStarter.dll"] \ No newline at end of file diff --git a/dockerfiles/appsettings.json b/dockerfiles/appsettings.json new file mode 100644 index 00000000..ff53ffb4 --- /dev/null +++ b/dockerfiles/appsettings.json @@ -0,0 +1,209 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "AllowedOrigins": [ + "http://localhost:5015" + ], + + "Jwt": { + "Issuer": "botsharp", + "Audience": "botsharp", + "Key": "31ba6052aa6f4569901facc3a41fcb4adfd9b46dd00c40af8a753fbdc2b89869" + }, + + "OAuth": { + "GitHub": { + "ClientId": "", + "ClientSecret": "" + }, + "Google": { + "ClientId": "", + "ClientSecret": "" + }, + "Keycloak": { + "BaseAddress": "http://keycloak.localhost:8080", + "Realm": "master", + "ClientId": "botsharp", + "ClientSecret": "36FeOoyZzkOWrRZLmhwxplC2kGbFGn68", + "Version": 22 + } + }, + + "LlmProviders": [ + { + "Provider": "azure-openai", + "Models": [ + { + "Name": "gpt-35-turbo", + "ApiKey": "", + "Endpoint": "https://ai4c-demo.openai.azure.com/", + "Type": "chat", + "PromptCost": 0.0015, + "CompletionCost": 0.002 + }, + { + "Name": "gpt-35-turbo-instruct", + "ApiKey": "", + "Endpoint": "https://gpt-35-turbo-instruct.openai.azure.com/", + "Type": "text", + "PromptCost": 0.0015, + "CompletionCost": 0.002 + } + ] + }, + { + "Provider": "llama-sharp", + "Models": [ + { + "Name": "llama-2-7b-guanaco-qlora.Q2_K.gguf", + "Type": "chat" + } + ] + }, + { + "Provider": "huggingface", + "Models": [ + { + "Name": "mistralai/Mistral-7B-v0.1", + "Type": "text" + }, + { + "Name": "TinyLlama/TinyLlama-1.1B-Chat-v1.0", + "Type": "text" + } + ] + } + ], + + "Router": { + }, + + "Evaluator": { + "AgentId": "dfd9b46d-d00c-40af-8a75-3fbdc2b89869" + }, + + "Agent": { + "DataDir": "agents", + "TemplateFormat": "liquid", + "HostAgentId": "01e2fc5c-2c89-4ec7-8470-7688608b496c", + "LlmConfig": { + "Provider": "azure-openai", + "Model": "gpt-35-turbo" + } + }, + + "Conversation": { + "DataDir": "conversations", + "ShowVerboseLog": false, + "EnableLlmCompletionLog": false, + "EnableExecutionLog": true, + "EnableContentLog": true, + "EnableStateLog": true + }, + + "Statistics": { + "DataDir": "stats" + }, + + "LlamaSharp": { + "Interactive": true, + "ModelDir": "C:/Users/haipi/Downloads", + "DefaultModel": "llama-2-7b-chat.Q8_0.gguf", + "MaxContextLength": 1024, + "NumberOfGpuLayer": 20 + }, + + "AzureOpenAi": { + }, + + "GoogleAi": { + "PaLM": { + "Endpoint": "https://generativelanguage.googleapis.com", + "ApiKey": "" + } + }, + + "HuggingFace": { + "Endpoint": "https://api-inference.huggingface.co", + "Model": "tiiuae/falcon-180B-chat", + "Token": "" + }, + + "MetaAi": { + "fastText": { + "ModelPath": "dbpedia.ftz" + } + }, + + "RoutingSpeeder": { + }, + + "MetaMessenger": { + "Endpoint": "https://graph.facebook.com", + "ApiVersion": "v17.0", + "PageId": "", + "PageAccessToken": "" + }, + + "Twilio": { + "PhoneNumber": "+1", + "AccountSID": "", + "AuthToken": "", + "CallbackHost": "https://", + "AgentId": "01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a" + }, + + "Database": { + "Default": "MongoRepository", + "TablePrefix": "BotSharp", + "BotSharpMongoDb": "mongodb://root:admin@botsharp_mongo:27017/botsharp?authSource=admin&authMechanism=SCRAM-SHA-256", + "FileRepository": "data", + "Assemblies": [ "BotSharp.Core" ] + }, + + "Qdrant": { + "Url": "", + "ApiKey": "" + }, + + "WeChat": { + "AgentId": "437bed34-1169-4833-95ce-c24b8b56154a", + "Token": "#{Token}#", + "EncodingAESKey": "#{EncodingAESKey}#", + "WeixinAppId": "#{WeixinAppId}#", + "WeixinAppSecret": "#{WeixinAppSecret}#" + }, + + "KnowledgeBase": { + "VectorDb": "MemVectorDatabase", + "TextEmbedding": "fastTextEmbeddingProvider", + "TextCompletion": "AzureOpenAI.Providers.TextCompletionProvider", + "Pdf2TextConverter": "PigPdf2TextConverter" + }, + + "PluginLoader": { + "Assemblies": [ + "BotSharp.Core", + "BotSharp.Logger", + "BotSharp.Plugin.MongoStorage", + "BotSharp.Plugin.Dashboard", + "BotSharp.Plugin.AzureOpenAI", + "BotSharp.Plugin.GoogleAI", + "BotSharp.Plugin.MetaAI", + "BotSharp.Plugin.MetaMessenger", + "BotSharp.Plugin.HuggingFace", + "BotSharp.Plugin.KnowledgeBase", + "BotSharp.Plugin.Qdrant", + "BotSharp.Plugin.ChatHub", + "BotSharp.Plugin.WeChat", + "BotSharp.Plugin.PizzaBot", + "BotSharp.Plugin.WebDriver", + "BotSharp.Plugin.LLamaSharp" + ] + } +} \ No newline at end of file diff --git a/dockerfiles/botsharp.json b/dockerfiles/botsharp.json new file mode 100644 index 00000000..471f2082 --- /dev/null +++ b/dockerfiles/botsharp.json @@ -0,0 +1,64 @@ +{ + "clientId": "botsharp", + "name": "botsharp 登陆", + "description": "", + "rootUrl": "http://localhost:5500", + "adminUrl": "http://localhost:5500", + "baseUrl": "http://localhost:5500", + "surrogateAuthRequired": false, + "enabled": true, + "alwaysDisplayInConsole": true, + "clientAuthenticatorType": "client-secret", + "secret": "36FeOoyZzkOWrRZLmhwxplC2kGbFGn68", + "redirectUris": [ + "http://localhost:5500/*" + ], + "webOrigins": [ + "http://localhost:5500" + ], + "notBefore": 0, + "bearerOnly": false, + "consentRequired": false, + "standardFlowEnabled": true, + "implicitFlowEnabled": false, + "directAccessGrantsEnabled": true, + "serviceAccountsEnabled": false, + "publicClient": false, + "frontchannelLogout": true, + "protocol": "openid-connect", + "attributes": { + "client.secret.creation.time": "1708154349", + "oauth2.device.authorization.grant.enabled": "false", + "backchannel.logout.revoke.offline.tokens": "false", + "use.refresh.tokens": "true", + "oidc.ciba.grant.enabled": "false", + "backchannel.logout.session.required": "true", + "client_credentials.use_refresh_token": "false", + "tls.client.certificate.bound.access.tokens": "false", + "require.pushed.authorization.requests": "false", + "acr.loa.map": "{}", + "display.on.consent.screen": "false", + "token.response.type.bearer.lower-case": "false" + }, + "authenticationFlowBindingOverrides": {}, + "fullScopeAllowed": true, + "nodeReRegistrationTimeout": -1, + "defaultClientScopes": [ + "web-origins", + "acr", + "profile", + "roles", + "email" + ], + "optionalClientScopes": [ + "address", + "phone", + "offline_access", + "microprofile-jwt" + ], + "access": { + "view": true, + "configure": true, + "manage": true + } +} \ No newline at end of file diff --git a/dockerfiles/docker-compose-articulateui-0.1.0.yml b/dockerfiles/docker-compose-articulateui-0.1.0.yml deleted file mode 100644 index 7e3c9142..00000000 --- a/dockerfiles/docker-compose-articulateui-0.1.0.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3.0' - -services: - ui: - image: botsharpdocker/botsharp-articulateui:0.1.0 - ports: ['0.0.0.0:3000:3000'] - networks: ['botsharp-network'] - environment: - - rasanluendpoint=http://botsharp:7500 - - botsharp: - image: botsharpdocker/botsharp-articulate:0.1.0 - ports: ['0.0.0.0:7500:7500'] - networks: ['botsharp-network'] - - -networks: {botsharp-network: {}} diff --git a/dockerfiles/docker-compose-articulateui.yml b/dockerfiles/docker-compose-articulateui.yml deleted file mode 100644 index 276c443f..00000000 --- a/dockerfiles/docker-compose-articulateui.yml +++ /dev/null @@ -1,24 +0,0 @@ -version: '3.0' - -services: - ui: - image: samtecspg/articulate-ui:0.12.1 - ports: ['0.0.0.0:3000:3000'] - networks: ['botsharp-network'] - environment: - - API_URL - - api: - image: samtecspg/articulate-api:0.12.1 - ports: ['0.0.0.0:7500:7500'] - networks: ['botsharp-network'] - entrypoint: ['node', 'start.js'] - environment: - - SWAGGER_BASE_PATH - - botsharp: - image: botsharpdocker/botsharp-rasa:latest - ports: ['0.0.0.0:5000:5000'] - networks: ['botsharp-network'] - -networks: {botsharp-network: {}} diff --git a/dockerfiles/docker-compose-core.yml b/dockerfiles/docker-compose-core.yml deleted file mode 100644 index dc5c6c77..00000000 --- a/dockerfiles/docker-compose-core.yml +++ /dev/null @@ -1,9 +0,0 @@ -version: '3.0' - -services: - botsharp: - image: botsharpdocker/botsharp-core:0.2.0 - ports: ['0.0.0.0:3112:3112'] - networks: ['botsharp-network'] - -networks: {botsharp-network: {}} diff --git a/dockerfiles/docker-compose-rasaui.yml b/dockerfiles/docker-compose-rasaui.yml deleted file mode 100644 index 8248c0d7..00000000 --- a/dockerfiles/docker-compose-rasaui.yml +++ /dev/null @@ -1,17 +0,0 @@ -version: '3.0' - -services: - ui: - image: botsharpdocker/botsharp-rasaui:latest - ports: ['0.0.0.0:5001:5001'] - networks: ['botsharp-network'] - environment: - - rasanluendpoint=http://botsharp:5000 - - botsharp: - image: botsharpdocker/botsharp-rasa:latest - ports: ['0.0.0.0:5000:5000'] - networks: ['botsharp-network'] - - -networks: {botsharp-network: {}} diff --git a/dockerfiles/docker-compose.infrastructure.override.yml b/dockerfiles/docker-compose.infrastructure.override.yml new file mode 100644 index 00000000..35055873 --- /dev/null +++ b/dockerfiles/docker-compose.infrastructure.override.yml @@ -0,0 +1,31 @@ +version: '3.8' + +services: + mongodb: + environment: + MONGO_INITDB_ROOT_USERNAME: ${ENV_MONGO_INITDB_ROOT_USERNAME} + MONGO_INITDB_ROOT_PASSWORD: ${ENV_MONGO_INITDB_ROOT_PASSWORD} + ports: + - 27017:27017 + + keycloak.localhost: + environment: + - KEYCLOAK_ADMIN=admin + - KEYCLOAK_ADMIN_PASSWORD=admin + - KC_DB=postgres + - KC_DB_URL_HOST=postgresql.localhost + - KC_DB_URL_DATABASE=keycloak + - KC_DB_PASSWORD=123456 + - KC_DB_USERNAME=keycloak + - KC_DB_SCHEMA=public + ports: + - 8080:8080 + + postgresql.localhost: + environment: + # ALLOW_EMPTY_PASSWORD is recommended only for development. + - POSTGRES_PASSWORD=123456 + - POSTGRESQL_USERNAME=keycloak + - POSTGRESQL_DATABASE=keycloak + ports: + - 5432:5432 \ No newline at end of file diff --git a/dockerfiles/docker-compose.infrastructure.yml b/dockerfiles/docker-compose.infrastructure.yml new file mode 100644 index 00000000..d70b7671 --- /dev/null +++ b/dockerfiles/docker-compose.infrastructure.yml @@ -0,0 +1,37 @@ +version: '3' + +services: + mongodb: + image: mongo:7.0-jammy + container_name: botsharp_mongo + volumes: + - mongo7_data_7.0-jammy:/data/db + networks: + - botsharp-network + + keycloak.localhost: + image: quay.io/keycloak/keycloak:22.0.3 + command: start-dev + container_name: keycloak.localhost + depends_on: + - postgresql.localhost + networks: + - botsharp-network + + + postgresql.localhost: + image: docker.io/bitnami/postgresql:16 + container_name: postgresql.localhost + volumes: + - postgres_data_16:/var/lib/postgresql/data + networks: + - botsharp-network + + +volumes: + mongo7_data_7.0-jammy: + postgres_data_16: + +networks: + botsharp-network: + external: true \ No newline at end of file diff --git a/dockerfiles/docker-compose.yml b/dockerfiles/docker-compose.yml new file mode 100644 index 00000000..3b489a42 --- /dev/null +++ b/dockerfiles/docker-compose.yml @@ -0,0 +1,16 @@ +version: '3.0' + +services: + botsharp: + image: botsharpdocker/botsharp-core:latest + build: + context: ../ + dockerfile: dockerfiles/WebStarter.Dockerfile + ports: + - 5500:5500 + env_file: + - ./.env + volumes: + - ./appsettings.json:/app/appsettings.json + networks: + - botsharp-network diff --git a/dockerfiles/run-docker-compose.ps1 b/dockerfiles/run-docker-compose.ps1 new file mode 100644 index 00000000..a96dab7a --- /dev/null +++ b/dockerfiles/run-docker-compose.ps1 @@ -0,0 +1,2 @@ +docker network create botsharp-network +docker-compose -f docker-compose.yml -f docker-compose.infrastructure.yml -f docker-compose.infrastructure.override.yml up -d \ No newline at end of file diff --git a/dockerfiles/stop-docker-compose.ps1 b/dockerfiles/stop-docker-compose.ps1 new file mode 100644 index 00000000..13fb9360 --- /dev/null +++ b/dockerfiles/stop-docker-compose.ps1 @@ -0,0 +1,2 @@ +docker-compose -f docker-compose.yml -f docker-compose.infrastructure.yml -f docker-compose.infrastructure.override.yml down +docker network rm botsharp-network \ No newline at end of file diff --git a/src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj b/src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj index 8b23713a..f3495bb9 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj +++ b/src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj @@ -18,8 +18,6 @@ - - @@ -39,8 +37,12 @@ - + + + + + diff --git a/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj b/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj index 43faa831..4f076a9e 100644 --- a/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj +++ b/src/Plugins/BotSharp.Plugin.ChatHub/BotSharp.Plugin.ChatHub.csproj @@ -18,6 +18,7 @@ + diff --git a/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj b/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj index 6d6b084a..63adc0b8 100644 --- a/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj +++ b/src/Plugins/BotSharp.Plugin.ChatbotUI/BotSharp.Plugin.ChatbotUI.csproj @@ -11,6 +11,7 @@ + diff --git a/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj b/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj index 729895b3..c8f1a6f5 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj +++ b/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/WebStarter/Program.cs b/src/WebStarter/Program.cs index fbe924a5..4fd7e3a0 100644 --- a/src/WebStarter/Program.cs +++ b/src/WebStarter/Program.cs @@ -20,14 +20,16 @@ Log.Logger = new LoggerConfiguration() .CreateLogger(); builder.Host.UseSerilog(); -// Add BotSharp -builder.Services.AddBotSharpCore(builder.Configuration) - .AddBotSharpOpenAPI(builder.Configuration, new[] +string[] allowedOrigins = builder.Configuration.GetSection("AllowedOrigins").Get() ?? new[] { - "http://localhost:5015", + "http://0.0.0.0:5015", "https://botsharp.scisharpstack.org", "https://chat.scisharpstack.org" - }, builder.Environment, true) + }; + + // Add BotSharp + builder.Services.AddBotSharpCore(builder.Configuration) + .AddBotSharpOpenAPI(builder.Configuration, allowedOrigins, builder.Environment, true) .AddBotSharpLogger(builder.Configuration); // Add SignalR for WebSocket diff --git a/src/WebStarter/WebStarter.csproj b/src/WebStarter/WebStarter.csproj index bb421ed0..85d2d24b 100644 --- a/src/WebStarter/WebStarter.csproj +++ b/src/WebStarter/WebStarter.csproj @@ -59,4 +59,4 @@ - + \ No newline at end of file diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json index 37907ff4..08fdfab0 100644 --- a/src/WebStarter/appsettings.json +++ b/src/WebStarter/appsettings.json @@ -6,11 +6,16 @@ } }, "AllowedHosts": "*", - + "AllowedOrigins": [ + "http://localhost:5015", + "http://0.0.0.0:5015", + "https://botsharp.scisharpstack.org", + "https://chat.scisharpstack.org" + ], "Jwt": { "Issuer": "botsharp", "Audience": "botsharp", - "Key": "31ba6052aa6f4569901facc3a41fcb4a" + "Key": "31ba6052aa6f4569901facc3a41fcb4adfd9b46dd00c40af8a753fbdc2b89869" }, "OAuth": { @@ -100,7 +105,7 @@ "EnableLlmCompletionLog": false, "EnableExecutionLog": true, "EnableContentLog": true, - "EnableStateLog": true + "EnableStateLog": true }, "Statistics": {