Compare commits
10
Commits
429c07a02d
...
5578c6cb2e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5578c6cb2e | ||
|
|
fa31d693d9 | ||
|
|
fbbc728366 | ||
|
|
9a13fa68a7 | ||
|
|
2696a9850c | ||
|
|
5824eda6cb | ||
|
|
116e240e70 | ||
|
|
d4de9e52c4 | ||
|
|
88ad441ba1 | ||
|
|
2144e9f8a7 |
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using AutoMapper;
|
||||
using xAiModels.Interfaces;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xIdentityService.Extensions;
|
||||
using xIdentityService.Interfaces;
|
||||
|
||||
namespace xAiModels.Configurations.Entities
|
||||
{
|
||||
public class XAiConversationMappingAction : IMappingAction<XAiConversation, XAiConversationDto>
|
||||
{
|
||||
private readonly IXIdentityProvider identityProvider;
|
||||
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
||||
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
||||
|
||||
public XAiConversationMappingAction(
|
||||
IXIdentityProvider identityProvider,
|
||||
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
||||
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
|
||||
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
||||
)
|
||||
{
|
||||
this.identityProvider = identityProvider;
|
||||
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
||||
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
||||
}
|
||||
|
||||
public void Process(
|
||||
XAiConversation source,
|
||||
XAiConversationDto 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 Project Info ...
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
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>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace xAiModels.Constants
|
||||
{
|
||||
public partial struct ConfigurationNodeNames
|
||||
{
|
||||
public const string AI_API_NODE = "AiApiConfiguration";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace xAiModels.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// Specifiy Provider Type ...
|
||||
/// </summary>
|
||||
public enum XAiModelProviderType
|
||||
{
|
||||
None,
|
||||
Ollama,
|
||||
DeepSeek,
|
||||
HuggingFace
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,486 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,816 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiConversationDtoHub : IXBaseDtoHub<XAiConversation, XAiConversationDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiConversationRepositoryService : IXBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiMessageDtoHub : IXBaseDtoHub<XAiMessage, XAiMessageDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiMessageRepositoryService : IXBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiProjectDtoHub : IXBaseDtoHub<XAiProject, XAiProjectDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Dtos;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Dtos
|
||||
{
|
||||
public interface IXAiProjectRepositoryService : IXBaseRepositoryService<XAiProject, XAiProjectDto, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationEntityHub : IXBaseEntityHub<XAiConversation, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XAiConversation, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationKeyGenerator : IXKeyGenerator<XAiConversation, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationRepository : IXBaseRepository<XAiConversation, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationRepositoryEvents : IXBaseRepositoryEvents<XAiConversation>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Providers.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationRepositoryProvider : IXBaseEntityProvider<XAiConversation, Guid, XAiConversationEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiConversationSeeder : IXBaseDbSeeder<XAiConversation, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageEntityHub : IXBaseEntityHub<XAiMessage, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageGraphQLTypeHelper : IXBaseGraphQLTypeHelper<XAiMessage, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageKeyGenerator : IXKeyGenerator<XAiMessage, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageRepository : IXBaseRepository<XAiMessage, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageRepositoryEvents : IXBaseRepositoryEvents<XAiMessage>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Providers.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageRepositoryProvider : IXBaseEntityProvider<XAiMessage, Guid, XAiMessageEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiMessageSeeder : IXBaseDbSeeder<XAiMessage, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiProjectEntityHub : IXBaseEntityHub<XAiProject, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
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>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiProjectKeyGenerator : IXKeyGenerator<XAiProject, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiProjectRepository : IXBaseRepository<XAiProject, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiProjectRepositoryEvents : IXBaseRepositoryEvents<XAiProject>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xAiModels.Providers.Entities;
|
||||
using xPushService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiProjectRepositoryProvider : IXBaseEntityProvider<XAiProject, Guid, XAiProjectEntityHub>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces.Entities
|
||||
{
|
||||
public interface IXAiProjectSeeder : IXBaseDbSeeder<XAiProject, Guid>
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces
|
||||
{
|
||||
public interface IXAiConversationTitleResourceProvider : IXItemResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace xAiModels.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// All Data Manipulation Requirements ...
|
||||
/// </summary>
|
||||
public interface IXAiDataProvider
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces
|
||||
{
|
||||
public interface IXAiProjectDescriptionResourceProvider : IXItemResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
using xStringService.Interfaces;
|
||||
|
||||
namespace xAiModels.Interfaces
|
||||
{
|
||||
public interface IXAiProjectTitleResourceProvider : IXItemResourceProvider
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -3,17 +3,23 @@ using System.Collections.Generic;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xAiModels.Models
|
||||
namespace xAiModels.Models.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// an Ai Project is a Conceptual Separation of AI Conversations ...
|
||||
/// Describe a Project ...
|
||||
/// </summary>
|
||||
public class XAiProjectDto : XBaseDto
|
||||
public class XAiProjectDto : XBaseGuidIDEntityDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of Project ...
|
||||
/// User Identifier ...
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
/// <value></value>
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Owner Info ...
|
||||
/// </summary>
|
||||
public virtual XPersonDto Owner { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// Title of Project ...
|
||||
@@ -40,16 +46,9 @@ namespace xAiModels.Models
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Identifier ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string OwnerId { get; set; }
|
||||
public XPersonDto Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Conversations ...
|
||||
/// </summary>
|
||||
public IEnumerable<XAiConversationDto> Conversations { get; set; }
|
||||
public virtual IList<XAiConversationDto> Conversations { get; set; } = [];
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xAiModels.Models
|
||||
namespace xAiModels.Models.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// Conversation Describe ...
|
||||
/// </summary>
|
||||
public class XAiConversationDto : XBaseDto
|
||||
public class XAiConversation : XBaseGuidIDEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of Conversation ...
|
||||
/// User Identifier ...
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
/// <value></value>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title of Conversation ...
|
||||
/// </summary>
|
||||
[Required]
|
||||
[StringLength(255)]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -30,26 +34,10 @@ namespace xAiModels.Models
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Messages of Conversation ...
|
||||
/// </summary>
|
||||
public IEnumerable<XAiMessageDto> Messages { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Identifier ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string OwnerId { get; set; }
|
||||
public XPersonDto Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Project ID ...
|
||||
/// </summary>
|
||||
[Required]
|
||||
public Guid ProjectId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Project ...
|
||||
/// </summary>
|
||||
public XAiProjectDto Project { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using xAiModels.Constants;
|
||||
using xModels.Base;
|
||||
using xModels.Dtos;
|
||||
|
||||
namespace xAiModels.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Message Model of Ai ...
|
||||
/// </summary>
|
||||
public class XAiMessageDto : XBaseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Id of Message ...
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <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>
|
||||
/// User Identifier ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string OwnerId { get; set; }
|
||||
public XPersonDto Owner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Conversation Id ...
|
||||
/// </summary>
|
||||
public Guid ConversationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Conversation ...
|
||||
/// </summary>
|
||||
public XAiConversationDto Conversation { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using xAiModels.Constants;
|
||||
using xModels.Base;
|
||||
|
||||
namespace xAiModels.Models
|
||||
{
|
||||
public class XAiMessageUpdateDto : XBaseDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Message Sequence ...
|
||||
/// </summary>
|
||||
public long Sequense { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id of Message ...
|
||||
/// </summary>
|
||||
public Guid Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Message of Chat ...
|
||||
/// </summary>
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Role of Message ...
|
||||
/// </summary>
|
||||
public XAiChatRole Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Updated Time ...
|
||||
/// </summary>
|
||||
public DateTime UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// User Identifier ...
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public string OwnerId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Conversation Id ...
|
||||
/// </summary>
|
||||
public Guid ConversationId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiConversationKeyGenerator : XGuidKeyGenerator<XAiConversation>, IXAiConversationKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiConversationRepositoryEvents : XBaseRepositoryEvents<XAiConversation>, IXAiConversationRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMessageKeyGenerator : XGuidKeyGenerator<XAiMessage>, IXAiMessageKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiMessageRepositoryEvents : XBaseRepositoryEvents<XAiMessage>, IXAiMessageRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiProjectKeyGenerator : XGuidKeyGenerator<XAiProject>, IXAiProjectKeyGenerator
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using xAiModels.Interfaces.Entities;
|
||||
using xAiModels.Models.Entities;
|
||||
using xDataService.Providers;
|
||||
|
||||
namespace xAiModels.Providers.Entities
|
||||
{
|
||||
public class XAiProjectRepositoryEvents : XBaseRepositoryEvents<XAiProject>, IXAiProjectRepositoryEvents
|
||||
{ }
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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
|
||||
)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user