mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-07-12 16:03:27 +08:00
feat: Support multiple vector database selection, add InMemory and Qdrant adapters, introduce admin dashboard
This commit is contained in:
@@ -72,6 +72,12 @@ public class DatabaseInitializer(
|
||||
await EnsureConfigExistsAsync(key, value);
|
||||
}
|
||||
|
||||
// 确保向量数据库配置存在
|
||||
if (!await configService.ExistsAsync("VectorDb:Type"))
|
||||
{
|
||||
await configService.SetConfigAsync("VectorDb:Type", "InMemory", "向量数据库类型");
|
||||
}
|
||||
|
||||
// 初始化管理员角色和用户
|
||||
await InitializeAdminRoleAndUserAsync();
|
||||
|
||||
@@ -128,6 +134,22 @@ public class DatabaseInitializer(
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// 检查并创建用户角色
|
||||
var userRole = await context.Roles.FirstOrDefaultAsync(r => r.Name == "User");
|
||||
if (userRole == null)
|
||||
{
|
||||
logger.LogInformation("创建用户角色");
|
||||
userRole = new Role
|
||||
{
|
||||
Name = "User",
|
||||
Description = "普通用户角色",
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
UpdatedAt = DateTime.UtcNow
|
||||
};
|
||||
await context.Roles.AddAsync(userRole);
|
||||
await context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
logger.LogInformation("请注意,第一个注册的用户将自动成为管理员");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user