diff --git a/.github/workflows/admin-sample.cd.yml b/.github/workflows/admin-sample.cd.yml index 444e600055..e7e9a41138 100644 --- a/.github/workflows/admin-sample.cd.yml +++ b/.github/workflows/admin-sample.cd.yml @@ -24,7 +24,7 @@ jobs: build_api_blazor: name: build api + blazor web - runs-on: ubuntu-24.04 + runs-on: windows-2025 steps: @@ -77,13 +77,13 @@ jobs: dotnet build AdminPanel/src/Client/AdminPanel.Client.Web/AdminPanel.Client.Web.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Web/AdminPanel.Server.Web.csproj -c Release --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APP_VERSION}}" + run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Web/AdminPanel.Server.Web.csproj -c Release -o server -p:Version="${{ vars.APP_VERSION}}" - name: Upload server artifact uses: actions/upload-artifact@v4 with: name: server-bundle - path: ${{env.DOTNET_ROOT}}/server + path: server include-hidden-files: true # Required for wwwroot/.well-known folder deploy_blazor_wasm_standalone: @@ -128,12 +128,12 @@ jobs: run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Web/AdminPanel.Client.Web.csproj -c Release -o ${{env.DOTNET_ROOT}}/client -p:Version="${{ vars.APP_VERSION}}" + run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Web/AdminPanel.Client.Web.csproj -c Release -o client -p:Version="${{ vars.APP_VERSION}}" - name: Upload to asw run: | npm install -g @azure/static-web-apps-cli - swa deploy --deployment-token ${{ secrets.ADMINPANEL_ASW_TOKEN }} --env production --app-location ${{env.DOTNET_ROOT}}/client/wwwroot + swa deploy --deployment-token ${{ secrets.ADMINPANEL_ASW_TOKEN }} --env production --app-location client/wwwroot deploy_api_blazor: name: deploy api + blazor @@ -170,7 +170,7 @@ jobs: build_blazor_hybrid_windows: name: build blazor hybrid (windows) - runs-on: windows-2022 + runs-on: windows-2025 steps: diff --git a/.github/workflows/blazorui.demo.cd.yml b/.github/workflows/blazorui.demo.cd.yml index d00a334acc..a13117b78f 100644 --- a/.github/workflows/blazorui.demo.cd.yml +++ b/.github/workflows/blazorui.demo.cd.yml @@ -16,7 +16,7 @@ jobs: build_api_blazor: name: build api + blazor web - runs-on: ubuntu-24.04 + runs-on: windows-2025 steps: @@ -49,13 +49,13 @@ jobs: run: dotnet build src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj -p:Version="${{ vars.APP_VERSION}}" -c Release - name: Publish - run: dotnet publish src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj -c Release -p:Version="${{ vars.APP_VERSION}}" --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server + run: dotnet publish src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj -c Release -p:Version="${{ vars.APP_VERSION}}" -o server - name: Upload server artifact uses: actions/upload-artifact@v4 with: name: server-bundle - path: ${{env.DOTNET_ROOT}}/server + path: server include-hidden-files: true # Required for wwwroot/.well-known folder deploy_api_blazor: @@ -90,7 +90,7 @@ jobs: build_blazor_hybrid_windows: name: build blazor hybrid (windows) - runs-on: windows-2022 + runs-on: windows-2025 steps: diff --git a/.github/workflows/platform.website.cd.yml b/.github/workflows/platform.website.cd.yml index c87ea6487e..c221bd10b0 100644 --- a/.github/workflows/platform.website.cd.yml +++ b/.github/workflows/platform.website.cd.yml @@ -15,7 +15,7 @@ jobs: build_api_blazor: name: build api + blazor web - runs-on: ubuntu-24.04 + runs-on: windows-2025 steps: @@ -34,7 +34,7 @@ jobs: run: dotnet build src/Websites/Platform/src/Bit.Websites.Platform.Client/Bit.Websites.Platform.Client.csproj -t:BeforeBuildTasks -c Release -p:Version="${{ vars.APP_VERSION}}" - name: Publish - run: dotnet publish src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj -c Release -r linux-x64 -o server -p:Version="${{ vars.APP_VERSION}}" + run: dotnet publish src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj -c Release -o server -p:Version="${{ vars.APP_VERSION}}" - name: Upload server artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/sales-module-demo.cd.yml b/.github/workflows/sales-module-demo.cd.yml index ce64ea0dbc..3700856eb3 100644 --- a/.github/workflows/sales-module-demo.cd.yml +++ b/.github/workflows/sales-module-demo.cd.yml @@ -23,7 +23,7 @@ jobs: build_api_blazor: name: build api + blazor web - runs-on: ubuntu-24.04 + runs-on: windows-2025 steps: @@ -75,13 +75,13 @@ jobs: dotnet build SalesModule/src/Client/SalesModule.Client.Web/SalesModule.Client.Web.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true --no-restore -c Release - name: Publish - run: dotnet publish SalesModule/src/Server/SalesModule.Server.Web/SalesModule.Server.Web.csproj -c Release --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true + run: dotnet publish SalesModule/src/Server/SalesModule.Server.Web/SalesModule.Server.Web.csproj -c Release -o server -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true - name: Upload server artifact uses: actions/upload-artifact@v4 with: name: server-bundle - path: ${{env.DOTNET_ROOT}}/server + path: server include-hidden-files: true # Required for wwwroot/.well-known folder deploy_api_blazor: @@ -119,7 +119,7 @@ jobs: build_blazor_hybrid_windows: name: build blazor hybrid (windows) - runs-on: windows-2022 + runs-on: windows-2025 steps: diff --git a/.github/workflows/sales.website.cd.yml b/.github/workflows/sales.website.cd.yml index e7d5fed5dc..22fc7dbaa2 100644 --- a/.github/workflows/sales.website.cd.yml +++ b/.github/workflows/sales.website.cd.yml @@ -15,7 +15,7 @@ jobs: build_api_blazor: name: build api + blazor web - runs-on: ubuntu-24.04 + runs-on: windows-2025 steps: @@ -34,7 +34,7 @@ jobs: run: dotnet build src/Websites/Sales/src/Bit.Websites.Sales.Client/Bit.Websites.Sales.Client.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION}}" - name: Publish - run: dotnet publish src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj -c Release -r linux-x64 -o server -p:Version="${{ vars.APP_VERSION}}" + run: dotnet publish src/Websites/Sales/src/Bit.Websites.Sales.Server/Bit.Websites.Sales.Server.csproj -c Release -o server -p:Version="${{ vars.APP_VERSION}}" - name: Upload server artifact uses: actions/upload-artifact@v4 diff --git a/.github/workflows/todo-sample.cd.yml b/.github/workflows/todo-sample.cd.yml index 03d9f023ec..3b3dce7402 100644 --- a/.github/workflows/todo-sample.cd.yml +++ b/.github/workflows/todo-sample.cd.yml @@ -23,7 +23,7 @@ jobs: build_api_blazor: name: build api + blazor web - runs-on: ubuntu-24.04 + runs-on: windows-2025 steps: @@ -77,13 +77,13 @@ jobs: dotnet build TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish TodoSample/src/Server/TodoSample.Server.Web/TodoSample.Server.Web.csproj -c Release --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APP_VERSION}}" + run: dotnet publish TodoSample/src/Server/TodoSample.Server.Web/TodoSample.Server.Web.csproj -c Release -o server -p:Version="${{ vars.APP_VERSION}}" - name: Upload server artifact uses: actions/upload-artifact@v4 with: name: server-bundle - path: ${{env.DOTNET_ROOT}}/server + path: server include-hidden-files: true # Required for wwwroot/.well-known folder deploy_api_blazor: @@ -159,12 +159,12 @@ jobs: run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -c Release -o ${{env.DOTNET_ROOT}}/client -p:Version="${{ vars.APP_VERSION}}" -p:RunAOTCompilation=true -p:InvariantGlobalization=true + run: dotnet publish TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -c Release -o client -p:Version="${{ vars.APP_VERSION}}" -p:RunAOTCompilation=true -p:InvariantGlobalization=true - name: Upload to asw run: | npm install -g @azure/static-web-apps-cli - swa deploy --deployment-token ${{ secrets.TODO_AOT_ASW_TOKEN }} --env production --app-location ${{env.DOTNET_ROOT}}/client/wwwroot + swa deploy --deployment-token ${{ secrets.TODO_AOT_ASW_TOKEN }} --env production --app-location client/wwwroot deploy_blazor_wasm_standalone_offlineDb: name: build blazor wasm standalone (Offline database) @@ -210,12 +210,12 @@ jobs: run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true --no-restore -c Release - name: Publish - run: dotnet publish TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -c Release -o ${{env.DOTNET_ROOT}}/client -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true + run: dotnet publish TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -c Release -o client -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true - name: Upload to asw run: | npm install -g @azure/static-web-apps-cli - swa deploy --deployment-token ${{ secrets.TODO_OFFLINE_ASW_TOKEN }} --env production --app-location ${{env.DOTNET_ROOT}}/client/wwwroot + swa deploy --deployment-token ${{ secrets.TODO_OFFLINE_ASW_TOKEN }} --env production --app-location client/wwwroot deploy_blazor_wasm_standalone_small: name: build blazor wasm standalone (small) @@ -257,16 +257,16 @@ jobs: run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APP_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -c Release -o ${{env.DOTNET_ROOT}}/client -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true + run: dotnet publish TodoSample/src/Client/TodoSample.Client.Web/TodoSample.Client.Web.csproj -c Release -o client -p:Version="${{ vars.APP_VERSION}}" -p:InvariantGlobalization=true - name: Upload to asw run: | npm install -g @azure/static-web-apps-cli - swa deploy --deployment-token ${{ secrets.TODO_SMALL_ASW_TOKEN }} --env production --app-location ${{env.DOTNET_ROOT}}/client/wwwroot + swa deploy --deployment-token ${{ secrets.TODO_SMALL_ASW_TOKEN }} --env production --app-location client/wwwroot build_blazor_hybrid_windows: name: build blazor hybrid (windows) - runs-on: windows-2022 + runs-on: windows-2025 steps: diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/AppSettings.cs b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/AppSettings.cs index 3612238af2..d7746c8a7b 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/AppSettings.cs +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/AppSettings.cs @@ -9,6 +9,8 @@ public class AppSettings public TelegramBotSettings TelegramBotSettings { get; set; } = default!; public AzureOpenAIOptions AzureOpenAI { get; set; } = default!; + + public OpenAIOptions OpenAI { get; set; } = default!; } public class HealthCheckSettings @@ -28,3 +30,10 @@ public class AzureOpenAIOptions public Uri? ChatEndpoint { get; set; } public string? ChatApiKey { get; set; } } + +public class OpenAIOptions +{ + public string? ChatModel { get; set; } + public Uri? ChatEndpoint { get; set; } + public string? ChatApiKey { get; set; } +} diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj index d177941117..eab19f0214 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Bit.BlazorUI.Demo.Server.csproj @@ -21,6 +21,7 @@ + diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Services.cs b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Services.cs index b0c529afb1..ae4530f9ab 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Services.cs +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/Startup/Services.cs @@ -1,4 +1,5 @@ -using System.IO.Compression; +using System.ClientModel.Primitives; +using System.IO.Compression; using Bit.BlazorUI.Demo.Server.Services; using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.OData; @@ -63,6 +64,18 @@ public static void Add(IServiceCollection services, IWebHostEnvironment env, ICo .UseFunctionInvocation() .UseDistributedCache(); } + else if (string.IsNullOrEmpty(appSettings?.OpenAI?.ChatApiKey) is false) + { + // https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.AI.OpenAI#microsoftextensionsaiopenai + services.AddChatClient(sp => new OpenAI.Chat.ChatClient(model: appSettings.OpenAI.ChatModel, credential: new(appSettings.OpenAI.ChatApiKey), options: new() + { + Endpoint = appSettings.OpenAI.ChatEndpoint, + Transport = new HttpClientPipelineTransport(sp.GetRequiredService().CreateClient("AI")) + }).AsIChatClient()) + .UseLogging() + .UseFunctionInvocation() + .UseDistributedCache(); + } services.AddDistributedMemoryCache(); diff --git a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/appsettings.json b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/appsettings.json index 4cd4ee8194..0ef924ff63 100644 --- a/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/appsettings.json +++ b/src/BlazorUI/Demo/Bit.BlazorUI.Demo.Server/appsettings.json @@ -22,6 +22,11 @@ "ChatModel": "gpt-4.1-mini", "ChatApiKey": null, "ChatEndpoint": null + }, + "OpenAI": { + "ChatModel": "gpt-4.1-mini", + "ChatApiKey": null, + "ChatEndpoint": null } }, "AllowedHosts": "*" diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml b/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml index 18762633dc..9dd239ee57 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.azure-devops/workflows/cd.yml @@ -104,7 +104,7 @@ jobs: displayName: 'build blazor hybrid (windows)' pool: - vmImage: 'windows-2022' + vmImage: 'windows-2025' steps: - task: UseDotNet@2 diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd-template.yml b/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd-template.yml index 04f0fe96b3..a933e2514c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd-template.yml +++ b/src/Templates/Boilerplate/Bit.Boilerplate/.github/workflows/cd-template.yml @@ -58,12 +58,12 @@ jobs: dotnet build src/Client/Boilerplate.Client.Web/Boilerplate.Client.Web.csproj -t:BeforeBuildTasks --no-restore -c Release -p:Version="${{ vars.APP_VERSION }}" - name: Publish - run: dotnet publish src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj -c Release --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APP_VERSION }}" -p:Environment=${{ inputs.ENV_NAME }} + run: dotnet publish src/Server/Boilerplate.Server.Web/Boilerplate.Server.Web.csproj -c Release --self-contained -r linux-x64 -o server -p:Version="${{ vars.APP_VERSION }}" -p:Environment=${{ inputs.ENV_NAME }} - name: Upload server artifact uses: actions/upload-artifact@v4 with: name: server-bundle - path: ${{env.DOTNET_ROOT}}/server + path: server include-hidden-files: true # Required for wwwroot/.well-known folder deploy_api_blazor: @@ -100,7 +100,7 @@ jobs: build_blazor_hybrid_windows: name: build blazor hybrid (windows) - runs-on: windows-2022 + runs-on: windows-2025 environment: ${{ inputs.ENV_NAME }} steps: diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props index 7fbeac5519..64db284dac 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Directory.Packages.props @@ -86,6 +86,7 @@ + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj index eda20ed35b..43b8c5cf2c 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Boilerplate.Server.Api.csproj @@ -65,6 +65,7 @@ + diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Data/Configurations/Product/ProductConfiguration.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Data/Configurations/Product/ProductConfiguration.cs index 40b7fba6d4..be96595205 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Data/Configurations/Product/ProductConfiguration.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Data/Configurations/Product/ProductConfiguration.cs @@ -19,12 +19,7 @@ public void Configure(EntityTypeBuilder builder) //#if (database == "PostgreSQL" || database == "SqlServer") if (AppDbContext.IsEmbeddingEnabled) { - builder.Property(p => p.Embedding).HasColumnType("vector(384)"); // Checkout appsettings.json's AI:EmbeddingOptions:Dimensions - //#if (database == "PostgreSQL") - builder.HasIndex(m => m.Embedding) - .HasMethod("hnsw") // ivfflat - .HasOperators("vector_cosine_ops"); - //#endif + builder.Property(p => p.Embedding).HasColumnType("vector(768)"); // Checkout appsettings.json's AI:EmbeddingOptions:Dimensions } else { diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs index d6a0b6eacd..b0e381328f 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/Program.Services.cs @@ -442,6 +442,20 @@ void AddDbContext(DbContextOptionsBuilder options) .UseOpenTelemetry(); // .UseDistributedCache() } + else if (string.IsNullOrEmpty(appSettings.AI?.HuggingFace?.EmbeddingEndpoint) is false) + { + services.AddEmbeddingGenerator(sp => new Microsoft.SemanticKernel.Connectors.HuggingFace.HuggingFaceEmbeddingGenerator( + new Uri(appSettings.AI.HuggingFace.EmbeddingEndpoint), + apiKey: appSettings.AI.HuggingFace.EmbeddingApiKey, + httpClient: sp.GetRequiredService().CreateClient("AI"), loggerFactory: sp.GetRequiredService())) + .ConfigureOptions(options => + { + configuration.GetRequiredSection("AI:EmbeddingOptions").Bind(options); + }) + .UseLogging() + .UseOpenTelemetry(); + // .UseDistributedCache() + } else { services.AddEmbeddingGenerator(sp => new LocalTextEmbeddingGenerationService() diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/ServerApiSettings.cs b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/ServerApiSettings.cs index 177d866234..86330fb25a 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/ServerApiSettings.cs +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/ServerApiSettings.cs @@ -160,6 +160,7 @@ public partial class AIOptions { public OpenAIOptions? OpenAI { get; set; } public AzureOpenAIOptions? AzureOpenAI { get; set; } + public HuggingFaceOptions? HuggingFace { get; set; } } public class OpenAIOptions @@ -184,6 +185,13 @@ public class AzureOpenAIOptions public string? EmbeddingApiKey { get; set; } } +public class HuggingFaceOptions +{ + public string? EmbeddingApiKey { get; set; } + + public string? EmbeddingEndpoint { get; set; } +} + //#endif public partial class EmailOptions diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json index e5c3334b0e..cf687faf92 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Api/appsettings.json @@ -40,7 +40,7 @@ "Temperature": 0 }, "EmbeddingOptions": { - "Dimensions": 384 + "Dimensions": 768 }, "ChatOptions_Comment": "Configures Temperature, TopP, TopK and the rest of the properties of Microsoft.Extensions.AI.ChatOptions", "OpenAI": { @@ -62,6 +62,10 @@ "EmbeddingApiKey": null, "EmbeddingApiKey_Comment": "Get one at https://portal.azure.com", "EmbeddingEndpoint": "https://yourResourceName.openai.azure.com/openai/deployments/yourDeployment" + }, + "HuggingFace": { + "EmbeddingApiKey": null, + "EmbeddingEndpoint": null } }, //#endif diff --git a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json index 00fb09de1f..41fd1e3a54 100644 --- a/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json +++ b/src/Templates/Boilerplate/Bit.Boilerplate/src/Server/Boilerplate.Server.Web/appsettings.json @@ -37,7 +37,7 @@ "Temperature": 0 }, "EmbeddingOptions": { - "Dimensions": 384 + "Dimensions": 768 }, "OpenAI": { "ChatModel": "gpt-4.1-mini", @@ -54,6 +54,10 @@ "EmbeddingModel": "text-embedding-3-small", "EmbeddingApiKey": null, "EmbeddingEndpoint": "https://yourResourceName.openai.azure.com/openai/deployments/yourDeployment" + }, + "HuggingFace": { + "EmbeddingApiKey": null, + "EmbeddingEndpoint": null } }, "Email": { diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Server/AppSettings.cs b/src/Websites/Platform/src/Bit.Websites.Platform.Server/AppSettings.cs index 96cb71fb2c..4161f0a4b1 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Server/AppSettings.cs +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Server/AppSettings.cs @@ -7,6 +7,8 @@ public class AppSettings public TelegramBotSettings TelegramBotSettings { get; set; } = default!; public AzureOpenAIOptions AzureOpenAI { get; set; } = default!; + + public OpenAIOptions OpenAI { get; set; } = default!; } public class HealthCheckSettings @@ -26,3 +28,10 @@ public class AzureOpenAIOptions public Uri? ChatEndpoint { get; set; } public string? ChatApiKey { get; set; } } + +public class OpenAIOptions +{ + public string? ChatModel { get; set; } + public Uri? ChatEndpoint { get; set; } + public string? ChatApiKey { get; set; } +} diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj index 59187ea7a4..642d35884c 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Bit.Websites.Platform.Server.csproj @@ -10,6 +10,7 @@ + diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Services.cs b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Services.cs index 7c4f47ec2a..d3756bb7fa 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Services.cs +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Server/Startup/Services.cs @@ -4,6 +4,7 @@ using Bit.Websites.Platform.Server.Services; using Microsoft.AspNetCore.Antiforgery; using Microsoft.Extensions.AI; +using System.ClientModel.Primitives; namespace Bit.Websites.Platform.Server.Startup; @@ -54,6 +55,18 @@ public static void Add(IServiceCollection services, IWebHostEnvironment env, ICo .UseFunctionInvocation() .UseDistributedCache(); } + else if (string.IsNullOrEmpty(appSettings?.OpenAI?.ChatApiKey) is false) + { + // https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.AI.OpenAI#microsoftextensionsaiopenai + services.AddChatClient(sp => new OpenAI.Chat.ChatClient(model: appSettings.OpenAI.ChatModel, credential: new(appSettings.OpenAI.ChatApiKey), options: new() + { + Endpoint = appSettings.OpenAI.ChatEndpoint, + Transport = new HttpClientPipelineTransport(sp.GetRequiredService().CreateClient("AI")) + }).AsIChatClient()) + .UseLogging() + .UseFunctionInvocation() + .UseDistributedCache(); + } services.AddDistributedMemoryCache(); diff --git a/src/Websites/Platform/src/Bit.Websites.Platform.Server/appsettings.json b/src/Websites/Platform/src/Bit.Websites.Platform.Server/appsettings.json index 5b3a473440..daabe1d5bb 100644 --- a/src/Websites/Platform/src/Bit.Websites.Platform.Server/appsettings.json +++ b/src/Websites/Platform/src/Bit.Websites.Platform.Server/appsettings.json @@ -6,9 +6,6 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "GoogleTagManager": { - "Id": "" - }, "AppSettings": { "HealthCheckSettings": { "EnableHealthChecks": false @@ -24,6 +21,11 @@ "ChatModel": "gpt-4.1-mini", "ChatApiKey": null, "ChatEndpoint": null + }, + "OpenAI": { + "ChatModel": "gpt-4.1-mini", + "ChatApiKey": null, + "ChatEndpoint": null } }, "AllowedHosts": "*" diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Client/Components/PageOutlet.razor b/src/Websites/Sales/src/Bit.Websites.Sales.Client/Components/PageOutlet.razor index 4d673c1122..c7ec44a9bb 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Client/Components/PageOutlet.razor +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Client/Components/PageOutlet.razor @@ -4,7 +4,7 @@ - + @@ -20,5 +20,5 @@ [Parameter] public string? Title { get; set; } [Parameter] public string? Description { get; set; } [Parameter] public string? Url { get; set; } - [Parameter] public string ImageUrl { get; set; } = "https://bitservices.company/images/og-image.svg"; + [Parameter] public string ImageUrl { get; set; } = "https://services.bitplatform.dev/images/og-image.svg"; } \ No newline at end of file diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Client/Shared/Footer.razor b/src/Websites/Sales/src/Bit.Websites.Sales.Client/Shared/Footer.razor index a088f686b7..ab3f5755b2 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Client/Shared/Footer.razor +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Client/Shared/Footer.razor @@ -9,7 +9,7 @@
Sofware Dev Team as a Service
- + diff --git a/src/Websites/Sales/src/Bit.Websites.Sales.Server/appsettings.json b/src/Websites/Sales/src/Bit.Websites.Sales.Server/appsettings.json index 6bc99abc99..5494283715 100644 --- a/src/Websites/Sales/src/Bit.Websites.Sales.Server/appsettings.json +++ b/src/Websites/Sales/src/Bit.Websites.Sales.Server/appsettings.json @@ -6,9 +6,6 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "GoogleTagManager": { - "Id": "" - }, "AppSettings": { "HealthCheckSettings": { "EnableHealthChecks": false