diff --git a/MyApp.ServiceInterface/Data/AppConfig.cs b/MyApp.ServiceInterface/Data/AppConfig.cs index 94acc72..86e5ecd 100644 --- a/MyApp.ServiceInterface/Data/AppConfig.cs +++ b/MyApp.ServiceInterface/Data/AppConfig.cs @@ -6,13 +6,14 @@ public class AppConfig public string LocalBaseUrl { get; set; } public string PublicBaseUrl { get; set; } public string CacheDir { get; set; } + public string ProfilesDir { get; set; } public string? GitPagesBaseUrl { get; set; } public List ModelUsers { get; set; } = []; public ApplicationUser DefaultUser { get; set; } = new() { Model = "unknown", UserName = "unknown", - ProfileUrl = "/img/profiles/user2.svg", + ProfilePath = "/img/profiles/user2.svg", }; public ApplicationUser GetApplicationUser(string model) diff --git a/MyApp.ServiceInterface/Data/ApplicationUser.cs b/MyApp.ServiceInterface/Data/ApplicationUser.cs index f6d8d04..d63748e 100644 --- a/MyApp.ServiceInterface/Data/ApplicationUser.cs +++ b/MyApp.ServiceInterface/Data/ApplicationUser.cs @@ -7,9 +7,7 @@ namespace MyApp.Data; [Alias("AspNetUsers")] public class ApplicationUser : IdentityUser { - public string? FirstName { get; set; } - public string? LastName { get; set; } - public string? ProfileUrl { get; set; } + public string? DisplayName { get; set; } + public string? ProfilePath { get; set; } public string? Model { get; set; } } - diff --git a/MyApp.ServiceInterface/Data/CustomUserSession.cs b/MyApp.ServiceInterface/Data/CustomUserSession.cs index 5c6be87..0babcf9 100644 --- a/MyApp.ServiceInterface/Data/CustomUserSession.cs +++ b/MyApp.ServiceInterface/Data/CustomUserSession.cs @@ -31,9 +31,9 @@ public override async Task CreateAsync(ApplicationUser user) var claims = new List(); // Add additional claims here - if (user.ProfileUrl != null) + if (user.ProfilePath != null) { - claims.Add(new Claim(JwtClaimTypes.Picture, user.ProfileUrl)); + claims.Add(new Claim(JwtClaimTypes.Picture, user.ProfilePath)); } identity.AddClaims(claims); diff --git a/MyApp/Components/Shared/QuestionPost.razor b/MyApp/Components/Shared/QuestionPost.razor index 61389cc..c745f96 100644 --- a/MyApp/Components/Shared/QuestionPost.razor +++ b/MyApp/Components/Shared/QuestionPost.razor @@ -93,7 +93,7 @@ var user = AppConfig.GetApplicationUser(answer.Model); }
- +
@user.UserName
diff --git a/MyApp/Configure.Db.Migrations.cs b/MyApp/Configure.Db.Migrations.cs index 5bf5ffb..43cde9c 100644 --- a/MyApp/Configure.Db.Migrations.cs +++ b/MyApp/Configure.Db.Migrations.cs @@ -84,8 +84,7 @@ await EnsureUserAsync(new ApplicationUser { UserName = "admin", Email = "admin@email.com", - FirstName = "Admin", - LastName = "User", + DisplayName = "Administrator", EmailConfirmed = true, }, "p@55wOrd", allRoles); @@ -93,20 +92,18 @@ await EnsureUserAsync(new ApplicationUser { UserName = "human", Email = "human@email.com", - FirstName = "Human", - LastName = "User", + DisplayName = "Human", EmailConfirmed = true, - ProfileUrl = "/img/profiles/user1.svg", + ProfilePath = "/profiles/hu/human.svg", }, "p@55wOrd"); await EnsureUserAsync(new ApplicationUser { UserName = "phi", Email = "phi@email.com", - FirstName = "Phi-2", - LastName = "2.7B", + DisplayName = "Phi-2 2.7B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/phi-2.svg", + ProfilePath = "/profiles/ph/phi-2.svg", Model = "phi", //3B }, "p@55wOrd"); @@ -114,10 +111,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "gemma-2b", Email = "gemma-2b@email.com", - FirstName = "Gemma", - LastName = "2B", + DisplayName = "Gemma 2B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/gemma-2b.svg", + ProfilePath = "/profiles/ge/gemma-2b.svg", Model = "gemma:2b", //3B }, "p@55wOrd"); @@ -125,10 +121,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "starcoder2-3b", Email = "starcoder2-3b@email.com", - FirstName = "StarCoder2", - LastName = "3B", + DisplayName = "StarCoder2 3B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/starcoder-3b.png", + ProfilePath = "/profiles/st/starcoder-3b.png", Model = "starcoder2:3b", //3B }, "p@55wOrd"); @@ -136,10 +131,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "gemma", Email = "gemma@email.com", - FirstName = "Gemma", - LastName = "7B", + DisplayName = "Gemma 7B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/gemma-7b.svg", + ProfilePath = "/profiles/ge/gemma-7b.svg", Model = "gemma", //9B }, "p@55wOrd"); @@ -147,10 +141,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "codellama", Email = "codellama-13B@email.com", - FirstName = "Code Llama", - LastName = "7B", + DisplayName = "Code Llama 7B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/codellama.svg", + ProfilePath = "/profiles/co/codellama.svg", Model = "codellama", //7B }, "p@55wOrd"); @@ -158,10 +151,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "mistral", Email = "mistral-7B@email.com", - FirstName = "Mistral", - LastName = "7B", + DisplayName = "Mistral 7B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/mistral.svg", + ProfilePath = "/profiles/mi/mistral.svg", Model = "mistral", //7B }, "p@55wOrd"); @@ -169,10 +161,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "starcoder2-15b", Email = "starcoder2-15b@email.com", - FirstName = "StarCoder2", - LastName = "15B", + DisplayName = "StarCoder2 15B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/starcoder2-15b.png", + ProfilePath = "/profiles/st/starcoder2-15b.png", Model = "starcoder2:15b", //16B }, "p@55wOrd"); @@ -180,10 +171,9 @@ await EnsureUserAsync(new ApplicationUser { UserName = "mixtral", Email = "mixtral-8x7b@email.com", - FirstName = "Mixtral", - LastName = "8x7B", + DisplayName = "Mixtral 8x7B", EmailConfirmed = true, - ProfileUrl = "/img/profiles/mixtral.jpg", + ProfilePath = "/profiles/mi/mixtral.jpg", Model = "mixtral", //47B }, "p@55wOrd"); } diff --git a/MyApp/Migrations/20240313164420_CreateIdentitySchema.Designer.cs b/MyApp/Migrations/20240316165946_CreateIdentitySchema.Designer.cs similarity index 97% rename from MyApp/Migrations/20240313164420_CreateIdentitySchema.Designer.cs rename to MyApp/Migrations/20240316165946_CreateIdentitySchema.Designer.cs index aa02938..f6ca039 100644 --- a/MyApp/Migrations/20240313164420_CreateIdentitySchema.Designer.cs +++ b/MyApp/Migrations/20240316165946_CreateIdentitySchema.Designer.cs @@ -11,7 +11,7 @@ namespace MyApp.Migrations { [DbContext(typeof(ApplicationDbContext))] - [Migration("20240313164420_CreateIdentitySchema")] + [Migration("20240316165946_CreateIdentitySchema")] partial class CreateIdentitySchema { /// @@ -160,6 +160,9 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) .IsConcurrencyToken() .HasColumnType("TEXT"); + b.Property("DisplayName") + .HasColumnType("TEXT"); + b.Property("Email") .HasMaxLength(256) .HasColumnType("TEXT"); @@ -167,12 +170,6 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("EmailConfirmed") .HasColumnType("INTEGER"); - b.Property("FirstName") - .HasColumnType("TEXT"); - - b.Property("LastName") - .HasColumnType("TEXT"); - b.Property("LockoutEnabled") .HasColumnType("INTEGER"); @@ -199,7 +196,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("PhoneNumberConfirmed") .HasColumnType("INTEGER"); - b.Property("ProfileUrl") + b.Property("ProfilePath") .HasColumnType("TEXT"); b.Property("SecurityStamp") diff --git a/MyApp/Migrations/20240313164420_CreateIdentitySchema.cs b/MyApp/Migrations/20240316165946_CreateIdentitySchema.cs similarity index 97% rename from MyApp/Migrations/20240313164420_CreateIdentitySchema.cs rename to MyApp/Migrations/20240316165946_CreateIdentitySchema.cs index 5789f3c..5532a53 100644 --- a/MyApp/Migrations/20240313164420_CreateIdentitySchema.cs +++ b/MyApp/Migrations/20240316165946_CreateIdentitySchema.cs @@ -30,9 +30,8 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: table => new { Id = table.Column(type: "TEXT", nullable: false), - FirstName = table.Column(type: "TEXT", nullable: true), - LastName = table.Column(type: "TEXT", nullable: true), - ProfileUrl = table.Column(type: "TEXT", nullable: true), + DisplayName = table.Column(type: "TEXT", nullable: true), + ProfilePath = table.Column(type: "TEXT", nullable: true), Model = table.Column(type: "TEXT", nullable: true), UserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), NormalizedUserName = table.Column(type: "TEXT", maxLength: 256, nullable: true), diff --git a/MyApp/Migrations/ApplicationDbContextModelSnapshot.cs b/MyApp/Migrations/ApplicationDbContextModelSnapshot.cs index b93298b..09165de 100644 --- a/MyApp/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/MyApp/Migrations/ApplicationDbContextModelSnapshot.cs @@ -157,6 +157,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsConcurrencyToken() .HasColumnType("TEXT"); + b.Property("DisplayName") + .HasColumnType("TEXT"); + b.Property("Email") .HasMaxLength(256) .HasColumnType("TEXT"); @@ -164,12 +167,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("EmailConfirmed") .HasColumnType("INTEGER"); - b.Property("FirstName") - .HasColumnType("TEXT"); - - b.Property("LastName") - .HasColumnType("TEXT"); - b.Property("LockoutEnabled") .HasColumnType("INTEGER"); @@ -196,7 +193,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("PhoneNumberConfirmed") .HasColumnType("INTEGER"); - b.Property("ProfileUrl") + b.Property("ProfilePath") .HasColumnType("TEXT"); b.Property("SecurityStamp")