Files
xSaherelmWorkspace/Documents/GeneratedContext/xDashboard-xAiModels-20260807_230143.txt
2026-08-08 00:31:18 +03:30

4152 lines
130 KiB
Plaintext

### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\XAiApiConfiguration.cs
using xAiModels.Constants;
using xAiModels.Models;
namespace xAiModels.Configurations
{
public class XAiApiConfiguration
{
/// <summary>
/// Model Providers ...
/// </summary>
public XAiModelDescriptor[] Models { get; set; } = [];
/// <summary>
/// Each User must Has a Default Project, this is Title Resource Identifier ...
/// </summary>
public string DefaultProjectTitleResource { get; set; } = XAiModelsConstants.DefaultXAiProjectTitleResourceID;
/// <summary>
/// Each User must Has a Default Project, this is Description Resource Identifier ...
/// </summary>
public string DefaultProjectDescriptionResource { get; set; } = XAiModelsConstants.DefaultXAiProjectDescriptionResourceID;
/// <summary>
/// Each User must Has a Default Conversation, this is Title Resource Identifier ... ...
/// </summary>
public string DefaultConversationTitleResource { get; set; } = XAiModelsConstants.DefaultXAiConversationTitleResourceID;
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\XAiModelMappersProfile.cs
using AutoMapper;
using xAiModels.Configurations.Entities;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
namespace xAiModels.Configurations
{
public class XAiModelMappersProfile : Profile
{
public XAiModelMappersProfile()
{
//
// XAiMessage ...
CreateMap<XAiMessage, XAiMessageDto>()
.AfterMap<XAiMessageMappingAction>();
//
// XAiProject ...
CreateMap<XAiProject, XAiProjectDto>()
.AfterMap<XAiProjectMappingAction>();
//
// XAiConversation ...
CreateMap<XAiConversation, XAiConversationDto>()
.AfterMap<XAiConversationMappingAction>();
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiConversationEntityConfiguration.cs
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using xAiModels.Constants;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Configurations.Entities
{
public class XAiConversationEntityConfiguration : XBaseEntityTypeConfiguration<XAiConversation, Guid>
{
public override void Configure(EntityTypeBuilder<XAiConversation> builder)
{
builder.ToTable(XAiModelsConstants.XAiConversationTable);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiConversationMappingAction.cs
using AutoMapper;
using xAiModels.Interfaces;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xCommons.Extensions;
using xIdentityService.Interfaces;
using xIdentityService.Extensions;
using xAiModels.Interfaces.Dtos;
namespace xAiModels.Configurations.Entities
{
public class XAiConversationMappingAction : IMappingAction<XAiConversation, XAiConversationDto>
{
private readonly IXIdentityProvider identityProvider;
private readonly IXAiProjectRepositoryService projectRepositoryService;
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
public XAiConversationMappingAction(
IXIdentityProvider identityProvider,
IXAiProjectRepositoryService projectRepositoryService,
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
)
{
this.identityProvider = identityProvider;
this.projectRepositoryService = projectRepositoryService;
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
}
public void Process(
XAiConversation source,
XAiConversationDto destination,
ResolutionContext context
)
{
//
#region Handle Owner ...
if (!source.OwnerId.IsNullOrEmpty())
{
//
// Retrieve Owner ...
var device = identityProvider.GetDevice();
var ownerUserInfo = identityProvider.GetUserInfo(
device: device,
userSelectByParam: source.OwnerId
)
.GetAwaiter()
.GetResult();
var owner = ownerUserInfo.ToXPersonDto();
//
// Setting Owner ...
destination.Owner = owner;
}
#endregion
//
#region Handle Title Locales ...
if (!source.Title.IsNullOrEmpty())
{
//
// Retrieve Locales ...
var titleLocales = conversationTitleResourceProvider.GetLocales(
identifier: source.Title,
cancellationToken: default
)
.GetAwaiter()
.GetResult();
//
// Attach to Destination ...
destination.TitleLocales = [.. titleLocales];
}
#endregion
//
#region Handle Project Info ...
if (!source.ProjectId.IsNull() &&
!source.ProjectId.IsDefaultGuid()
)
{
//
// Check Project Title ...
var project = projectRepositoryService.GetAsync(
id: source.ProjectId,
includeBuilder: null,
ignoreSoftDeleteds: true,
cancellationToken: default
)
.GetAwaiter()
.GetResult();
//
// Attach to Destination ...
destination.ProjectTitle = project.Title;
destination.ProjectDescription = project.Description;
destination.ProjectTitleLocales = project.TitleLocales;
destination.ProjectDescriptionLocales = project.DescriptionLocales;
}
#endregion
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiMessageEntityConfiguration.cs
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using xAiModels.Constants;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Configurations.Entities
{
public class XAiMessageEntityConfiguration : XBaseEntityTypeConfiguration<XAiMessage, Guid>
{
public override void Configure(EntityTypeBuilder<XAiMessage> builder)
{
builder.ToTable(XAiModelsConstants.XAiMessageTable);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiMessageMappingAction.cs
using System;
using AutoMapper;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xIdentityService.Extensions;
using xIdentityService.Interfaces;
namespace xAiModels.Configurations.Entities
{
public class XAiMessageMappingAction : IMappingAction<XAiMessage, XAiMessageDto>
{
private readonly IXIdentityProvider identityProvider;
public XAiMessageMappingAction(
IXIdentityProvider identityProvider
)
{
this.identityProvider = identityProvider;
}
public void Process(
XAiMessage source,
XAiMessageDto destination,
ResolutionContext context
)
{
//
// Retrieve Owner ...
var device = identityProvider.GetDevice();
var ownerUserInfo = identityProvider.GetUserInfo(
device: device,
userSelectByParam: source.OwnerId
)
.GetAwaiter()
.GetResult();
var owner = ownerUserInfo.ToXPersonDto();
//
// Setting Owner ...
destination.Owner = owner;
//
// Retrieve Owner ...
// Retrieve Conversation ...
throw new NotImplementedException();
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiProjectEntityConfiguration.cs
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using xAiModels.Constants;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Configurations.Entities
{
public class XAiProjectEntityConfiguration : XBaseEntityTypeConfiguration<XAiProject, Guid>
{
public override void Configure(EntityTypeBuilder<XAiProject> builder)
{
builder.ToTable(XAiModelsConstants.XAiProjectTable);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiProjectMappingAction.cs
using System;
using AutoMapper;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xIdentityService.Extensions;
using xIdentityService.Interfaces;
namespace xAiModels.Configurations.Entities
{
public class XAiProjectMappingAction : IMappingAction<XAiProject, XAiProjectDto>
{
private readonly IXIdentityProvider identityProvider;
public XAiProjectMappingAction(
IXIdentityProvider identityProvider
)
{
this.identityProvider = identityProvider;
}
public void Process(
XAiProject source,
XAiProjectDto destination,
ResolutionContext context
)
{
//
// Retrieve Owner ...
var device = identityProvider.GetDevice();
var ownerUserInfo = identityProvider.GetUserInfo(
device: device,
userSelectByParam: source.OwnerId
)
.GetAwaiter()
.GetResult();
var owner = ownerUserInfo.ToXPersonDto();
//
// Setting Owner ...
destination.Owner = owner;
//
// Retrieve Owner ...
// Retrieve Title Resources ...
// Retrieve Description Resources ...
throw new NotImplementedException();
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Constants\ConfigurationNodeNames.cs
namespace xAiModels.Constants
{
public partial struct ConfigurationNodeNames
{
public const string AI_API_NODE = "AiApiConfiguration";
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiChatRole.cs
using xExceptions.Attributes;
namespace xAiModels.Constants
{
public struct XAiChatRoles
{
public const string None = "none";
public const string User = "user";
public const string Tool = "tool";
public const string System = "system";
public const string Assistant = "assistant";
}
public enum XAiChatRole
{
[StringValue(XAiChatRoles.None)]
None,
[StringValue(XAiChatRoles.User)]
User,
[StringValue(XAiChatRoles.Tool)]
Tool,
[StringValue(XAiChatRoles.System)]
System,
[StringValue(XAiChatRoles.Assistant)]
Assistant,
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiModelProviderType.cs
namespace xAiModels.Constants
{
/// <summary>
/// Specifiy Provider Type ...
/// </summary>
public enum XAiModelProviderType
{
None,
Ollama,
DeepSeek,
HuggingFace
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiModelsConstants.cs
namespace xAiModels.Constants
{
public struct XAiModelsConstants
{
//
// Service Extensions Log Tag ...
public const string XAiModelsDILogTag = "XAiModels";
//
// Table Mapping Identifiers ...
public const string XAiMessageTable = "AiMessages";
public const string XAiProjectTable = "AiProjects";
public const string XAiConversationTable = "AiConversations";
//
// GraphQL Collection Mappings ...
public const string XAiMessageSingleName = "aiMessage";
public const string XAiProjectSingleName = "aiProject";
public const string XAiConversationSignleName = "aiConversation";
public const string XAiMessageCollectionName = "aiMessages";
public const string XAiProjectCollectionName = "AiProjectsa";
public const string XAiConversationCollectionName = "aiConversations";
//
// Hubs ...
public const string XAiMessageDtoHub = "aiMessageDto";
public const string XAiMessageEntityHub = "aiMessageEntity";
public const string XAiProjectDtoHub = "aiProjectDto";
public const string XAiProjectEntityHub = "aiProjectEntity";
public const string XAiConversationDtoHub = "aiConversationDto";
public const string XAiConversationEntityHub = "aiConversationEntity";
//
// Resource Provider Identifiers ...
public const string XAiProjectTitleIdentifier = "AiPrjT";
public const string XAiProjectDescriptionIdentifier = "AiPrjD";
public const string XAiConversationTitleIdentifier = "AiCnvrT";
//
// EF Repositories Helper Extensions ...
public const string GetXAiMessageEFRepositoryDescriptor = "GetXAiMessageEFRepositoryDescriptor";
public const string GetXAiProjectEFRepositoryDescriptor = "GetXAiProjectEFRepositoryDescriptor";
public const string GetXAiConversationEFRepositoryDescriptor = "GetXAiConversationEFRepositoryDescriptor";
//
public const string DefaultXAiProjectTitleResourceID = "XAiPrjT";
public const string DefaultXAiConversationTitleResourceID = "XAiCnvT";
public const string DefaultXAiProjectDescriptionResourceID = "XAiPrjD";
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\DI\XDIHelperExtension.cs
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using xAiModels.Providers.Dtos;
using xAiModels.Providers.Entities;
using xCommons.Extensions;
using xDataService.Constants;
using xDataService.Db;
using xDataService.Models;
using xExceptions.Constants;
using xPushService.Helpers;
using xPushService.DI;
using xDataService.DI;
using xAiModels.Interfaces.Dtos;
using xAiModels.Helpers;
using xCommons.Helpers;
using xAiModels.Interfaces.Entities;
using xAiModels.Interfaces;
using xAiModels.Providers;
using xAiModels.Constants;
namespace xAiModels.DI
{
/// <summary>
/// Service Registration Extensions Classes ...
/// </summary>
public static class XDIHelperExtension
{
/// <summary>
/// Register Service ...
/// </summary>
/// <param name="services"></param>
/// <param name="repositoryType"></param>
/// <param name="lifeTime"></param>
public static void AddXAiDataService(
this IServiceCollection services,
XRepositoryType repositoryType,
ServiceLifetime lifeTime = ServiceLifetime.Scoped
)
{
AddAiDataService(
contextType: null,
services: services,
lifeTime: lifeTime,
repositoryType: repositoryType
);
}
/// <summary>
/// Register Service ...
/// </summary>
/// <typeparam name="TContext"></typeparam>
/// <param name="services"></param>
/// <param name="repositoryType"></param>
/// <param name="lifeTime"></param>
public static void AddXAiDataService<TContext>(
this IServiceCollection services,
XRepositoryType repositoryType,
ServiceLifetime lifeTime = ServiceLifetime.Scoped
)
where TContext : XDbContext
{
AddAiDataService(
services: services,
lifeTime: lifeTime,
contextType: typeof(TContext),
repositoryType: repositoryType
);
}
/// <summary>
/// Use XSubCategoryService Middleware ...
/// </summary>
/// <param name="app"></param>
/// <param name="isDevelopmentEnvironment"></param>
public static void UseXAiDataService(
this IApplicationBuilder app,
bool isDevelopmentEnvironment = false
)
{
//
#region Using Hubs ...
//
var pushHelper = new XPushServiceHelper();
//
// XAiMessage ...
pushHelper.AddHub<XAiMessageDtoHub>(XAiModelsConstants.XAiMessageDtoHub);
pushHelper.AddHub<XAiMessageEntityHub>(XAiModelsConstants.XAiMessageEntityHub);
//
// XAiProject ...
pushHelper.AddHub<XAiProjectDtoHub>(XAiModelsConstants.XAiProjectDtoHub);
pushHelper.AddHub<XAiProjectEntityHub>(XAiModelsConstants.XAiProjectEntityHub);
//
// XAiConversation ...
pushHelper.AddHub<XAiConversationDtoHub>(XAiModelsConstants.XAiConversationDtoHub);
pushHelper.AddHub<XAiConversationEntityHub>(XAiModelsConstants.XAiConversationEntityHub);
//
app.UseXPushService(pushHelper);
#endregion
//
// Using XAiConversation Repository Descriptor ...
if (!aiConversationDescriptor.IsNull())
{
//
app.UseXRepository(
descriptor: aiConversationDescriptor,
isDevelopmentEnvironment: isDevelopmentEnvironment
);
}
//
// Using XAiMessage Repository Descriptor ...
if (!aiMessageDescriptor.IsNull())
{
//
app.UseXRepository(
descriptor: aiMessageDescriptor,
isDevelopmentEnvironment: isDevelopmentEnvironment
);
}
//
// Using XAiProject Repository Descriptor ...
if (!aiProjectDescriptor.IsNull())
{
//
app.UseXRepository(
descriptor: aiProjectDescriptor,
isDevelopmentEnvironment: isDevelopmentEnvironment
);
}
//
// Create an Scope for Services Acces ...
// Handle Seeding Category/SubCategory Resources ...
// TODO: Enable Seeding if Required ...
// using (var scope = app.ApplicationServices.CreateScope())
// {
// //
// // Retrieve Configuratuions ...
// var aiMessageProvider = scope.ServiceProvider.GetService<IXAiMessageServiceProvider>();
// var aiProjectProvider = scope.ServiceProvider.GetService<IXAiProjectServiceProvider>();
// var aiConversationProvider = scope.ServiceProvider.GetService<IXAiConversationServiceProvider>();
// var configuration = scope.ServiceProvider.GetService<XAiDataServiceServiceConfiguration>();
// if (!configuration.IsNullOrDefault() &&
// !categoryProvider.IsNullOrDefault() &&
// !subaiConversationDescriptor.IsNullOrDefault()
// )
// {
// //
// // Logging ...
// Log("Start Seeding ...");
// //
// // Count Data in Category ...
// var hasCategory = (categoryProvider.Count().GetAwaiter().GetResult()) > 0;
// var hasSubCategory = (subCategoryProvider.Count().GetAwaiter().GetResult()) > 0;
// //
// // Seed Category Resources ...
// var canSeed =
// !hasCategory &&
// configuration.Categories.HasChild();
// if (canSeed)
// {
// //
// // Loop through Provided items ...
// foreach (var cat in configuration.Categories)
// {
// //
// try
// {
// //
// Log($"Start Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} ...");
// //
// categoryProvider.Refresh(
// resource: cat,
// userInfo: null,
// connectionId: null,
// cancellationToken: default
// )
// .GetAwaiter()
// .GetResult();
// //
// Log($"Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} Finished Successfully ...");
// }
// catch (Exception ex)
// {
// Log($"Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} Failed due: {ex.Message} ...");
// }
// }
// }
// //
// // Seed SubCategory Resources ...
// canSeed =
// !hasSubCategory &&
// configuration.SubCategories.HasChild();
// if (canSeed)
// {
// //
// // Loop through Provided items ...
// foreach (var subcat in configuration.SubCategories)
// {
// //
// try
// {
// //
// Log($"Start Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} ...");
// //
// subCategoryProvider.Refresh(
// userInfo: null,
// resource: subcat,
// connectionId: null,
// cancellationToken: default
// )
// .GetAwaiter()
// .GetResult();
// //
// Log($"Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} Finished Successfully ...");
// }
// catch (Exception ex)
// {
// Log($"Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} Failed due: {ex.Message} ...");
// }
// }
// }
// //
// Log("Finish Seeding ...");
// }
// }
}
//
#region Private ...
private static XRepositoryDescriptor aiMessageDescriptor = null;
private static XRepositoryDescriptor aiProjectDescriptor = null;
private static XRepositoryDescriptor aiConversationDescriptor = null;
/// <summary>
/// a LogTag for Service ...
/// </summary>
private static string XLogTag = XAiModelsConstants.XAiModelsDILogTag;
/// <summary>
/// print a log in Console ...
/// </summary>
/// <param name="message"></param>
private static void Log(string message)
{
Console.WriteLine($"{XLogTag} => {message}");
}
/// <summary>
/// Register Service ...
/// </summary>
/// <param name="services"></param>
/// <param name="repositoryType"></param>
/// <param name="contextType"></param>
/// <param name="lifeTime"></param>
private static void AddAiDataService(
IServiceCollection services,
XRepositoryType repositoryType,
Type contextType = null,
ServiceLifetime lifeTime = ServiceLifetime.Scoped
)
{
//
var exception = XException.InvalidArgs.ToException(); ;
//
// Services ...
var isServicesExists = !services.IsNull();
if (!isServicesExists)
{
//
Log("Service Registration failed, services not provided ...");
throw exception;
}
//
// Lifetime ...
var isLifetimeExists = !lifeTime.IsNull();
if (!isLifetimeExists)
{
//
Log("Service Registration failed, lifetime not provided ...");
throw exception;
}
//
// Validate Repository Type ...
var isRepositoryTypeValid =
(repositoryType == XRepositoryType.EF &&
!contextType.IsNull()) ||
((repositoryType == XRepositoryType.Mongo ||
repositoryType == XRepositoryType.InMemory) &&
contextType.IsNull());
if (!isRepositoryTypeValid)
{
//
Log("Service Registration failed, Invalid Repository Type and Context Type ...");
throw exception;
}
//
// Maske Instance of Repository Descriptor
// Based on Provided Type ...
switch (repositoryType)
{
//
case XRepositoryType.EF:
//
// XAiMessage ...
aiMessageDescriptor = typeof(XAiModelsHelper)
.InvokeGenericMethod<XRepositoryDescriptor>(
args: null,
runtimeType: contextType,
methodName: XAiModelsConstants.GetXAiMessageEFRepositoryDescriptor
);
//
// XAiProject ...
aiProjectDescriptor = typeof(XAiModelsHelper)
.InvokeGenericMethod<XRepositoryDescriptor>(
args: null,
runtimeType: contextType,
methodName: XAiModelsConstants.GetXAiProjectEFRepositoryDescriptor
);
//
// XAiConversation ...
aiConversationDescriptor = typeof(XAiModelsHelper)
.InvokeGenericMethod<XRepositoryDescriptor>(
args: null,
runtimeType: contextType,
methodName: XAiModelsConstants.GetXAiConversationEFRepositoryDescriptor
);
break;
//
case XRepositoryType.Mongo:
//
// XAiMessage ...
aiMessageDescriptor = XAiModelsHelper.GetXAiMessageMongoRepositoryDescriptor();
//
// XAiProject ...
aiProjectDescriptor = XAiModelsHelper.GetXAiProjectMongoRepositoryDescriptor();
//
// XAiConversation ...
aiConversationDescriptor = XAiModelsHelper.GetXAiConversationMongoRepositoryDescriptor();
break;
//
case XRepositoryType.InMemory:
//
// XAiMessage ...
aiMessageDescriptor = XAiModelsHelper.GetXAiMessageInMemoryRepositoryDescriptor();
//
// XAiProject ...
aiProjectDescriptor = XAiModelsHelper.GetXAiProjectInMemoryRepositoryDescriptor();
//
// XAiConversation ...
aiConversationDescriptor = XAiModelsHelper.GetXAiConversationInMemoryRepositoryDescriptor();
break;
}
//
#region Register Repository Descriptor ...
//
// XAiMessage ...
if (!aiMessageDescriptor.IsNull())
{
//
services.AddXRepository(
lifeTime: lifeTime,
descriptor: aiMessageDescriptor
);
}
//
// XAiProject ...
if (!aiProjectDescriptor.IsNull())
{
//
services.AddXRepository(
lifeTime: lifeTime,
descriptor: aiProjectDescriptor
);
}
//
// XAiConversation ...
if (!aiConversationDescriptor.IsNull())
{
//
services.AddXRepository(
lifeTime: lifeTime,
descriptor: aiConversationDescriptor
);
}
#endregion
//
#region Register Services ...
//
#region AiMessage ...
//
// Models ...
services.Add(
new ServiceDescriptor(typeof(IXAiMessageServiceProvider), typeof(XAiMessageServiceProvider), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiMessageRepositoryService), typeof(XAiMessageRepositoryService), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiMessageRepositoryProvider), typeof(XAiMessageRepositoryProvider), lifeTime)
);
#endregion
//
#region AiProject ...
//
// Models ...
services.Add(
new ServiceDescriptor(typeof(IXAiProjectServiceProvider), typeof(XAiProjectServiceProvider), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiProjectRepositoryService), typeof(XAiProjectRepositoryService), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiProjectRepositoryProvider), typeof(XAiProjectRepositoryProvider), lifeTime)
);
//
// Resource Providers ...
services.Add(
new ServiceDescriptor(typeof(IXAiProjectTitleResourceProvider), typeof(XAiProjectTitleResourceProvider), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiProjectDescriptionResourceProvider), typeof(XAiProjectDescriptionResourceProvider), lifeTime)
);
#endregion
//
#region AiConversation ...
//
// Models ...
services.Add(
new ServiceDescriptor(typeof(IXAiConversationServiceProvider), typeof(XAiConversationServiceProvider), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiConversationRepositoryService), typeof(XAiConversationRepositoryService), lifeTime)
);
services.Add(
new ServiceDescriptor(typeof(IXAiConversationRepositoryProvider), typeof(XAiConversationRepositoryProvider), lifeTime)
);
//
// Resource Providers ...
services.Add(
new ServiceDescriptor(typeof(IXAiConversationTitleResourceProvider), typeof(XAiConversationTitleResourceProvider), lifeTime)
);
#endregion
#endregion
//
Log("Service Regitration Succeed ...");
}
#endregion
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Extensions\ChatResponseExtensions.cs
using Microsoft.Extensions.AI;
using xCommons.Extensions;
namespace xAiModels.Extensions
{
public static class ChatResponseExtensions
{
/// <summary>
/// Validate a Chat Response ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this ChatResponse source)
{
//
var result =
source is not null &&
!source.IsNullOrDefault() &&
!string.IsNullOrWhiteSpace(source.Text) &&
source.FinishReason == ChatFinishReason.Stop;
//
return result;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Extensions\ChatRoleExtensions.cs
using Microsoft.Extensions.AI;
using xAiModels.Constants;
using xCommons.Extensions;
namespace xAiModels.Extensions
{
/// <summary>
/// Extensions for ChatRole ...
/// </summary>
public static class ChatRoleExtensions
{
/// <summary>
/// Normalize an String to Propper Chat Role Value ...
/// <see cref="XAiChatRoles"/>>
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static string GetChatRoleTitle(this string source)
{
//
var result = XAiChatRoles.None;
//
if (source.ToNormalString() == XAiChatRoles.None.ToNormalString())
{
result = XAiChatRoles.None;
}
else if (source.ToNormalString() == XAiChatRoles.User.ToNormalString())
{
result = XAiChatRoles.User;
}
else if (source.ToNormalString() == XAiChatRoles.Tool.ToNormalString())
{
result = XAiChatRoles.Tool;
}
else if (source.ToNormalString() == XAiChatRoles.System.ToNormalString())
{
result = XAiChatRoles.System;
}
else if (source.ToNormalString() == XAiChatRoles.Assistant.ToNormalString())
{
result = XAiChatRoles.Assistant;
}
//
return result;
}
/// <summary>
/// Get Chat Role Title from Chat Role Class ...
/// <see cref="XAiChatRoles"/>
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static string GetRole(this ChatRole source)
{
//
var result = source.Value
.GetChatRoleTitle();
//
return result;
}
/// <summary>
/// Generate Chat Role Class Based on role Title ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static ChatRole ToChatRole(this string source)
{
//
var role = source.GetChatRoleTitle();
ChatRole result = new ChatRole(role);
//
return result;
}
/// <summary>
/// Generate Chat Role Class Based on role Title ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static ChatRole ToChatRole(this XAiChatRole source)
{
//
var role = source.GetStringValue();
ChatRole result = new ChatRole(role);
//
return result;
}
/// <summary>
/// Extract Chat Role Enum from Chat Role ...
/// <see cref="ChatRole"/>
/// <see cref="XAiChatRole"/>
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static XAiChatRole ToChatRole(this ChatRole source)
{
//
var role = source
.GetRole()
.GetChatRoleTitle();
//
XAiChatRole result = XAiChatRole.User;
//
if (role == XAiChatRoles.User)
{
result = XAiChatRole.User;
}
else if (role == XAiChatRoles.Tool)
{
result = XAiChatRole.Tool;
}
else if (role == XAiChatRoles.System)
{
result = XAiChatRole.System;
}
else if (role == XAiChatRoles.Assistant)
{
result = XAiChatRole.Assistant;
}
//
return result;
}
/// <summary>
/// Validate an String as Chat Role ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this string source)
{
//
var result =
source != XAiChatRoles.None &&
source.ToNormalString() != XAiChatRoles.None.ToNormalString();
//
return result;
}
/// <summary>
/// Validate Role ...
/// <see cref="XAiChatRole"/>>
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this XAiChatRole source)
{
//
var result = source != XAiChatRole.None;
return result;
}
/// <summary>
/// Validate Role ...
/// <see cref="ChatRole"/>>
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this ChatRole source)
{
//
var role = source.ToChatRole();
var result = role.IsValid();
return result;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Extensions\XAiApiConfigurationExtensions.cs
using System.Linq;
using xAiModels.Configurations;
using xAiModels.Models;
using xCommons.Extensions;
namespace xAiModels.Extensions
{
public static class XAiApiConfigurationExtensions
{
/// <summary>
/// Validate Api Configuration ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this XAiApiConfiguration source)
{
return
!source.IsNullOrDefault() &&
source.Models.HasChild();
}
/// <summary>
/// Retrieve Default Model Descriptor ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static XAiModelDescriptor GetDefaultModel(this XAiApiConfiguration source)
{
//
XAiModelDescriptor result = null;
//
if (source.IsValid())
{
result = source.Models.First();
}
//
return result;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Helpers\XAiModelsHelper.cs
using System;
using GraphQL.Types;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xAiModels.Providers.Entities;
using xAiModels.Providers.GraphQL;
using xDataService.Db;
using xDataService.Models;
using xDataService.Providers;
namespace xAiModels.Helpers
{
public static class XAiModelsHelper
{
//
#region XAiConversation ...
//
#region EF Repository Descriptor Provider(s) ...
public static XEFRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationEFRepository<TContext>,
TContext
> GetXAiConversationEFRepositoryDescriptor<TContext>()
where TContext : XDbContext
{
//
var result = new XEFRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationEFRepository<TContext>,
TContext
>();
//
return result;
}
public static XEFRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationEFRepository<TContext>,
TContext,
IXAiConversationSeeder,
TSeederImplementation
> GetXAiConversationEFRepositoryDescriptor<TContext, TSeederImplementation>()
where TContext : XDbContext
where TSeederImplementation : XBaseDbSeeder<XAiConversation, Guid>
{
//
var result = new XEFRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationEFRepository<TContext>,
TContext,
IXAiConversationSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
//
#region Mongo Repository Descriptor Provider(s) ...
public static XMongoRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationMongoRepository
> GetXAiConversationMongoRepositoryDescriptor()
{
//
var result = new XMongoRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationMongoRepository
>();
//
return result;
}
public static XMongoRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationMongoRepository,
IXAiConversationSeeder,
TSeederImplementation
> GetXAiConversationMongoRepositoryDescriptor<TSeederImplementation>()
where TSeederImplementation : XBaseDbSeeder<XAiConversation, Guid>
{
//
var result = new XMongoRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationMongoRepository,
IXAiConversationSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
//
#region InMemory Repository Descriptor Provider(s) ...
public static XInMemoryRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationInMemoryRepository
> GetXAiConversationInMemoryRepositoryDescriptor()
{
//
var result = new XInMemoryRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationInMemoryRepository
>();
//
return result;
}
public static XInMemoryRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationInMemoryRepository,
IXAiConversationSeeder,
TSeederImplementation
> GetXAiConversationInMemoryRepositoryDescriptor<TSeederImplementation>()
where TSeederImplementation : XBaseDbSeeder<XAiConversation, Guid>
{
//
var result = new XInMemoryRepositoryDescriptor<
XAiConversation,
Guid,
IXAiConversationKeyGenerator,
XAiConversationKeyGenerator,
IXAiConversationRepositoryEvents,
XAiConversationRepositoryEvents,
XAiConversationGraphType,
GuidGraphType,
XAiConversationGraphQuery,
IXAiConversationGraphQLTypeHelper,
XAiConversationGraphQLTypeHelper,
XAiConversationGraphSchema,
IXAiConversationRepository,
XAiConversationInMemoryRepository,
IXAiConversationSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
#endregion
//
#region XAiMessage ...
//
#region EF Repository Descriptor Provider(s) ...
public static XEFRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageEFRepository<TContext>,
TContext
> GetXAiMessageEFRepositoryDescriptor<TContext>()
where TContext : XDbContext
{
//
var result = new XEFRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageEFRepository<TContext>,
TContext
>();
//
return result;
}
public static XEFRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageEFRepository<TContext>,
TContext,
IXAiMessageSeeder,
TSeederImplementation
> GetXAiMessageEFRepositoryDescriptor<TContext, TSeederImplementation>()
where TContext : XDbContext
where TSeederImplementation : XBaseDbSeeder<XAiMessage, Guid>
{
//
var result = new XEFRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageEFRepository<TContext>,
TContext,
IXAiMessageSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
//
#region Mongo Repository Descriptor Provider(s) ...
public static XMongoRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageMongoRepository
> GetXAiMessageMongoRepositoryDescriptor()
{
//
var result = new XMongoRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageMongoRepository
>();
//
return result;
}
public static XMongoRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageMongoRepository,
IXAiMessageSeeder,
TSeederImplementation
> GetXAiMessageMongoRepositoryDescriptor<TSeederImplementation>()
where TSeederImplementation : XBaseDbSeeder<XAiMessage, Guid>
{
//
var result = new XMongoRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageMongoRepository,
IXAiMessageSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
//
#region InMemory Repository Descriptor Provider(s) ...
public static XInMemoryRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageInMemoryRepository
> GetXAiMessageInMemoryRepositoryDescriptor()
{
//
var result = new XInMemoryRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageInMemoryRepository
>();
//
return result;
}
public static XInMemoryRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageInMemoryRepository,
IXAiMessageSeeder,
TSeederImplementation
> GetXAiMessageInMemoryRepositoryDescriptor<TSeederImplementation>()
where TSeederImplementation : XBaseDbSeeder<XAiMessage, Guid>
{
//
var result = new XInMemoryRepositoryDescriptor<
XAiMessage,
Guid,
IXAiMessageKeyGenerator,
XAiMessageKeyGenerator,
IXAiMessageRepositoryEvents,
XAiMessageRepositoryEvents,
XAiMessageGraphType,
GuidGraphType,
XAiMessageGraphQuery,
IXAiMessageGraphQLTypeHelper,
XAiMessageGraphQLTypeHelper,
XAiMessageGraphSchema,
IXAiMessageRepository,
XAiMessageInMemoryRepository,
IXAiMessageSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
#endregion
//
#region XAiProject ...
//
#region EF Repository Descriptor Provider(s) ...
public static XEFRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectEFRepository<TContext>,
TContext
> GetXAiProjectEFRepositoryDescriptor<TContext>()
where TContext : XDbContext
{
//
var result = new XEFRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectEFRepository<TContext>,
TContext
>();
//
return result;
}
public static XEFRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectEFRepository<TContext>,
TContext,
IXAiProjectSeeder,
TSeederImplementation
> GetXAiProjectEFRepositoryDescriptor<TContext, TSeederImplementation>()
where TContext : XDbContext
where TSeederImplementation : XBaseDbSeeder<XAiProject, Guid>
{
//
var result = new XEFRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectEFRepository<TContext>,
TContext,
IXAiProjectSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
//
#region Mongo Repository Descriptor Provider(s) ...
public static XMongoRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectMongoRepository
> GetXAiProjectMongoRepositoryDescriptor()
{
//
var result = new XMongoRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectMongoRepository
>();
//
return result;
}
public static XMongoRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectMongoRepository,
IXAiProjectSeeder,
TSeederImplementation
> GetXAiProjectMongoRepositoryDescriptor<TSeederImplementation>()
where TSeederImplementation : XBaseDbSeeder<XAiProject, Guid>
{
//
var result = new XMongoRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectMongoRepository,
IXAiProjectSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
//
#region InMemory Repository Descriptor Provider(s) ...
public static XInMemoryRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectInMemoryRepository
> GetXAiProjectInMemoryRepositoryDescriptor()
{
//
var result = new XInMemoryRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectInMemoryRepository
>();
//
return result;
}
public static XInMemoryRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectInMemoryRepository,
IXAiProjectSeeder,
TSeederImplementation
> GetXAiProjectInMemoryRepositoryDescriptor<TSeederImplementation>()
where TSeederImplementation : XBaseDbSeeder<XAiProject, Guid>
{
//
var result = new XInMemoryRepositoryDescriptor<
XAiProject,
Guid,
IXAiProjectKeyGenerator,
XAiProjectKeyGenerator,
IXAiProjectRepositoryEvents,
XAiProjectRepositoryEvents,
XAiProjectGraphType,
GuidGraphType,
XAiProjectGraphQuery,
IXAiProjectGraphQLTypeHelper,
XAiProjectGraphQLTypeHelper,
XAiProjectGraphSchema,
IXAiProjectRepository,
XAiProjectInMemoryRepository,
IXAiProjectSeeder,
TSeederImplementation
>();
//
return result;
}
#endregion
#endregion
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiConversationTitleResourceProvider.cs
using xStringService.Interfaces;
namespace xAiModels.Interfaces
{
public interface IXAiConversationTitleResourceProvider : IXItemResourceProvider
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiDataProvider.cs
namespace xAiModels.Interfaces
{
/// <summary>
/// All Data Manipulation Requirements ...
/// </summary>
public interface IXAiDataProvider
{
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiProjectDescriptionResourceProvider.cs
using xStringService.Interfaces;
namespace xAiModels.Interfaces
{
public interface IXAiProjectDescriptionResourceProvider : IXItemResourceProvider
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiProjectTitleResourceProvider.cs
using xStringService.Interfaces;
namespace xAiModels.Interfaces
{
public interface IXAiProjectTitleResourceProvider : IXItemResourceProvider
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiConversationDtoHub.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiConversationDtoHub : IXBaseDtoHub<XAiConversation, XAiConversationDto, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiConversationRepositoryService.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiConversationRepositoryService : IXBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiConversationServiceProvider.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xAiModels.Providers.Dtos;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiConversationServiceProvider : IXBaseDtoProvider<XAiConversation, XAiConversationDto, Guid, XAiConversationDtoHub>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMessageDtoHub.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiMessageDtoHub : IXBaseDtoHub<XAiMessage, XAiMessageDto, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMessageRepositoryService.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiMessageRepositoryService : IXBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMessageServiceProvider.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xAiModels.Providers.Dtos;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiMessageServiceProvider : IXBaseDtoProvider<XAiMessage, XAiMessageDto, Guid, XAiMessageDtoHub>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiProjectDtoHub.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiProjectDtoHub : IXBaseDtoHub<XAiProject, XAiProjectDto, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiProjectRepositoryService.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiProjectRepositoryService : IXBaseRepositoryService<XAiProject, XAiProjectDto, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiProjectServiceProvider.cs
using System;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xAiModels.Providers.Dtos;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Dtos
{
public interface IXAiProjectServiceProvider : IXBaseDtoProvider<XAiProject, XAiProjectDto, Guid, XAiProjectDtoHub>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationEntityHub.cs
using System;
using xAiModels.Models.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationEntityHub : IXBaseEntityHub<XAiConversation, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationGraphQLTypeHelper.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XAiConversation, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationKeyGenerator.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationKeyGenerator : IXKeyGenerator<XAiConversation, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationRepository.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationRepository : IXBaseRepository<XAiConversation, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationRepositoryEvents.cs
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationRepositoryEvents : IXBaseRepositoryEvents<XAiConversation>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationRepositoryProvider.cs
using System;
using xAiModels.Models.Entities;
using xAiModels.Providers.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationRepositoryProvider : IXBaseEntityProvider<XAiConversation, Guid, XAiConversationEntityHub>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationSeeder.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiConversationSeeder : IXBaseDbSeeder<XAiConversation, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageEntityHub.cs
using System;
using xAiModels.Models.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageEntityHub : IXBaseEntityHub<XAiMessage, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageGraphQLTypeHelper.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XAiMessage, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageKeyGenerator.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageKeyGenerator : IXKeyGenerator<XAiMessage, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageRepository.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageRepository : IXBaseRepository<XAiMessage, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageRepositoryEvents.cs
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageRepositoryEvents : IXBaseRepositoryEvents<XAiMessage>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageRepositoryProvider.cs
using System;
using xAiModels.Models.Entities;
using xAiModels.Providers.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageRepositoryProvider : IXBaseEntityProvider<XAiMessage, Guid, XAiMessageEntityHub>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageSeeder.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiMessageSeeder : IXBaseDbSeeder<XAiMessage, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectEntityHub.cs
using System;
using xAiModels.Models.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectEntityHub : IXBaseEntityHub<XAiProject, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectGraphQLTypeHelper.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XAiProject, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectKeyGenerator.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectKeyGenerator : IXKeyGenerator<XAiProject, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectRepository.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectRepository : IXBaseRepository<XAiProject, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectRepositoryEvents.cs
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectRepositoryEvents : IXBaseRepositoryEvents<XAiProject>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectRepositoryProvider.cs
using System;
using xAiModels.Models.Entities;
using xAiModels.Providers.Entities;
using xPushService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectRepositoryProvider : IXBaseEntityProvider<XAiProject, Guid, XAiProjectEntityHub>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectSeeder.cs
using System;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
namespace xAiModels.Interfaces.Entities
{
public interface IXAiProjectSeeder : IXBaseDbSeeder<XAiProject, Guid>
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiModelDescriptor.cs
using xAiModels.Constants;
namespace xAiModels.Models
{
/// <summary>
/// Describe a Provided Model ...
/// </summary>
public class XAiModelDescriptor
{
/// <summary>
/// Provider Name ...
/// </summary>
public string Name { get; set; }
/// <summary>
/// LLM Provider Url ...
/// </summary>
public string Url { get; set; }
/// <summary>
/// Model Name ...
/// </summary>
public string LLM { get; set; }
/// <summary>
/// Api Key for Connection ...
/// </summary>
public string ApiKey { get; set; }
/// <summary>
/// Specified Model Provider Type ...
/// </summary>
public XAiModelProviderType Provider { get; set; } = XAiModelProviderType.Ollama;
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiConversationDto.cs
using System;
using xModels.Base;
using xModels.Dtos;
namespace xAiModels.Models.Dtos
{
/// <summary>
/// Conversation Describe ...
/// </summary>
public class XAiConversationDto : XBaseGuidIDEntityDto
{
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
public string OwnerId { get; set; }
/// <summary>
/// Owner Info ...
/// </summary>
public virtual XPersonDto Owner { get; set; } = null;
/// <summary>
/// Conversation Title Resource ID ...
/// </summary>
public string Title { get; set; }
/// <summary>
/// All Exists Title Locale Resources ...
/// </summary>
public virtual XLocaleResourceDto[] TitleLocales { get; set; }
/// <summary>
/// Created Time ...
/// </summary>
public DateTime CreatedOn { get; set; }
/// <summary>
/// Updated Time ...
/// </summary>
public DateTime UpdatedAt { get; set; }
/// <summary>
/// Project ID ...
/// </summary>
public Guid ProjectId { get; set; }
/// <summary>
/// Project Title Resource ID ...
/// </summary>
public virtual string ProjectTitle { get; set; } = null;
/// <summary>
/// Project Description Resource ID ...
/// </summary>
public virtual string ProjectDescription { get; set; } = null;
/// <summary>
/// Project Title Locale Resources ...
/// </summary>
public virtual XLocaleResourceDto[] ProjectTitleLocales { get; set; }
/// <summary>
/// Project Description Locale Resources ...
/// </summary>
public virtual XLocaleResourceDto[] ProjectDescriptionLocales { get; set; }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiMessageDto.cs
using System;
using System.Collections.Generic;
using xAiModels.Constants;
using xCommons.Extensions;
using xModels.Base;
using xModels.Dtos;
namespace xAiModels.Models.Dtos
{
public class XAiMessageDto : XBaseGuidIDEntityDto
{
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
public string OwnerId { get; set; }
/// <summary>
/// Owner Info ...
/// </summary>
public virtual XPersonDto Owner { get; set; } = null;
/// <summary>
/// Message of Chat ...
/// </summary>
public string Content { get; set; }
/// <summary>
/// Role of Message ...
/// </summary>
public XAiChatRole Role { get; set; }
/// <summary>
/// Created Time ...
/// </summary>
public DateTime CreatedOn { get; set; }
/// <summary>
/// Updated Time ...
/// </summary>
public DateTime UpdatedAt { get; set; }
/// <summary>
/// Conversation Id ...
/// </summary>
public Guid ConversationId { get; set; }
/// <summary>
/// Conversation Info ...
/// </summary>
public virtual XAiConversationDto Conversation { get; set; } = null;
//
#region Meta Data Property ...
private string _metadata;
/// <summary>
/// Meta Data of Message ...
/// </summary>
public IDictionary<string, object> Metadata { get; private set; } = null;
/// <summary>
/// Meta Data of MEssage in Json ...
/// </summary>
public string MeatDatas
{
//
get => _metadata;
//
set
{
//
// Converts Json String to Dictionary ...
if (!value.IsNullOrEmpty())
{
Metadata = value.FromJSON<IDictionary<string, object>>();
}
//
_metadata = value;
}
}
#endregion
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiProjectDto.cs
using System;
using System.Collections.Generic;
using xModels.Base;
using xModels.Dtos;
namespace xAiModels.Models.Dtos
{
/// <summary>
/// Describe a Project ...
/// </summary>
public class XAiProjectDto : XBaseGuidIDEntityDto
{
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
public string OwnerId { get; set; }
/// <summary>
/// Owner Info ...
/// </summary>
public virtual XPersonDto Owner { get; set; } = null;
/// <summary>
/// Title of Project ...
/// </summary>
public string Title { get; set; }
/// <summary>
/// All Exists Title Locale Resources ...
/// </summary>
public virtual XLocaleResourceDto[] TitleLocales { get; set; }
/// <summary>
/// Description of Project ...
/// </summary>
public string Description { get; set; }
/// <summary>
/// All Exists Description Locale Resources ...
/// </summary>
public virtual XLocaleResourceDto[] DescriptionLocales { get; set; }
/// <summary>
/// a Prompt for Project Start ...
/// </summary>
public string Prompt { get; set; }
/// <summary>
/// Created Time ...
/// </summary>
public DateTime CreatedOn { get; set; }
/// <summary>
/// Updated Time ...
/// </summary>
public DateTime UpdatedAt { get; set; }
/// <summary>
/// Conversations ...
/// </summary>
public virtual IList<XAiConversationDto> Conversations { get; set; } = [];
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiConversation.cs
using System;
using System.ComponentModel.DataAnnotations;
using xModels.Base;
namespace xAiModels.Models.Entities
{
/// <summary>
/// Conversation Describe ...
/// </summary>
public class XAiConversation : XBaseGuidIDEntity
{
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
[Required]
[StringLength(255)]
public string OwnerId { get; set; }
/// <summary>
/// Title of Conversation ...
/// </summary>
[Required]
[StringLength(255)]
public string Title { get; set; }
/// <summary>
/// Created Time ...
/// </summary>
public DateTime CreatedOn { get; set; }
/// <summary>
/// Updated Time ...
/// </summary>
public DateTime UpdatedAt { get; set; }
/// <summary>
/// Project ID ...
/// </summary>
[Required]
public Guid ProjectId { get; set; }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiMessage.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using xAiModels.Constants;
using xCommons.Extensions;
using xModels.Base;
namespace xAiModels.Models.Entities
{
/// <summary>
/// Message Model of Ai ...
/// </summary>
public class XAiMessage : XBaseGuidIDEntity
{
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
[Required]
[StringLength(255)]
public string OwnerId { get; set; }
/// <summary>
/// Message of Chat ...
/// </summary>
[Required]
public string Content { get; set; }
/// <summary>
/// Role of Message ...
/// </summary>
public XAiChatRole Role { get; set; }
/// <summary>
/// Created Time ...
/// </summary>
public DateTime CreatedOn { get; set; }
/// <summary>
/// Updated Time ...
/// </summary>
public DateTime UpdatedAt { get; set; }
/// <summary>
/// Conversation Id ...
/// </summary>
[StringLength(255)]
public Guid ConversationId { get; set; }
//
#region Meta Data Property ...
private string _metadata;
/// <summary>
/// Meta Data of Message ...
/// </summary>
[NotMapped]
public IDictionary<string, object> Metadata { get; private set; } = null;
/// <summary>
/// Meta Data of MEssage in Json ...
/// </summary>
public string MeatDatas
{
//
get => _metadata;
//
set
{
//
// Converts Json String to Dictionary ...
if (!value.IsNullOrEmpty())
{
Metadata = value.FromJSON<IDictionary<string, object>>();
}
//
_metadata = value;
}
}
#endregion
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiProject.cs
using System;
using System.ComponentModel.DataAnnotations;
using xModels.Base;
namespace xAiModels.Models.Entities
{
/// <summary>
/// Describe a Project ...
/// </summary>
public class XAiProject : XBaseGuidIDEntity
{
/// <summary>
/// User Identifier ...
/// </summary>
/// <value></value>
[Required]
[StringLength(255)]
public string OwnerId { get; set; }
/// <summary>
/// Title of Project ...
/// </summary>
[Required]
[StringLength(255)]
public string Title { get; set; }
/// <summary>
/// Description of Project ...
/// </summary>
[StringLength(1000)]
public string Description { get; set; }
/// <summary>
/// a Prompt for Project Start ...
/// </summary>
public string Prompt { get; set; }
/// <summary>
/// Created Time ...
/// </summary>
public DateTime CreatedOn { get; set; }
/// <summary>
/// Updated Time ...
/// </summary>
public DateTime UpdatedAt { get; set; }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiConversationEntityRegisterar.cs
using System;
using Microsoft.EntityFrameworkCore;
using xAiModels.Configurations.Entities;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xAiModels.Providers
{
public class XAiConversationEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
{
public XAiConversationEntityRegisterar()
: base(nameof(XAiConversationEntityRegisterar))
{
//
// Add Entity ...
AddEntity<XAiConversation, Guid>();
}
/// <summary>
/// Configure Entities ...
/// </summary>
/// <param name="modelBuilder"></param>
public override void ConfigureEntities(ModelBuilder modelBuilder)
{
//
// Configure Entity Using Provided ...
modelBuilder
.ApplyConfigurationsFromAssembly(typeof(XAiConversationEntityConfiguration).Assembly);
//
base.ConfigureEntities(modelBuilder);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiConversationTitleResourceProvider.cs
using xAiModels.Constants;
using xAiModels.Interfaces;
using xStringService.Interfaces.Dtos;
using xStringService.Providers;
namespace xAiModels.Providers
{
public class XAiConversationTitleResourceProvider : XBaseItemResourceProvider, IXAiConversationTitleResourceProvider
{
public XAiConversationTitleResourceProvider(
IXStringServiceProvider stringProvider
) : base(
stringProvider: stringProvider,
item: XAiModelsConstants.XAiConversationTitleIdentifier
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiDataProvider.cs
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces;
using xAiModels.Interfaces.Entities;
using xAiModels.Providers.Dtos;
using xAiModels.Providers.Entities;
namespace xAiModels.Providers
{
/// <summary>
/// All Data Manipulation Requirements ...
/// </summary>
public class XAiDataProvider : IXAiDataProvider
{
private readonly IHubContext<XAiMessageDtoHub> messageDtoHub;
private readonly IHubContext<XAiProjectDtoHub> projectDtoHub;
private readonly IXAiMessageRepository messageRepositoryService;
private readonly IXAiProjectRepository projectRepositoryService;
private readonly IHubContext<XAiMessageEntityHub> messageEntityHub;
private readonly IHubContext<XAiProjectEntityHub> projectEntityHub;
private readonly IXAiConversationRepository conversationRepository;
private readonly IHubContext<XAiConversationDtoHub> conversationDtoHub;
private readonly IHubContext<XAiConversationEntityHub> conversationEntityHub;
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
public XAiDataProvider(
IHubContext<XAiMessageDtoHub> messageDtoHub,
IHubContext<XAiProjectDtoHub> projectDtoHub,
IXAiMessageRepository messageRepositoryService,
IXAiProjectRepository projectRepositoryService,
IHubContext<XAiMessageEntityHub> messageEntityHub,
IHubContext<XAiProjectEntityHub> projectEntityHub,
IXAiConversationRepository conversationRepository,
IHubContext<XAiConversationDtoHub> conversationDtoHub,
IHubContext<XAiConversationEntityHub> conversationEntityHub,
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
)
{
this.messageDtoHub = messageDtoHub;
this.projectDtoHub = projectDtoHub;
this.projectEntityHub = projectEntityHub;
this.messageEntityHub = messageEntityHub;
this.conversationDtoHub = conversationDtoHub;
this.conversationEntityHub = conversationEntityHub;
this.conversationRepository = conversationRepository;
this.messageRepositoryService = messageRepositoryService;
this.projectRepositoryService = projectRepositoryService;
this.projectTitleResourceProvider = projectTitleResourceProvider;
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiMessageEntityRegisterar.cs
using System;
using Microsoft.EntityFrameworkCore;
using xAiModels.Configurations.Entities;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xAiModels.Providers
{
public class XAiMessageEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
{
public XAiMessageEntityRegisterar()
: base(nameof(XAiMessageEntityRegisterar))
{
//
// Add Entity ...
AddEntity<XAiMessage, Guid>();
}
/// <summary>
/// Configure Entities ...
/// </summary>
/// <param name="modelBuilder"></param>
public override void ConfigureEntities(ModelBuilder modelBuilder)
{
//
// Configure Entity Using Provided ...
modelBuilder
.ApplyConfigurationsFromAssembly(typeof(XAiMessageEntityConfiguration).Assembly);
//
base.ConfigureEntities(modelBuilder);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiProjectDescriptionResourceProvider.cs
using xAiModels.Constants;
using xAiModels.Interfaces;
using xStringService.Interfaces.Dtos;
using xStringService.Providers;
namespace xAiModels.Providers
{
public class XAiProjectDescriptionResourceProvider : XBaseItemResourceProvider, IXAiProjectDescriptionResourceProvider
{
public XAiProjectDescriptionResourceProvider(
IXStringServiceProvider stringProvider
) : base(
stringProvider: stringProvider,
item: XAiModelsConstants.XAiProjectDescriptionIdentifier
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiProjectEntityRegisterar.cs
using System;
using Microsoft.EntityFrameworkCore;
using xAiModels.Configurations.Entities;
using xAiModels.Models.Entities;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xAiModels.Providers
{
public class XAiProjectEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar
{
public XAiProjectEntityRegisterar()
: base(nameof(XAiProjectEntityRegisterar))
{
//
// Add Entity ...
AddEntity<XAiProject, Guid>();
}
/// <summary>
/// Configure Entities ...
/// </summary>
/// <param name="modelBuilder"></param>
public override void ConfigureEntities(ModelBuilder modelBuilder)
{
//
// Configure Entity Using Provided ...
modelBuilder
.ApplyConfigurationsFromAssembly(typeof(XAiProjectEntityConfiguration).Assembly);
//
base.ConfigureEntities(modelBuilder);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiProjectTitleResourceProvider.cs
using xAiModels.Constants;
using xAiModels.Interfaces;
using xStringService.Interfaces.Dtos;
using xStringService.Providers;
namespace xAiModels.Providers
{
public class XAiProjectTitleResourceProvider : XBaseItemResourceProvider, IXAiProjectTitleResourceProvider
{
public XAiProjectTitleResourceProvider(
IXStringServiceProvider stringProvider
) : base(
stringProvider: stringProvider,
item: XAiModelsConstants.XAiProjectTitleIdentifier
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiConversationDtoHub.cs
using System;
using Microsoft.Extensions.Logging;
using xAiModels.Interfaces.Dtos;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xPushService.Base;
namespace xAiModels.Providers.Dtos
{
public class XAiConversationDtoHub : XBaseDtoHub<XAiConversation, XAiConversationDto, Guid>, IXAiConversationDtoHub
{
public XAiConversationDtoHub(
ILogger<XAiConversationDtoHub> logger
) : base(logger)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiConversationRepositoryService.cs
using System;
using System.Collections.Generic;
using AutoMapper;
using xAiModels.Interfaces.Dtos;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Dtos
{
public class XAiConversationRepositoryService : XBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>, IXAiConversationRepositoryService
{
public XAiConversationRepositoryService(
IXAiConversationRepository repository,
IEnumerable<Profile> mapperProfiles = null
) : base(
repository,
mapperProfiles
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiConversationServiceProvider.cs
using System;
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces.Dtos;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xAiModels.Providers.Dtos
{
public class XAiConversationServiceProvider : XBaseDtoProvider<XAiConversation, XAiConversationDto, Guid, XAiConversationDtoHub>, IXAiConversationServiceProvider
{
public XAiConversationServiceProvider(
IHubContext<XAiConversationDtoHub> hub,
XDataServiceConfiguration dataConfiguration,
IXAiConversationRepositoryService service,
IXIdentityProvider identityProvider = null
) : base(
hub,
dataConfiguration,
service,
identityProvider
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMessageDtoHub.cs
using System;
using Microsoft.Extensions.Logging;
using xAiModels.Interfaces.Dtos;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xPushService.Base;
namespace xAiModels.Providers.Dtos
{
public class XAiMessageDtoHub : XBaseDtoHub<XAiMessage, XAiMessageDto, Guid>, IXAiMessageDtoHub
{
public XAiMessageDtoHub(
ILogger<XAiMessageDtoHub> logger
) : base(logger)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMessageRepositoryService.cs
using System;
using System.Collections.Generic;
using AutoMapper;
using xAiModels.Interfaces.Dtos;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Dtos
{
public class XAiMessageRepositoryService : XBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>, IXAiMessageRepositoryService
{
public XAiMessageRepositoryService(
IXAiMessageRepository repository,
IEnumerable<Profile> mapperProfiles = null
) : base(
repository,
mapperProfiles
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMessageServiceProvider.cs
using System;
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces.Dtos;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xAiModels.Providers.Dtos
{
public class XAiMessageServiceProvider : XBaseDtoProvider<XAiMessage, XAiMessageDto, Guid, XAiMessageDtoHub>, IXAiMessageServiceProvider
{
public XAiMessageServiceProvider(
IHubContext<XAiMessageDtoHub> hub,
XDataServiceConfiguration dataConfiguration,
IXAiMessageRepositoryService service,
IXIdentityProvider identityProvider = null
) : base(
hub,
dataConfiguration,
service,
identityProvider
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiProjectDtoHub.cs
using System;
using Microsoft.Extensions.Logging;
using xAiModels.Interfaces.Dtos;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xPushService.Base;
namespace xAiModels.Providers.Dtos
{
public class XAiProjectDtoHub : XBaseDtoHub<XAiProject, XAiProjectDto, Guid>, IXAiProjectDtoHub
{
public XAiProjectDtoHub(
ILogger<XAiProjectDtoHub> logger
) : base(logger)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiProjectRepositoryService.cs
using System;
using System.Collections.Generic;
using AutoMapper;
using xAiModels.Interfaces.Dtos;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Dtos
{
public class XAiProjectRepositoryService : XBaseRepositoryService<XAiProject, XAiProjectDto, Guid>, IXAiProjectRepositoryService
{
public XAiProjectRepositoryService(
IXAiProjectRepository repository,
IEnumerable<Profile> mapperProfiles = null
) : base(
repository,
mapperProfiles
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiProjectServiceProvider.cs
using System;
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces.Dtos;
using xAiModels.Models.Dtos;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xAiModels.Providers.Dtos
{
public class XAiProjectServiceProvider : XBaseDtoProvider<XAiProject, XAiProjectDto, Guid, XAiProjectDtoHub>, IXAiProjectServiceProvider
{
public XAiProjectServiceProvider(
IHubContext<XAiProjectDtoHub> hub,
XDataServiceConfiguration dataConfiguration,
IXAiProjectRepositoryService service,
IXIdentityProvider identityProvider = null
) : base(
hub,
dataConfiguration,
service,
identityProvider
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationEFRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Db;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiConversationEFRepository<TContext> : XBaseEFRepository<XAiConversation, Guid, TContext>, IXAiConversationRepository
where TContext : XDbContext
{
public XAiConversationEFRepository(
IXUnitOfWorks<TContext> unitOfWorks,
XDataServiceConfiguration configuration,
IXAiConversationKeyGenerator keyGenerator = null,
IXAiConversationRepositoryEvents baseRepositoryEvents = null
) : base(
unitOfWorks,
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationEntityHub.cs
using System;
using Microsoft.Extensions.Logging;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xPushService.Base;
namespace xAiModels.Providers.Entities
{
public class XAiConversationEntityHub : XBaseEntityHub<XAiConversation, Guid>, IXAiConversationEntityHub
{
public XAiConversationEntityHub(
ILogger<XAiConversationEntityHub> logger
) : base(logger)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationInMemoryRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiConversationInMemoryRepository : XBaseInMemoryRepository<XAiConversation, Guid>, IXAiConversationRepository
{
public XAiConversationInMemoryRepository(
XDataServiceConfiguration configuration,
IXAiConversationKeyGenerator keyGenerator = null,
IXAiConversationRepositoryEvents baseRepositoryEvents = null
) : base(
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationKeyGenerator.cs
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiConversationKeyGenerator : XGuidKeyGenerator<XAiConversation>, IXAiConversationKeyGenerator
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationMongoRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiConversationMongoRepository : XBaseMongoRepository<XAiConversation, Guid>, IXAiConversationRepository
{
public XAiConversationMongoRepository(
XDataBaseConfiguration dbConfiguration,
XDataServiceConfiguration configuration,
string collectionName = null,
IXAiConversationKeyGenerator keyGenerator = null,
IXAiConversationRepositoryEvents baseRepositoryEvents = null
) : base(
dbConfiguration,
configuration,
collectionName,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationRepositoryEvents.cs
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiConversationRepositoryEvents : XBaseRepositoryEvents<XAiConversation>, IXAiConversationRepositoryEvents
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationRepositoryProvider.cs
using System;
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xAiModels.Providers.Entities
{
public class XAiConversationRepositoryProvider : XBaseEntityProvider<XAiConversation, Guid, XAiConversationEntityHub>, IXAiConversationRepositoryProvider
{
public XAiConversationRepositoryProvider(
IHubContext<XAiConversationEntityHub> hub,
IXAiConversationRepository repository,
XDataServiceConfiguration dataConfiguration,
IXIdentityProvider identityProvider = null
) : base(
hub,
repository,
dataConfiguration,
identityProvider
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationSeederBase.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public abstract class XAiConversationSeederBase : XBaseDbSeeder<XAiConversation, Guid>, IXAiConversationSeeder
{
protected XAiConversationSeederBase(
string entity,
string database,
IXAiConversationRepository repository,
XDataServiceConfiguration dataServiceConfiguration
) : base(
entity,
database,
repository,
dataServiceConfiguration
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageEFRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Db;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiMessageEFRepository<TContext> : XBaseEFRepository<XAiMessage, Guid, TContext>, IXAiMessageRepository
where TContext : XDbContext
{
public XAiMessageEFRepository(
IXUnitOfWorks<TContext> unitOfWorks,
XDataServiceConfiguration configuration,
IXAiMessageKeyGenerator keyGenerator = null,
IXAiMessageRepositoryEvents baseRepositoryEvents = null
) : base(
unitOfWorks,
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageEntityHub.cs
using System;
using Microsoft.Extensions.Logging;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xPushService.Base;
namespace xAiModels.Providers.Entities
{
public class XAiMessageEntityHub : XBaseEntityHub<XAiMessage, Guid>, IXAiMessageEntityHub
{
public XAiMessageEntityHub(
ILogger<XAiMessageEntityHub> logger
) : base(logger)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageInMemoryRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiMessageInMemoryRepository : XBaseInMemoryRepository<XAiMessage, Guid>, IXAiMessageRepository
{
public XAiMessageInMemoryRepository(
XDataServiceConfiguration configuration,
IXAiMessageKeyGenerator keyGenerator = null,
IXAiMessageRepositoryEvents baseRepositoryEvents = null
) : base(
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageKeyGenerator.cs
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiMessageKeyGenerator : XGuidKeyGenerator<XAiMessage>, IXAiMessageKeyGenerator
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageMongoRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiMessageMongoRepository : XBaseMongoRepository<XAiMessage, Guid>, IXAiMessageRepository
{
public XAiMessageMongoRepository(
XDataBaseConfiguration dbConfiguration,
XDataServiceConfiguration configuration,
string collectionName = null,
IXAiMessageKeyGenerator keyGenerator = null,
IXAiMessageRepositoryEvents baseRepositoryEvents = null
) : base(
dbConfiguration,
configuration,
collectionName,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageRepositoryEvents.cs
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiMessageRepositoryEvents : XBaseRepositoryEvents<XAiMessage>, IXAiMessageRepositoryEvents
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageRepositoryProvider.cs
using System;
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xAiModels.Providers.Entities
{
public class XAiMessageRepositoryProvider : XBaseEntityProvider<XAiMessage, Guid, XAiMessageEntityHub>, IXAiMessageRepositoryProvider
{
public XAiMessageRepositoryProvider(
IHubContext<XAiMessageEntityHub> hub,
IXAiMessageRepository repository,
XDataServiceConfiguration dataConfiguration,
IXIdentityProvider identityProvider = null
) : base(
hub,
repository,
dataConfiguration,
identityProvider
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageSeederBase.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public abstract class XAiMessageSeederBase : XBaseDbSeeder<XAiMessage, Guid>, IXAiMessageSeeder
{
protected XAiMessageSeederBase(
string entity,
string database,
IXAiMessageRepository repository,
XDataServiceConfiguration dataServiceConfiguration
) : base(
entity,
database,
repository,
dataServiceConfiguration
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectEFRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Db;
using xDataService.Interfaces;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiProjectEFRepository<TContext> : XBaseEFRepository<XAiProject, Guid, TContext>, IXAiProjectRepository
where TContext : XDbContext
{
public XAiProjectEFRepository(
IXUnitOfWorks<TContext> unitOfWorks,
XDataServiceConfiguration configuration,
IXAiProjectKeyGenerator keyGenerator = null,
IXAiProjectRepositoryEvents baseRepositoryEvents = null
) : base(
unitOfWorks,
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectEntityHub.cs
using System;
using Microsoft.Extensions.Logging;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xPushService.Base;
namespace xAiModels.Providers.Entities
{
public class XAiProjectEntityHub : XBaseEntityHub<XAiProject, Guid>, IXAiProjectEntityHub
{
public XAiProjectEntityHub(
ILogger<XAiProjectEntityHub> logger
) : base(logger)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectInMemoryRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiProjectInMemoryRepository : XBaseInMemoryRepository<XAiProject, Guid>, IXAiProjectRepository
{
public XAiProjectInMemoryRepository(
XDataServiceConfiguration configuration,
IXAiProjectKeyGenerator keyGenerator = null,
IXAiProjectRepositoryEvents baseRepositoryEvents = null
) : base(
configuration,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectKeyGenerator.cs
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiProjectKeyGenerator : XGuidKeyGenerator<XAiProject>, IXAiProjectKeyGenerator
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectMongoRepository.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiProjectMongoRepository : XBaseMongoRepository<XAiProject, Guid>, IXAiProjectRepository
{
public XAiProjectMongoRepository(
XDataBaseConfiguration dbConfiguration,
XDataServiceConfiguration configuration,
string collectionName = null,
IXAiProjectKeyGenerator keyGenerator = null,
IXAiProjectRepositoryEvents baseRepositoryEvents = null
) : base(
dbConfiguration,
configuration,
collectionName,
keyGenerator,
baseRepositoryEvents
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectRepositoryEvents.cs
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public class XAiProjectRepositoryEvents : XBaseRepositoryEvents<XAiProject>, IXAiProjectRepositoryEvents
{ }
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectRepositoryProvider.cs
using System;
using Microsoft.AspNetCore.SignalR;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xIdentityService.Interfaces;
using xPushService.Base;
namespace xAiModels.Providers.Entities
{
public class XAiProjectRepositoryProvider : XBaseEntityProvider<XAiProject, Guid, XAiProjectEntityHub>, IXAiProjectRepositoryProvider
{
public XAiProjectRepositoryProvider(
IHubContext<XAiProjectEntityHub> hub,
IXAiProjectRepository repository,
XDataServiceConfiguration dataConfiguration,
IXIdentityProvider identityProvider = null
) : base(
hub,
repository,
dataConfiguration,
identityProvider
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectSeederBase.cs
using System;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.Providers;
namespace xAiModels.Providers.Entities
{
public abstract class XAiProjectSeederBase : XBaseDbSeeder<XAiProject, Guid>, IXAiProjectSeeder
{
protected XAiProjectSeederBase(
string entity,
string database,
IXAiProjectRepository repository,
XDataServiceConfiguration dataServiceConfiguration
) : base(
entity,
database,
repository,
dataServiceConfiguration
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphQLTypeHelper.cs
using System;
using xAiModels.Constants;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiConversationGraphQLTypeHelper : XBaseGraphQLTypeHelper<XAiConversation, Guid>, IXAiConversationGraphQLTypeHelper
{
public override string GetInQueryCollectionName()
{
return XAiModelsConstants.XAiConversationCollectionName;
}
public override string GetInQuerySingleName()
{
return XAiModelsConstants.XAiConversationSignleName;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphQuery.cs
using System;
using GraphQL.Types;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiConversationGraphQuery : XBaseGraphQLQuery<XAiConversation, Guid, XAiConversationGraphType, GuidGraphType>
{
public XAiConversationGraphQuery(
XDataServiceConfiguration configuration,
IXAiConversationRepository repository,
IXAiConversationGraphQLTypeHelper helper
) : base(
configuration,
repository,
helper
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphSchema.cs
using System;
using GraphQL.Types;
namespace xAiModels.Providers.GraphQL
{
public class XAiConversationGraphSchema : Schema
{
public XAiConversationGraphSchema(IServiceProvider services) : base(services)
{
Query = (XAiConversationGraphQuery)services.GetService(typeof(XAiConversationGraphQuery));
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphType.cs
using System;
using xAiModels.Models.Entities;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiConversationGraphType : XBaseGraphObjectType<XAiConversation, Guid>
{
public XAiConversationGraphType() : base()
{
Field(x => x.Title);
Field(x => x.OwnerId);
Field(x => x.CreatedOn);
Field(x => x.UpdatedAt);
Field(x => x.ProjectId);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphQLTypeHelper.cs
using System;
using xAiModels.Constants;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiMessageGraphQLTypeHelper : XBaseGraphQLTypeHelper<XAiMessage, Guid>, IXAiMessageGraphQLTypeHelper
{
public override string GetInQueryCollectionName()
{
return XAiModelsConstants.XAiMessageCollectionName;
}
public override string GetInQuerySingleName()
{
return XAiModelsConstants.XAiMessageSingleName;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphQuery.cs
using System;
using GraphQL.Types;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiMessageGraphQuery : XBaseGraphQLQuery<XAiMessage, Guid, XAiMessageGraphType, GuidGraphType>
{
public XAiMessageGraphQuery(
XDataServiceConfiguration configuration,
IXAiMessageRepository repository,
IXAiMessageGraphQLTypeHelper helper
) : base(
configuration,
repository,
helper
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphSchema.cs
using System;
using GraphQL.Types;
namespace xAiModels.Providers.GraphQL
{
public class XAiMessageGraphSchema : Schema
{
public XAiMessageGraphSchema(IServiceProvider services) : base(services)
{
Query = (XAiMessageGraphQuery)services.GetService(typeof(XAiMessageGraphQuery));
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphType.cs
using System;
using xAiModels.Models.Entities;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiMessageGraphType: XBaseGraphObjectType<XAiMessage, Guid>
{
public XAiMessageGraphType() : base()
{
Field(x => x.Role);
Field(x => x.OwnerId);
Field(x => x.Content);
Field(x => x.Metadata);
Field(x => x.CreatedOn);
Field(x => x.UpdatedAt);
Field(x => x.ConversationId);
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphQLTypeHelper.cs
using System;
using xAiModels.Constants;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiProjectGraphQLTypeHelper : XBaseGraphQLTypeHelper<XAiProject, Guid>, IXAiProjectGraphQLTypeHelper
{
public override string GetInQueryCollectionName()
{
return XAiModelsConstants.XAiProjectCollectionName;
}
public override string GetInQuerySingleName()
{
return XAiModelsConstants.XAiProjectSingleName;
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphQuery.cs
using System;
using GraphQL.Types;
using xAiModels.Interfaces.Entities;
using xAiModels.Models.Entities;
using xDataService.Configuration;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiProjectGraphQuery : XBaseGraphQLQuery<XAiProject, Guid, XAiProjectGraphType, GuidGraphType>
{
public XAiProjectGraphQuery(
XDataServiceConfiguration configuration,
IXAiProjectRepository repository,
IXAiProjectGraphQLTypeHelper helper
) : base(
configuration,
repository,
helper
)
{ }
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphSchema.cs
using System;
using GraphQL.Types;
namespace xAiModels.Providers.GraphQL
{
public class XAiProjectGraphSchema : Schema
{
public XAiProjectGraphSchema(IServiceProvider services) : base(services)
{
Query = (XAiProjectGraphQuery)services.GetService(typeof(XAiProjectGraphQuery));
}
}
}
### FILE: C:\Users\SaherElm\Documents\Projects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphType.cs
using System;
using xAiModels.Models.Entities;
using xDataService.GraphQL;
namespace xAiModels.Providers.GraphQL
{
public class XAiProjectGraphType : XBaseGraphObjectType<XAiProject, Guid>
{
public XAiProjectGraphType() : base()
{
Field(x => x.Title);
Field(x => x.OwnerId);
Field(x => x.Prompt);
Field(x => x.CreatedOn);
Field(x => x.UpdatedAt);
Field(x => x.Description);
}
}
}