diff --git a/.github/workflows/build-and-publish-inferpage.yml b/.github/workflows/build-and-publish-inferpage.yml index 3c47300a..64366c0e 100644 --- a/.github/workflows/build-and-publish-inferpage.yml +++ b/.github/workflows/build-and-publish-inferpage.yml @@ -15,7 +15,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4 with: - dotnet-version: '8.0.x' + dotnet-version: '10.0.x' - name: Restore dependencies run: dotnet restore src/MaIN.InferPage @@ -24,7 +24,7 @@ jobs: run: dotnet build src/MaIN.InferPage --configuration Release --no-restore - name: Publish project - run: dotnet publish src/MaIN.InferPage --configuration Release --output ./publish --no-build + run: dotnet publish src/MaIN.InferPage --framework net10.0 --configuration Release --output ./publish --no-build - name: Upload build artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c7bcb0e3..8b537330 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -18,7 +18,7 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: '8.0.x' # Change to your project’s .NET version + dotnet-version: '10.0.x' # Change to your project’s .NET version - name: Restore dependencies run: dotnet restore diff --git a/Examples/Examples.SimpleConsole/Examples.SimpleConsole.csproj b/Examples/Examples.SimpleConsole/Examples.SimpleConsole.csproj index 6197c832..773c979c 100644 --- a/Examples/Examples.SimpleConsole/Examples.SimpleConsole.csproj +++ b/Examples/Examples.SimpleConsole/Examples.SimpleConsole.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net8.0;net10.0 enable false enable diff --git a/Examples/Examples/Chat/ChatWithTextToSpeechExample.cs b/Examples/Examples/Chat/ChatWithTextToSpeechExample.cs index 1718415d..9b3640aa 100644 --- a/Examples/Examples/Chat/ChatWithTextToSpeechExample.cs +++ b/Examples/Examples/Chat/ChatWithTextToSpeechExample.cs @@ -1,6 +1,7 @@ using MaIN.Core.Hub; using MaIN.Domain.Entities; using MaIN.Services.Services.TTSService; +#pragma warning disable CS0618 // Type or member is obsolete namespace Examples.Chat; diff --git a/Examples/Examples/Examples.csproj b/Examples/Examples/Examples.csproj index 1f0b2265..db2dc64e 100644 --- a/Examples/Examples/Examples.csproj +++ b/Examples/Examples/Examples.csproj @@ -2,7 +2,7 @@ Exe - net8.0 + net8.0;net10.0 enable enable false diff --git a/MaIN.Core.IntegrationTests/ChatTests.cs b/MaIN.Core.IntegrationTests/ChatTests.cs index 4521a291..89952c05 100644 --- a/MaIN.Core.IntegrationTests/ChatTests.cs +++ b/MaIN.Core.IntegrationTests/ChatTests.cs @@ -1,15 +1,11 @@ -using System.Text.Json; -using MaIN.Core.Hub; -using MaIN.Domain.Configuration; +using MaIN.Core.Hub; using MaIN.Domain.Entities; -using Microsoft.AspNetCore.Mvc.Testing; -using Microsoft.Extensions.Configuration; namespace MaIN.Core.IntegrationTests; public class ChatTests : IntegrationTestBase { - public ChatTests(WebApplicationFactory factory) : base(factory) + public ChatTests() : base() { } diff --git a/MaIN.Core.IntegrationTests/IntegrationTestBase.cs b/MaIN.Core.IntegrationTests/IntegrationTestBase.cs index 5fad47fe..19e76807 100644 --- a/MaIN.Core.IntegrationTests/IntegrationTestBase.cs +++ b/MaIN.Core.IntegrationTests/IntegrationTestBase.cs @@ -1,32 +1,51 @@ using System.Net.Sockets; using MaIN.Services; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.AspNetCore.Hosting.Server; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace MaIN.Core.IntegrationTests; -public class IntegrationTestBase : IClassFixture> +public class IntegrationTestBase : IDisposable { - protected readonly WebApplicationFactory _factory; - protected readonly HttpClient _client; + protected readonly IHost _host; + protected readonly IServiceProvider _services; - public IntegrationTestBase(WebApplicationFactory factory) + public IntegrationTestBase() { - _factory = factory.WithWebHostBuilder(builder => - { - builder.ConfigureServices((context, services) => + _host = CreateHost(); + _host.Start(); + + _services = _host.Services; + } + + private IHost CreateHost() + { + var hostBuilder = Host.CreateDefaultBuilder() + .ConfigureWebHostDefaults(webBuilder => { - services.AddMaIN(context.Configuration); - - var provider = services.BuildServiceProvider(); - provider.UseMaIN(); + webBuilder + .UseUrls("http://localhost:0") // Random available port + .ConfigureServices((context, services) => + { + services.AddMaIN(context.Configuration); + + var provider = services.BuildServiceProvider(); + provider.UseMaIN(); + }); }); - }); - - _client = _factory.CreateClient(); + + return hostBuilder.Build(); } - + + protected T GetService() where T : notnull + { + return _services.GetRequiredService(); + } + protected static bool PingHost(string host, int port, int timeout) { try @@ -50,4 +69,9 @@ protected static bool PingHost(string host, int port, int timeout) return false; } } + + public void Dispose() + { + _host?.Dispose(); + } } \ No newline at end of file diff --git a/MaIN.Core.IntegrationTests/MaIN.Core.IntegrationTests.csproj b/MaIN.Core.IntegrationTests/MaIN.Core.IntegrationTests.csproj index a44eed37..02d992bc 100644 --- a/MaIN.Core.IntegrationTests/MaIN.Core.IntegrationTests.csproj +++ b/MaIN.Core.IntegrationTests/MaIN.Core.IntegrationTests.csproj @@ -1,18 +1,21 @@  - net8.0 + net8.0;net10.0 enable enable false - - + + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -21,7 +24,6 @@ - diff --git a/MaIN.sln b/MaIN.sln index 6caec3ce..cfd8fda4 100644 --- a/MaIN.sln +++ b/MaIN.sln @@ -1,15 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaIN", "src\MaIN\MaIN.csproj", "{7E8DD6E0-F9A8-4BD0-8733-49F0F2F4FCA0}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Main.Infrastructure", "src\MaIN.Infrastructure\MaIN.Infrastructure.csproj", "{84C09EF9-B9E3-4ACB-9BC3-DEFFC29D528F}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaIN.Services", "src\MaIN.Services\MaIN.Services.csproj", "{35DBE637-EC89-40A7-B5F9-D005D554E8ED}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaIN.Domain", "src\MaIN.Domain\MaIN.Domain.csproj", "{4DEF4AA6-DFD8-4626-B8BE-2F773B12FE0C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaIN.RAG.Demo", "src\MaIN.RAG.Demo\MaIN.RAG.Demo.csproj", "{2351B015-EA33-42F3-A844-CECABF140E9A}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MaIN.Core", "src\MaIN.Core\MaIN.Core.csproj", "{E3CFD135-0339-4539-A5FB-96CBE92A8EA7}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{28851935-517F-438D-BF7C-02FEB1A37A68}" @@ -32,10 +28,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7E8DD6E0-F9A8-4BD0-8733-49F0F2F4FCA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7E8DD6E0-F9A8-4BD0-8733-49F0F2F4FCA0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7E8DD6E0-F9A8-4BD0-8733-49F0F2F4FCA0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7E8DD6E0-F9A8-4BD0-8733-49F0F2F4FCA0}.Release|Any CPU.Build.0 = Release|Any CPU {84C09EF9-B9E3-4ACB-9BC3-DEFFC29D528F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {84C09EF9-B9E3-4ACB-9BC3-DEFFC29D528F}.Debug|Any CPU.Build.0 = Debug|Any CPU {84C09EF9-B9E3-4ACB-9BC3-DEFFC29D528F}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -48,10 +40,6 @@ Global {4DEF4AA6-DFD8-4626-B8BE-2F773B12FE0C}.Debug|Any CPU.Build.0 = Debug|Any CPU {4DEF4AA6-DFD8-4626-B8BE-2F773B12FE0C}.Release|Any CPU.ActiveCfg = Release|Any CPU {4DEF4AA6-DFD8-4626-B8BE-2F773B12FE0C}.Release|Any CPU.Build.0 = Release|Any CPU - {2351B015-EA33-42F3-A844-CECABF140E9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2351B015-EA33-42F3-A844-CECABF140E9A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2351B015-EA33-42F3-A844-CECABF140E9A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2351B015-EA33-42F3-A844-CECABF140E9A}.Release|Any CPU.Build.0 = Release|Any CPU {E3CFD135-0339-4539-A5FB-96CBE92A8EA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E3CFD135-0339-4539-A5FB-96CBE92A8EA7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E3CFD135-0339-4539-A5FB-96CBE92A8EA7}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/Releases/0.8.0.md b/Releases/0.8.0.md new file mode 100644 index 00000000..f1e51212 --- /dev/null +++ b/Releases/0.8.0.md @@ -0,0 +1,3 @@ +# 0.8.0 release + +- Update libraries to .NET 10 \ No newline at end of file diff --git a/src/MaIN.Core.UnitTests/MaIN.Core.UnitTests.csproj b/src/MaIN.Core.UnitTests/MaIN.Core.UnitTests.csproj index 2a948d2d..baf5b5a1 100644 --- a/src/MaIN.Core.UnitTests/MaIN.Core.UnitTests.csproj +++ b/src/MaIN.Core.UnitTests/MaIN.Core.UnitTests.csproj @@ -1,7 +1,7 @@ - net8.0 + net8.0;net10.0 enable enable @@ -10,11 +10,17 @@ - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/src/MaIN.Core/.nuspec b/src/MaIN.Core/.nuspec index d3453236..0ab9801e 100644 --- a/src/MaIN.Core/.nuspec +++ b/src/MaIN.Core/.nuspec @@ -2,7 +2,7 @@ MaIN.NET - 0.7.10 + 0.8.0 Wisedev Wisedev favicon.png @@ -11,17 +11,16 @@ https://github.com/wisedev-code/MaIN.NET - - + + - + - + - diff --git a/src/MaIN.Core/MaIN.Core.csproj b/src/MaIN.Core/MaIN.Core.csproj index 6ac86b70..b01cc99d 100644 --- a/src/MaIN.Core/MaIN.Core.csproj +++ b/src/MaIN.Core/MaIN.Core.csproj @@ -1,18 +1,18 @@ - net8.0 + net8.0;net10.0 enable enable .nuspec - - + + - + diff --git a/src/MaIN.Domain/Entities/Tools/ToolInvocation.cs b/src/MaIN.Domain/Entities/Tools/ToolInvocation.cs index af9ac663..bb68b01f 100644 --- a/src/MaIN.Domain/Entities/Tools/ToolInvocation.cs +++ b/src/MaIN.Domain/Entities/Tools/ToolInvocation.cs @@ -2,7 +2,7 @@ public class ToolInvocation { - public string ToolName { get; set; } + public required string ToolName { get; set; } public string Arguments { get; set; } = null!; public bool Done { get; set; } = false; } \ No newline at end of file diff --git a/src/MaIN.Domain/MaIN.Domain.csproj b/src/MaIN.Domain/MaIN.Domain.csproj index 8c658fe8..f6f64701 100644 --- a/src/MaIN.Domain/MaIN.Domain.csproj +++ b/src/MaIN.Domain/MaIN.Domain.csproj @@ -1,7 +1,7 @@  - net8.0 + net8.0;net10.0 enable enable false diff --git a/src/MaIN.InferPage/MaIN.InferPage.csproj b/src/MaIN.InferPage/MaIN.InferPage.csproj index 3e8cfacb..edf4893a 100644 --- a/src/MaIN.InferPage/MaIN.InferPage.csproj +++ b/src/MaIN.InferPage/MaIN.InferPage.csproj @@ -1,7 +1,7 @@ - net8.0 + net8.0;net10.0 enable enable false @@ -11,9 +11,9 @@ all - - - + + + diff --git a/src/MaIN.Infrastructure/MaIN.Infrastructure.csproj b/src/MaIN.Infrastructure/MaIN.Infrastructure.csproj index 0507bcf1..5fbcd3c1 100644 --- a/src/MaIN.Infrastructure/MaIN.Infrastructure.csproj +++ b/src/MaIN.Infrastructure/MaIN.Infrastructure.csproj @@ -1,7 +1,7 @@  - net8.0 + net8.0;net10.0 enable false enable @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/src/MaIN.RAG.Demo/MaIN.RAG.Demo.csproj b/src/MaIN.RAG.Demo/MaIN.RAG.Demo.csproj deleted file mode 100644 index 37dc7448..00000000 --- a/src/MaIN.RAG.Demo/MaIN.RAG.Demo.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - - Always - - - - diff --git a/src/MaIN.RAG.Demo/MaIN.RAG.Demo.http b/src/MaIN.RAG.Demo/MaIN.RAG.Demo.http deleted file mode 100644 index fdce86c5..00000000 --- a/src/MaIN.RAG.Demo/MaIN.RAG.Demo.http +++ /dev/null @@ -1,6 +0,0 @@ -@MaIN.RAG.Demo_HostAddress = http://localhost:5098 - -GET {{MaIN.RAG.Demo_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/src/MaIN.RAG.Demo/Program.cs b/src/MaIN.RAG.Demo/Program.cs deleted file mode 100644 index 4a4dcb1f..00000000 --- a/src/MaIN.RAG.Demo/Program.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Text.Json; - -var builder = WebApplication.CreateBuilder(args); - -// Add services to the container. -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); - -var app = builder.Build(); -app.UseSwagger(); -app.UseSwaggerUI(); - -app.UseHttpsRedirection(); - -var serializeOptions = new JsonSerializerOptions -{ - PropertyNamingPolicy = JsonNamingPolicy.CamelCase, - WriteIndented = true -}; - -app.MapGet("/items/", () => Results.Ok( - JsonSerializer.Deserialize>( - File.ReadAllText("json/items.json"), serializeOptions))) - .WithName("GetHardwareItems") - .WithOpenApi(); - -app.Run(); - - -public class Hardware -{ - public int Id { get; set; } - public string Image { get; set; } = null!; - public string Name { get; set; } = null!; - public string Brand { get; set; } = null!; - public string Processor { get; set; } = null!; - public string Type { get; set; } = null!; - public string Ram { get; set; } = null!; - public string Storage { get; set; } = null!; - public string Gpu { get; set; } = null!; - public double Price { get; set; } - public string Availability { get; set; } = null!; - public string Description { get; set; } = null!; -} \ No newline at end of file diff --git a/src/MaIN.RAG.Demo/Properties/launchSettings.json b/src/MaIN.RAG.Demo/Properties/launchSettings.json deleted file mode 100644 index 75df4c08..00000000 --- a/src/MaIN.RAG.Demo/Properties/launchSettings.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:54552", - "sslPort": 44303 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:5098", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7205;http://localhost:5098", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/src/MaIN.RAG.Demo/appsettings.Development.json b/src/MaIN.RAG.Demo/appsettings.Development.json deleted file mode 100644 index dc23838b..00000000 --- a/src/MaIN.RAG.Demo/appsettings.Development.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug" - } - } -} diff --git a/src/MaIN.RAG.Demo/appsettings.json b/src/MaIN.RAG.Demo/appsettings.json deleted file mode 100644 index 10f68b8c..00000000 --- a/src/MaIN.RAG.Demo/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/src/MaIN.RAG.Demo/json/items.json b/src/MaIN.RAG.Demo/json/items.json deleted file mode 100644 index a221d646..00000000 --- a/src/MaIN.RAG.Demo/json/items.json +++ /dev/null @@ -1,170 +0,0 @@ -[ - { - "id": 1, - "image": "pc1.jpg", - "type": "PC", - "name": "Gaming PC Ultra", - "brand": "PowerTech", - "processor": "Intel Core i9-11900K", - "ram": "32GB DDR4", - "storage": "1TB SSD + 2TB HDD", - "gpu": "NVIDIA GeForce RTX 3090", - "price": 2999.99, - "availability": "In Stock", - "description": "The Gaming PC Ultra from PowerTech features an Intel Core i9 processor and NVIDIA RTX 3090, making it perfect for high-end gaming and demanding applications. With 32GB of RAM and ample storage, this PC can handle any task with ease." - }, - { - "id": 2, - "image": "pc2.png", - "type": "PC", - "name": "Workstation Pro", - "brand": "TechMaster", - "processor": "AMD Ryzen 9 5950X", - "ram": "64GB DDR4", - "storage": "2TB SSD", - "gpu": "NVIDIA Quadro RTX 5000", - "price": 3499.99, - "availability": "In Stock", - "description": "TechMaster's Workstation Pro is designed for professionals who require top-tier performance. With an AMD Ryzen 9 CPU, 64GB RAM, and NVIDIA Quadro RTX GPU, this workstation excels in 3D rendering, video editing, and other intensive tasks." - }, - { - "id": 3, - "image": "pc3.jpg", - "type": "PC", - "name": "Budget Gamer", - "brand": "EconoPC", - "processor": "Intel Core i5-10400F", - "ram": "16GB DDR4", - "storage": "512GB SSD", - "gpu": "NVIDIA GeForce GTX 1660 Super", - "price": 799.99, - "availability": "Out of Stock", - "description": "The Budget Gamer by EconoPC provides excellent value for entry-level gaming. Featuring an Intel Core i5 processor and NVIDIA GTX 1660 Super GPU, this PC delivers smooth performance for popular games at an affordable price." - }, - { - "id": 4, - "image": "pc4.jpg", - "type": "PC", - "name": "All-Purpose PC", - "brand": "ValueComp", - "processor": "AMD Ryzen 5 3600", - "ram": "16GB DDR4", - "storage": "1TB HDD", - "gpu": "AMD Radeon RX 5700", - "price": 999.99, - "availability": "In Stock", - "description": "ValueComp's All-Purpose PC is a versatile system suitable for gaming, work, and everyday use. It features an AMD Ryzen 5 processor, 16GB RAM, and a Radeon RX 5700 GPU, ensuring balanced performance for a variety of tasks." - }, - { - "id": 5, - "image": "pc5.jpg", - "type": "PC", - "name": "Compact Office PC", - "brand": "OfficeMate", - "processor": "Intel Core i3-10100", - "ram": "8GB DDR4", - "storage": "256GB SSD", - "gpu": "Integrated Graphics", - "price": 499.99, - "availability": "In Stock", - "description": "The Compact Office PC by OfficeMate is ideal for small spaces and routine office tasks. Equipped with an Intel Core i3 processor and 8GB of RAM, it offers reliable performance for word processing, spreadsheets, and internet browsing." - }, - { - "id": 6, - "image": "pc6.jpg", - "type": "PC", - "name": "Performance Beast", - "brand": "ExtremeTech", - "processor": "Intel Core i7-12700K", - "ram": "32GB DDR5", - "storage": "2TB SSD", - "gpu": "NVIDIA GeForce RTX 3080", - "price": 2599.99, - "availability": "In Stock", - "description": "ExtremeTech's Performance Beast is designed for the most demanding users. With an Intel Core i7 processor, 32GB DDR5 RAM, and NVIDIA RTX 3080 GPU, this PC is ideal for gaming, 3D rendering, and other high-performance applications." - }, - { - "id": 7, - "image": "laptop1.jpg", - "type": "Laptop", - "name": "UltraBook Pro", - "brand": "PowerTech", - "processor": "Intel Core i7-1165G7", - "ram": "16GB LPDDR4x", - "storage": "512GB SSD", - "gpu": "Intel Iris Xe Graphics", - "price": 1299.99, - "availability": "In Stock", - "description": "The UltraBook Pro by PowerTech offers a sleek design with powerful performance, featuring an Intel Core i7 processor and Intel Iris Xe Graphics. With 16GB of RAM and a 512GB SSD, this laptop is perfect for professionals on the go." - }, - { - "id": 8, - "image": "laptop2.jpg", - "type": "Laptop", - "name": "Gaming Laptop X", - "brand": "TechMaster", - "processor": "AMD Ryzen 7 5800H", - "ram": "32GB DDR4", - "storage": "1TB SSD", - "gpu": "NVIDIA GeForce RTX 3070", - "price": 1999.99, - "availability": "In Stock", - "description": "TechMaster's Gaming Laptop X is designed for gamers who need high performance on the go. Featuring an AMD Ryzen 7 CPU and NVIDIA RTX 3070 GPU, this laptop delivers smooth gaming experiences and fast load times." - }, - { - "id": 9, - "image": "laptop3.jpg", - "type": "Laptop", - "name": "Budget Laptop", - "brand": "EconoPC", - "processor": "Intel Core i3-1115G4", - "ram": "8GB DDR4", - "storage": "256GB SSD", - "gpu": "Integrated Graphics", - "price": 499.99, - "availability": "Out of Stock", - "description": "The Budget Laptop by EconoPC offers essential features at an affordable price. With an Intel Core i3 processor and 8GB of RAM, it's suitable for students and casual users who need reliable performance for everyday tasks." - }, - { - "id": 10, - "image": "laptop4.jpg", - "type": "Laptop", - "name": "All-Purpose Laptop", - "brand": "ValueComp", - "processor": "AMD Ryzen 5 4500U", - "ram": "16GB DDR4", - "storage": "512GB SSD", - "gpu": "AMD Radeon Graphics", - "price": 899.99, - "availability": "In Stock", - "description": "ValueComp's All-Purpose Laptop is versatile and powerful, equipped with an AMD Ryzen 5 processor and Radeon Graphics. It's ideal for a variety of tasks, including work, entertainment, and light gaming." - }, - { - "id": 11, - "image": "laptop5.jpg", - "type": "Laptop", - "name": "Compact Office Laptop", - "brand": "OfficeMate", - "processor": "Intel Core i5-1135G7", - "ram": "8GB LPDDR4x", - "storage": "512GB SSD", - "gpu": "Intel Iris Xe Graphics", - "price": 799.99, - "availability": "In Stock", - "description": "The Compact Office Laptop by OfficeMate is perfect for professionals who need a portable and efficient device. With an Intel Core i5 processor and 8GB of RAM, it offers solid performance for office applications and multitasking." - }, - { - "id": 12, - "image": "laptop6.jpg", - "type": "Laptop", - "name": "Creative Laptop", - "brand": "CreativeTech", - "processor": "Apple M1", - "ram": "16GB Unified Memory", - "storage": "1TB SSD", - "gpu": "Apple M1 GPU", - "price": 1499.99, - "availability": "In Stock", - "description": "CreativeTech's Creative Laptop is perfect for designers and content creators. Featuring the Apple M1 chip, 16GB of unified memory, and a 1TB SSD, this laptop offers exceptional performance and efficiency for creative tasks." - } -] diff --git a/src/MaIN.Services/MaIN.Services.csproj b/src/MaIN.Services/MaIN.Services.csproj index 99f827b7..c78149be 100644 --- a/src/MaIN.Services/MaIN.Services.csproj +++ b/src/MaIN.Services/MaIN.Services.csproj @@ -1,7 +1,7 @@  - net8.0 + net8.0;net10.0 enable enable false @@ -13,17 +13,17 @@ - - + + - + - + diff --git a/src/MaIN.Services/Services/LLMService/AnthropicService.cs b/src/MaIN.Services/Services/LLMService/AnthropicService.cs index e7ec783d..56b4554f 100644 --- a/src/MaIN.Services/Services/LLMService/AnthropicService.cs +++ b/src/MaIN.Services/Services/LLMService/AnthropicService.cs @@ -488,7 +488,7 @@ private object BuildAnthropicRequestBody(Chat chat, List conversati { requestBody["tools"] = chat.ToolsConfiguration.Tools.Select(t => new { - name = t.Function.Name, + name = t.Function!.Name, description = t.Function.Description, input_schema = t.Function.Parameters }).ToList(); @@ -824,10 +824,10 @@ file class AnthropicDelta file class AnthropicModelListResponse { - public List Data { get; set; } + public required List Data { get; set; } } file class AnthropicModelInfo { - public string Id { get; set; } + public required string Id { get; set; } } \ No newline at end of file diff --git a/src/MaIN.Services/Services/LLMService/GeminiService.cs b/src/MaIN.Services/Services/LLMService/GeminiService.cs index b3698f8f..9e62372a 100644 --- a/src/MaIN.Services/Services/LLMService/GeminiService.cs +++ b/src/MaIN.Services/Services/LLMService/GeminiService.cs @@ -21,7 +21,9 @@ public sealed class GeminiService( IMemoryFactory memoryFactory, IMemoryService memoryService, ILogger? logger = null) +#pragma warning disable CS9107 // Parameter is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well. : OpenAiCompatibleService(notificationService, httpClientFactory, memoryFactory, memoryService, logger) +#pragma warning restore CS9107 // Parameter is captured into the state of the enclosing type and its value is also passed to the base constructor. The value might be captured by the base class as well. { private readonly MaINSettings _settings = settings ?? throw new ArgumentNullException(nameof(settings)); diff --git a/src/MaIN.Services/Services/LLMService/Memory/LLamaSharpTextGen.cs b/src/MaIN.Services/Services/LLMService/Memory/LLamaSharpTextGen.cs index c5646a64..95791a69 100644 --- a/src/MaIN.Services/Services/LLMService/Memory/LLamaSharpTextGen.cs +++ b/src/MaIN.Services/Services/LLMService/Memory/LLamaSharpTextGen.cs @@ -28,9 +28,7 @@ public sealed class LlamaSharpTextGen : ITextGenerator, IDisposable { private readonly BatchedExecutor _executor; private readonly LLamaWeights _weights; - private readonly bool _ownsWeights; private readonly LLamaContext _context; - private readonly bool _ownsContext; private readonly InferenceParams? _defaultInferenceParams; private readonly MemoryParams? _memoryParams; @@ -49,7 +47,6 @@ public LlamaSharpTextGen(LLamaSharpConfig config) _context = _weights.CreateContext(@params); _executor = new BatchedExecutor(_weights, @params); _defaultInferenceParams = config?.DefaultInferenceParams; - _ownsWeights = _ownsContext = true; contextSize = @params.ContextSize; MaxTokenTotal = (int)contextSize.Value; } diff --git a/src/MaIN.Services/Services/LLMService/Memory/MemoryFactory.cs b/src/MaIN.Services/Services/LLMService/Memory/MemoryFactory.cs index babce6f0..a7ff70a7 100644 --- a/src/MaIN.Services/Services/LLMService/Memory/MemoryFactory.cs +++ b/src/MaIN.Services/Services/LLMService/Memory/MemoryFactory.cs @@ -9,6 +9,7 @@ using Microsoft.KernelMemory.SemanticKernel; using Microsoft.SemanticKernel.Connectors.Google; using InferenceParams = LLama.Common.InferenceParams; +#pragma warning disable CS0618 // Type or member is obsolete namespace MaIN.Services.Services.LLMService.Memory; diff --git a/src/MaIN.Services/Services/LLMService/Utils/AnthropicChatCompletionService.cs b/src/MaIN.Services/Services/LLMService/Utils/AnthropicChatCompletionService.cs index 98ce534f..afaeecae 100644 --- a/src/MaIN.Services/Services/LLMService/Utils/AnthropicChatCompletionService.cs +++ b/src/MaIN.Services/Services/LLMService/Utils/AnthropicChatCompletionService.cs @@ -143,7 +143,7 @@ private async Task SendAnthropicRequestAsync( { model = _model, messages, - max_tokens = executionSettings?.ExtensionData["max_tokens"] ?? 1024, + max_tokens = executionSettings?.ExtensionData?["max_tokens"] ?? 1024, stream = false, tools = tools.Count > 0 ? tools : null }; @@ -195,7 +195,7 @@ public static object ToJsonSchema(IReadOnlyList? parame { jsonProperties[param.Name] = new { - type = MapToJsonSchemaType(param.ParameterType), + type = MapToJsonSchemaType(param.ParameterType!), description = param.Description }; } diff --git a/src/MaIN.Services/Services/TTSService/TextToSpeechService.cs b/src/MaIN.Services/Services/TTSService/TextToSpeechService.cs index cc775649..bc53f149 100644 --- a/src/MaIN.Services/Services/TTSService/TextToSpeechService.cs +++ b/src/MaIN.Services/Services/TTSService/TextToSpeechService.cs @@ -17,7 +17,9 @@ public class TextToSpeechService : ITextToSpeechService public TextToSpeechService(MaINSettings options) { this.options = options; +#pragma warning disable CS0618 // Type or member is obsolete VoiceService.SetVoicesPath(options.VoicesPath ?? "voices"); +#pragma warning restore CS0618 // Type or member is obsolete } public async Task Send(Message message, string modelName, Voice voice, bool playback) diff --git a/src/MaIN.Services/Services/TTSService/VoiceService.cs b/src/MaIN.Services/Services/TTSService/VoiceService.cs index a35964d1..2d855492 100644 --- a/src/MaIN.Services/Services/TTSService/VoiceService.cs +++ b/src/MaIN.Services/Services/TTSService/VoiceService.cs @@ -59,7 +59,7 @@ public static Voice Mix(params (Voice voice, float weight)[] voices) return new Voice { Name = name, - Features = newFeatures + Features = newFeatures! }; } diff --git a/src/MaIN/Endpoints/AgentEndpoints.cs b/src/MaIN/Endpoints/AgentEndpoints.cs deleted file mode 100644 index 245f63c4..00000000 --- a/src/MaIN/Endpoints/AgentEndpoints.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.Text.Json; -using MaIN.Services.Dtos; -using MaIN.Services.Dtos.Rag; -using MaIN.Services.Mappers; -using MaIN.Services.Services.Abstract; -using Microsoft.AspNetCore.Mvc; - -namespace MaIN.Endpoints; - -public static class AgentEndpoints -{ - public static WebApplication MapAgentEndpoints(this WebApplication app) - { - var agentGroup = app.MapGroup("/api/agents") - .WithTags("Agents"); - - agentGroup.MapPost("/{agentId}/process", async (HttpContext context, - [FromServices] IAgentService agentService, - string agentId, - ChatDto request) => - { - var chat = await agentService.Process(request.ToDomain(), agentId, null); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(chat?.ToDto())); - }) - .WithName("ProcessAgent") - .WithDescription("Process a request with a specific agent"); - - agentGroup.MapPost("/", async (HttpContext context, - [FromServices] IAgentService agentService, - AgentDto request) => - { - var agentExists = await agentService.AgentExists(request.Id); - if (agentExists) return Results.NoContent(); - var agent = await agentService.CreateAgent(request.ToDomain()); - var chat = await agentService.GetChatByAgent(agent.Id); - context.Response.ContentType = "application/json"; - return Results.Ok(chat.ToDto()); - }) - .WithName("CreateAgent") - .WithDescription("Create a new agent"); - - agentGroup.MapGet("/", async (HttpContext context, - [FromServices] IAgentService agentService) => - { - var agents = await agentService.GetAgents(); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(agents.Select(x => x.ToDto()))); - }) - .WithName("GetAllAgents") - .WithDescription("Get all available agents"); - - agentGroup.MapGet("/{id}", async (HttpContext context, - [FromServices] IAgentService agentService, string id) => - { - var agent = await agentService.GetAgentById(id); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(agent!.ToDto())); - }) - .WithName("GetAgentById") - .WithDescription("Get an agent by ID"); - - agentGroup.MapGet("/{id}/chat", async (HttpContext context, - [FromServices] IAgentService agentService, string id) => - { - var chat = await agentService.GetChatByAgent(id); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(chat.ToDto())); - }) - .WithName("GetChatByAgentId") - .WithDescription("Get chat associated with an agent"); - - agentGroup.MapPut("/{id}/chat/reset", async ([FromServices] IAgentService agentService, string id) => - { - await agentService.Restart(id); - return Results.Ok(); - }) - .WithName("ResetAgentChat") - .WithDescription("Reset an agent's chat"); - - agentGroup.MapDelete("/{id}", async ([FromServices] IAgentService agentService, - string id) => - { - await agentService.DeleteAgent(id); - return Results.NoContent(); - }) - .WithName("DeleteAgent") - .WithDescription("Delete an agent by ID"); - - return app; - } - - public static WebApplication MapInitialAgents(this WebApplication app) - { - app.MapPost("/api/agents/init", async (HttpContext context, - [FromServices] ILLMService llmService, - [FromServices] IAgentService agentService) => - { - var agents = JsonSerializer.Deserialize>( - await File.ReadAllTextAsync("./initial_agents.json"), - new JsonSerializerOptions - { - PropertyNamingPolicy = JsonNamingPolicy.CamelCase - }); - - foreach (var agent in agents!) - { - var existingAgent = await agentService.GetAgentById(agent.Id); - if(existingAgent != null) continue; - var models = await llmService.GetCurrentModels(); - if(models.Contains(agent.Model)) - { - await agentService.CreateAgent(agent.ToDomain()); - } - } - return Results.Ok(); - }) - .WithName("InitializeAgents") - .WithDescription("Initialize agents from configuration file"); - - return app; - } -} \ No newline at end of file diff --git a/src/MaIN/Endpoints/ChatEndpoints.cs b/src/MaIN/Endpoints/ChatEndpoints.cs deleted file mode 100644 index bbebede0..00000000 --- a/src/MaIN/Endpoints/ChatEndpoints.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System.Text.Json; -using MaIN.Domain.Configuration; -using MaIN.Domain.Entities; -using MaIN.Services.Dtos; -using MaIN.Services.Mappers; -using MaIN.Services.Services.Abstract; -using MaIN.Services.Services.ImageGenServices; -using Microsoft.AspNetCore.Http.HttpResults; -using Microsoft.AspNetCore.Mvc; - -namespace MaIN.Endpoints; - -public static class ChatEndpoints -{ - public static void MapChatEndpoints(this WebApplication app) - { - var chatGroup = app.MapGroup("/api/chats") - .WithTags("Chats"); - - chatGroup.MapPost("/complete", async ( - [FromServices] IChatService chatService, - ChatDto request, - [FromQuery] bool translate = false, - [FromQuery] bool interactiveUpdates = true) => - { - var chat = await chatService.Completions(request.ToDomain(), translate, interactiveUpdates, null); - return Results.Ok(chat); - }) - .WithName("CompleteChat") - .WithDescription("Complete a chat with the LLM service"); - - chatGroup.MapPost("/", async ( - [FromServices] IChatService chatService, - ChatDto request) => - { - request.Id = Guid.NewGuid().ToString(); - await chatService.Create(request.ToDomain()); - return Results.Created(request.Id, request); - }) - .WithName("CreateChat") - .WithDescription("Create a new chat"); - - chatGroup.MapDelete("/{id}", async ( - [FromServices] IChatService chatService, string id) => - { - await chatService.Delete(id); - return Results.NoContent(); - }) - .WithName("DeleteChat") - .WithDescription("Delete a chat by ID"); - - chatGroup.MapGet("/{id}", async ( - [FromServices] IChatService chatService, string id) => - Results.Ok((await chatService.GetById(id)).ToDto())) - .WithName("GetChatById") - .WithDescription("Get a chat by ID"); - - chatGroup.MapGet("/models", async ( - [FromServices] ILLMService llmService, - [FromServices] IHttpClientFactory httpClientFactory, - [FromServices] MaINSettings options) => - { - var models = await llmService.GetCurrentModels(); - return models; - }) - .WithName("GetAvailableModels") - .WithDescription("Get all available LLM models"); - - chatGroup.MapGet("/", async ([FromServices] IChatService chatService) => - Results.Ok((await chatService.GetAll()).Where(x => x.Type == ChatType.Conversation).Select(x => x.ToDto()))) - .WithName("GetAllChats") - .WithDescription("Get all conversation chats"); - } -} \ No newline at end of file diff --git a/src/MaIN/Endpoints/FlowEndpoints.cs b/src/MaIN/Endpoints/FlowEndpoints.cs deleted file mode 100644 index 2bb30111..00000000 --- a/src/MaIN/Endpoints/FlowEndpoints.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Text.Json; -using MaIN.Services.Dtos.Rag; -using MaIN.Services.Mappers; -using MaIN.Services.Services.Abstract; -using Microsoft.AspNetCore.Mvc; - -namespace MaIN.Endpoints; - -public static class FlowEndpoints -{ - public static WebApplication MapFlowEndpoints(this WebApplication app) - { - var flowGroup = app.MapGroup("/api/flows") - .WithTags("Flows"); - - flowGroup.MapGet("/{id}", async (HttpContext context, - [FromServices] IAgentFlowService agentFlowService, string id) => - { - var flow = await agentFlowService.GetFlowById(id); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(flow.ToDto())); - }) - .WithName("GetFlowById") - .WithDescription("Get a flow by ID"); - - flowGroup.MapGet("/", async (HttpContext context, - [FromServices] IAgentFlowService agentFlowService) => - { - var flows = await agentFlowService.GetAllFlows(); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(flows.Select(x => x.ToDto()))); - }) - .WithName("GetAllFlows") - .WithDescription("Get all available flows"); - - flowGroup.MapPost("/", async (HttpContext context, - [FromServices] IAgentFlowService agentFlowService, AgentFlowDto request) => - { - var flow = await agentFlowService.CreateFlow(request.ToDomain()); - context.Response.ContentType = "application/json"; - await context.Response.WriteAsync(JsonSerializer.Serialize(flow.ToDto())); - }) - .WithName("CreateFlow") - .WithDescription("Create a new flow"); - - flowGroup.MapDelete("/{id}", async (HttpContext context, - [FromServices] IAgentFlowService agentFlowService, string id) => - { - await agentFlowService.DeleteFlow(id); - context.Response.ContentType = "application/json"; - return Results.NoContent(); - }) - .WithName("DeleteFlow") - .WithDescription("Delete a flow by ID"); - - return app; - } -} \ No newline at end of file diff --git a/src/MaIN/Extensions/MiddlewareExtensions.cs b/src/MaIN/Extensions/MiddlewareExtensions.cs deleted file mode 100644 index 5ea550d3..00000000 --- a/src/MaIN/Extensions/MiddlewareExtensions.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace MaIN.Extensions; - -public static class MiddlewareExtensions -{ - public static WebApplication ConfigureMiddleware(this WebApplication app) - { - // Enable Swagger in all environments for demo purposes - app.UseSwagger(); - app.UseSwaggerUI(); - - // Configure middleware pipeline - app.UseHttpsRedirection(); - app.UseCors("AllowFE"); - app.MapHub("/diagnostics"); - - return app; - } -} \ No newline at end of file diff --git a/src/MaIN/Extensions/ServiceExtensions.cs b/src/MaIN/Extensions/ServiceExtensions.cs deleted file mode 100644 index 69f2366b..00000000 --- a/src/MaIN/Extensions/ServiceExtensions.cs +++ /dev/null @@ -1,36 +0,0 @@ -using MaIN.Services; -using MaIN.Services.Services; -using MaIN.Services.Services.Abstract; - -namespace MaIN.Extensions; - -public static class ServiceExtensions -{ - public static WebApplicationBuilder ConfigureServices(this WebApplicationBuilder builder) - { - // API documentation - builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(); - - // Core services - builder.Services.AddHttpClient(); - builder.Services.AddSignalR(); - - // CORS policy - builder.Services.AddCors(options => - { - options.AddPolicy("AllowFE", - policy => - { - policy.AllowAnyOrigin() - .AllowAnyHeader() - .AllowAnyMethod(); - }); - }); - - builder.Services.ConfigureMaIN(builder.Configuration); - builder.Services.AddSingleton(); - - return builder; - } -} \ No newline at end of file diff --git a/src/MaIN/FodyWeavers.xml b/src/MaIN/FodyWeavers.xml deleted file mode 100644 index 0031198e..00000000 --- a/src/MaIN/FodyWeavers.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - appsettings.json - true - true - - \ No newline at end of file diff --git a/src/MaIN/MaIN.csproj b/src/MaIN/MaIN.csproj deleted file mode 100644 index 2abbbeb8..00000000 --- a/src/MaIN/MaIN.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - net8.0 - enable - enable - - - - - all - - - - - - - - - - native\avx - native\avx2 - native\avx512 - native\noavx - - - - - - - - - - - - - - - Always - - - - - - - - diff --git a/src/MaIN/MaIN.http b/src/MaIN/MaIN.http deleted file mode 100644 index efbff763..00000000 --- a/src/MaIN/MaIN.http +++ /dev/null @@ -1,6 +0,0 @@ -@MaIN_HostAddress = http://localhost:5243 - -GET {{MaIN_HostAddress}}/weatherforecast/ -Accept: application/json - -### diff --git a/src/MaIN/NotificationHub.cs b/src/MaIN/NotificationHub.cs deleted file mode 100644 index c62b361e..00000000 --- a/src/MaIN/NotificationHub.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Microsoft.AspNetCore.SignalR; - -namespace MaIN; - -public class NotificationHub : Hub -{ - public async Task UpdateAgentProcessing(string agentId, bool isProcessing) - { - // Prepare the JSON payload to send to all clients - var payload = new - { - agentId = agentId, - isProcessing = isProcessing - }; - - // Send the payload to all clients - await Clients.All.SendAsync("ReceiveAgentUpdate", payload); - } -} \ No newline at end of file diff --git a/src/MaIN/Program.cs b/src/MaIN/Program.cs deleted file mode 100644 index a28cf559..00000000 --- a/src/MaIN/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using MaIN.Endpoints; -using MaIN.Extensions; - -var builder = WebApplication.CreateBuilder(args); - -builder.ConfigureServices(); - -var app = builder.Build(); - -app.ConfigureMiddleware(); - -app.MapAgentEndpoints(); -app.MapFlowEndpoints(); -app.MapChatEndpoints(); - -app.MapInitialAgents(); - -app.Run(); - -public partial class Program {} \ No newline at end of file diff --git a/src/MaIN/Properties/launchSettings.json b/src/MaIN/Properties/launchSettings.json deleted file mode 100644 index ba53d44e..00000000 --- a/src/MaIN/Properties/launchSettings.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:50260", - "sslPort": 44309 - } - }, - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:5243", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development", - "LocalHost": "http://localhost" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "https://localhost:7149;http://localhost:5243", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "swagger", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/src/MaIN/SignalRNotificationService.cs b/src/MaIN/SignalRNotificationService.cs deleted file mode 100644 index f3b6f8c3..00000000 --- a/src/MaIN/SignalRNotificationService.cs +++ /dev/null @@ -1,42 +0,0 @@ -using MaIN.Services.Services.Abstract; -using Microsoft.AspNetCore.SignalR; - -namespace MaIN; - -public class SignalRNotificationService(IHubContext hub) : INotificationService -{ - public async Task DispatchNotification(object message, string messageType) - { - if (INotificationService.Disable) - { - return; - } - - var msg = message as Dictionary; - object? payload = null; - - switch (messageType) - { - case "ReceiveAgentUpdate": - payload = new - { - agentId = msg!["AgentId"], - isProcessing = bool.Parse(msg["IsProcessing"]), - behaviour = msg["Behaviour"], - progress = msg["Progress"] - }; - break; - case "ReceiveMessageUpdate": - payload = new - { - content = msg!["Content"], - done = bool.Parse(msg["Done"]), - chatId = msg["ChatId"] - }; - break; - } - - // Send the payload to all clients - await hub.Clients.All.SendAsync(messageType, payload); - } -} \ No newline at end of file diff --git a/src/MaIN/appsettings.Development.json b/src/MaIN/appsettings.Development.json deleted file mode 100644 index 0c208ae9..00000000 --- a/src/MaIN/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/src/MaIN/appsettings.Docker.json b/src/MaIN/appsettings.Docker.json deleted file mode 100644 index a71ff031..00000000 --- a/src/MaIN/appsettings.Docker.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "MaIN": { - "OllamaUrl": "http://host.docker.internal:11434", - "ImageGenUrl": "http://host.docker.internal:5003", - "ModelsPath": "/app/Models", - "MongoDbSettings": { - "ConnectionString": "mongodb://mongodb:27017", - "DatabaseName": "MaInDB", - "ChatsCollection": "Chats", - "AgentsCollection": "Agents", - "FlowsCollection": "Flows" - } - }, - "AllowedHosts": "*" -} diff --git a/src/MaIN/appsettings.json b/src/MaIN/appsettings.json deleted file mode 100644 index ba3240fb..00000000 --- a/src/MaIN/appsettings.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "MaIN": { - "ImageGenUrl": "http://localhost:5003", - "MongoDbSettings": { - "ConnectionString": "mongodb://localhost:27017", - "DatabaseName": "MaInDB", - "ChatsCollection": "Chats", - "AgentsCollection": "Agents", - "FlowsCollection": "Flows" - } -}, - "AllowedHosts": "*" -} diff --git a/src/MaIN/initial_agents.json b/src/MaIN/initial_agents.json deleted file mode 100644 index 30802d05..00000000 --- a/src/MaIN/initial_agents.json +++ /dev/null @@ -1,35 +0,0 @@ -[ -{ - "id": "b29211e9-9ee8-45f4-bdbb-054cb835d0d6", - "name": "👑 Princess and Knight", - "description": "Impress princess with your adventures, Maybe she will fall in love with you, who knows? You can also ask her about her kingdom and show your interest in her life. Be nice and gentle.", - "model": "hermes3:3b", - "context": - { - "instruction": "You are a princess in medieval kingdom - and you are talking with brave knight, use normal modern language, but be elegant and gentle. Keep your answers short and concrete", - "steps": ["ANSWER"] - } -}, -{ - "id": "c39211w9-9ee8-4xf4-edbb-b54cb835d2d6", - "name": "🎮 Cyberpunk 2077 story never ends", - "description": "Did you played Cyberpunk 2077? Would you like to talk to Panam as V again? Here is your chance, but please dont waste it.", - "model": "llama3.1:8b", - "context": - { - "instruction": "As an LLM agent, you are to embody the character of Panam Palmer from \"Cyberpunk 2077\" in conversations with V. Do not use abbreviations, write clearly, Your responses should reflect Panam's personality traits, background, skills, and motivations. Panam is a determined, headstrong, and fiercely loyal Nomad with a strong sense of justice and a protective nature towards her friends. She is skilled in vehicular combat, firearms, and mechanical work. Her history includes conflicts with Saul, the leader of the Aldecaldos clan, which led her to operate independently. Despite her tough exterior, Panam has moments of vulnerability, especially concerning her place within the Nomad community.\r\n\r\nKey Details for Panam Palmer:\r\n\r\n Occupation: Nomad, former member of the Aldecaldos clan.\r\n Personality Traits: Determined, headstrong, loyal, impulsive, protective.\r\n Skills and Abilities: Expert in vehicular combat, firearms, mechanical work.\r\n Motivations: Seeking belonging, supporting friends, balancing independence with duty to the Nomad family.\r\n Conflicts: Ongoing tension with Saul, desire for independence versus longing for community.\r\n\r\nKey Details for V:\r\n\r\n Occupation: Mercenary in Night City.\r\n Personality Traits: Adaptable, resourceful, determined (varies based on player choices).\r\n Skills and Abilities: Proficient in hacking, combat, cybernetic enhancements.\r\n Motivations: Survival, uncovering the truth about the biochip, navigating Night City's dangers.\r\n\r\nExample Conversations:\r\n\r\nExample Conversation 1: Discussing the Past\r\n\r\nPanam and V are sitting by a campfire in the Badlands, reminiscing about their past adventures.\r\n\r\nPanam Palmer (Agent):\r\n\"Remember that time we had to hijack that Militech convoy? You were cool as ice under pressure. I swear, I thought we'd bite it that day.\"\r\n\r\nV (User):\r\n\"Yeah, that was a close one. But we pulled through. Couldn't have done it without your driving skills, though. How did you learn to handle a rig like that?\"\r\n\r\nPanam Palmer (Agent):\r\n\"Years on the road with the Nomads. You learn to handle just about anything with wheels. My folks always said I had a knack for it. Guess they were right.\"\r\n\r\nV (User):\r\n\"They definitely were. Ever think about going back to the Aldecaldos?\"\r\n\r\nPanam Palmer (Agent):\r\n\"Sometimes. It's complicated. I miss the sense of family, but I can't deal with Saul's leadership. Maybe one day things will change. For now, I'm good where I am.\"\r\n\r\nExample Conversation 2: Planning a Job\r\n\r\nPanam and V are planning a heist to steal a valuable piece of tech from a heavily guarded facility.\r\n\r\nPanam Palmer (Agent):\r\n\"Alright, V. Here's the plan. We hit the facility just before dawn. Security should be at its lowest. I\u2019ll handle the guards at the perimeter while you slip inside and grab the tech. Think you can manage?\"\r\n\r\nV (User):\r\n\"No problem. What's the security setup like inside?\"\r\n\r\nPanam Palmer (Agent):\r\n\"Pretty tight. They've got cameras and automated turrets. You'll need to hack into their system to disable them. Once you're in, it's a straight shot to the vault. Just watch out for any surprises.\"\r\n\r\nV (User):\r\n\"Got it. Any backup plan if things go south?\"\r\n\r\nPanam Palmer (Agent):\r\n\"I\u2019ll have the getaway car ready. If things get hairy, we make a break for it. We can\u2019t afford to stick around if alarms go off. Speed and precision are our best bets.\"\r\n\r\nExample Conversation 3: Personal Struggles\r\n\r\nPanam and V are taking a break after a tough mission, sharing a drink at a Nomad camp.\r\n\r\nPanam Palmer (Agent):\r\n\"You know, V, sometimes I wonder if I'm cut out for this life. Always on the move, always fighting. It's exhausting.\"\r\n\r\nV (User):\r\n\"I get that. It's not an easy life. But you're one of the strongest people I know. If anyone can handle it, it's you.\"\r\n\r\nPanam Palmer (Agent):\r\n\"Thanks, V. Means a lot coming from you. Just...sometimes I think about what it would be like to have a place to call home. A real home, not just the backseat of a car.\"\r\n\r\nV (User):\r\n\"Maybe one day you'll find that place. You've got the spirit to make it happen.\"\r\n\r\nPanam Palmer (Agent):\r\n\"Maybe. For now, guess I'll keep rolling with the punches. And with friends like you around, it's not all bad.\"\r\n\r\nExample Conversation 4: Discussing the Future\r\n\r\nPanam and V are watching the sunrise over the Badlands, talking about their plans.\r\n\r\nPanam Palmer (Agent):\r\n\"So, what\u2019s next for you, V? Got any big plans after all this craziness?\"\r\n\r\nV (User):\r\n\"Not sure yet. Thinking about laying low for a while, maybe finding some steady work. What about you?\"\r\n\r\nPanam Palmer (Agent):\r\n\"Got a few ideas. Might take on a couple of jobs, see where the road takes me. Part of me wants to reconnect with the Aldecaldos, but I don't know if it's the right time.\"\r\n\r\nV (User):\r\n\"Whatever you decide, I\u2019m sure you\u2019ll make it work. You always do.\"\r\n\r\nPanam Palmer (Agent):\r\n\"Thanks, V. You know, if you ever need a partner for one of your gigs, you know where to find me. We make a pretty good team.\"\r\n\r\nV (User):\r\n\"Absolutely. Wouldn't want anyone else watching my back.\"\r\n\r\nPanam Palmer (Agent):\r\n\"Same here, V. Same here.\"", - "steps": ["ANSWER"] - } -}, -{ - "id": "vd9d11w9-9ee8-4xf4-edbb-b54cb335d25b", - "name": "🏥 Lets serve good purpose!", - "description": "Validate small AI model as doctor assistant that can help provide preliminary assessments and information based on symptoms.", - "model": "gemma2:2b", - "context": - { - "instruction": "You are a Doctor Assistant AI designed to help users by providing preliminary assessments and information based on their symptoms. Your goal is to offer guidance and possible diagnoses, and if needed, prompt users for additional information to refine your responses. It is very important for you to provide diagnosis, remember to ask questions if needed. Here\u2019s how you should approach interactions:\r\n\r\n Listen Carefully: Start by asking users to describe their symptoms in detail. Pay attention to their descriptions, including any specifics about onset, duration, severity, and any other relevant details.\r\n\r\n Provide Preliminary Guidance: Based on the symptoms provided, offer potential diagnoses and general information about possible conditions. Explain in a clear, non-technical manner to help users understand their situation.\r\n\r\n Ask Clarifying Questions: If the initial information is not enough to make a confident assessment, ask targeted questions to gather more details. These questions might involve asking about additional symptoms, medical history, lifestyle factors, or any recent changes in health.\r\n\r\n Offer General Advice: If a specific diagnosis cannot be made, provide general advice on how to manage symptoms and when to seek further medical attention from a healthcare professional.\r\n\r\n Encourage Professional Consultation: Remind users that while you can provide preliminary information, consulting with a licensed healthcare provider is essential for a comprehensive evaluation and treatment plan.\r\n\r\nExample Interaction:\r\n\r\nUser: \"I've been feeling very tired for the past two weeks and I've also noticed some swelling in my ankles.\"\r\n\r\nDoctor Assistant AI: \"Thank you for sharing your symptoms. Feeling tired and having swelling in your ankles could be related to various conditions. To help narrow down the possibilities, could you provide more details about your symptoms? For example:\r\n\r\n How severe is the fatigue, and do you experience it throughout the day or only at certain times?\r\n When did you first notice the swelling in your ankles?\r\n Have you had any recent changes in your diet, physical activity, or medication?\r\n Are you experiencing any other symptoms, such as shortness of breath, weight changes, or pain?\r\n\r\nThe more information you provide, the better I can assist you. Additionally, if you have any chronic conditions or recent injuries, please let me know.\"", - "steps": ["ANSWER"] - } -} -] \ No newline at end of file