### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Attributes\XAiMcpToolAttribute.cs using System; namespace xAiModels.Attributes { /// /// Decorate and Describe Specified MCP Tool to LLM ... /// [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public class XAiMcpToolAttribute : Attribute { /// /// Tools Unique Name (Default: Method Name) ... /// /// public string Name { get; } /// /// Tools Description for LLM ... /// /// public string Description { get; set; } /// /// Specify it's Required to Authenticated or not ... /// /// public bool RequiresAuthentication { get; set; } = false; /// /// Authorization and Policiy ... /// /// public string RequiredPolicy { get; set; } = string.Empty; public XAiMcpToolAttribute(string name = null) { Name = name; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Attributes\XAiMcpToolParamAttribute.cs using System; namespace xAiModels.Attributes { /// /// Describe Specific Tools Parameter Metadata ... /// [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] public sealed class XAiMcpToolParamAttribute : Attribute { /// /// Parameter Name in JSON (Default Parameter Name) ... /// /// public string Name { get; } /// /// Describe Parameter to LLM ... /// /// public string Description { get; set; } /// /// Specified this Parameter is Required or not (Default is true) ... /// /// public bool Required { get; set; } = true; public XAiMcpToolParamAttribute(string name = null) { Name = name; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Attributes\XAiMcpToolTypeAttribute.cs using System; namespace xAiModels.Attributes { /// /// Decorate Tools Classes ... /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] public class XAiMcpToolTypeAttribute : Attribute { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\XAiModelMappersProfile.cs using AutoMapper; using xAiModels.Models.Dtos; using xAiModels.Models.Entities; namespace xAiModels.Configurations { public class XAiModelMappersProfile : Profile { public XAiModelMappersProfile() { // // XAiMessage ... CreateMap(); // // XAiVector ... CreateMap() .ForMember(x => x.Embedding, opt => opt.Ignore()) .ForMember(x => x.Metadata, opt => opt.Ignore()); CreateMap() .ForMember(x => x.Embedding, opt => opt.Ignore()) .ForMember(x => x.Metadata, opt => opt.Ignore()); // // XAiProject ... CreateMap(); // CreateMap(); CreateMap(); // // XAiConversation ... CreateMap(); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiConversationEntityConfiguration.cs using System; using xAiModels.Constants; using xDataService.Providers; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace xAiModels.Configurations.Entities { public class XAiConversationEntityConfiguration : XBaseEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { builder.ToTable(XAiModelsConstants.XAiConversationTable); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiMcpServerEntityConfiguration .cs using System; using xAiModels.Constants; using xDataService.Providers; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace xAiModels.Configurations.Entities { public class XAiMcpServerEntityConfiguration : XBaseEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { builder.ToTable(XAiModelsConstants.XAiMcpServerTable); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiMessageEntityConfiguration.cs using System; using xAiModels.Constants; using xDataService.Providers; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace xAiModels.Configurations.Entities { public class XAiMessageEntityConfiguration : XBaseEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { builder.ToTable(XAiModelsConstants.XAiMessageTable); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiProjectEntityConfiguration.cs using System; using xAiModels.Constants; using xDataService.Providers; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace xAiModels.Configurations.Entities { public class XAiProjectEntityConfiguration : XBaseEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { builder.ToTable(XAiModelsConstants.XAiProjectTable); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\Entities\XAiVectorEntityConfiguration.cs using System; using xAiModels.Constants; using xDataService.Providers; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace xAiModels.Configurations.Entities { public class XAiVectorEntityConfiguration : XBaseEntityTypeConfiguration { public override void Configure(EntityTypeBuilder builder) { // builder.ToTable(XAiModelsConstants.XAiVectorTable); // builder.Property(x => x.Type).HasMaxLength(100); // // Indexes for Prefix Scoped Search and Type Filtering ... builder.HasIndex(x => x.Identifier); builder.HasIndex(x => x.Type); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\ConfigurationNodeNames.cs namespace xAiModels.Constants { public partial struct ConfigurationNodeNames { public const string AI_API_NODE = "AiApiConfiguration"; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiChatRole.cs using xExceptions.Attributes; namespace xAiModels.Constants { public struct XAiChatRoles { public const string None = "none"; public const string User = "user"; public const string Tool = "tool"; public const string System = "system"; public const string Assistant = "assistant"; } public enum XAiChatRole { [StringValue(XAiChatRoles.None)] None, [StringValue(XAiChatRoles.User)] User, [StringValue(XAiChatRoles.Tool)] Tool, [StringValue(XAiChatRoles.System)] System, [StringValue(XAiChatRoles.Assistant)] Assistant, } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiDataProviderConstants.cs using xExceptions.Attributes; namespace xAiModels.Constants { public struct XAiDataProviderConstants { public const string XDefaultAiProjectSuffix = "DefAiPrj"; public const string XDefaultAiConversationSuffix = "DefAiCnv"; } public enum XAiDataProviderHubActions { // // Project ... [StringValue("ProjectCreated")] ProjectCreated, [StringValue("ProjectUpdated")] ProjectUpdated, [StringValue("ProjectRemoved")] ProjectRemoved, // // Message ... [StringValue("MessageCreated")] MessageCreated, [StringValue("MessageUpdated")] MessageUpdated, [StringValue("MessageRemoved")] MessageRemoved, // // MCPServer ... [StringValue("McpServerCreated")] McpServerCreated, [StringValue("McpServerUpdated")] McpServerUpdated, [StringValue("McpServerRemoved")] McpServerRemoved, // // Conversation ... [StringValue("ConversationCreated")] ConversationCreated, [StringValue("ConversationUpdated")] ConversationUpdated, [StringValue("ConversationRemoved")] ConversationRemoved, } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiKnowledgeScope.cs using xExceptions.Attributes; namespace xAiModels.Constants { /// /// Knowledge Base Scope (Where Ingested Vectors are Visible) ... /// Identifier Layout: "{scopePrefix}/{scopeKey}/{fileName}#{chunkIndex}" (Global has no scopeKey) ... /// public enum XAiKnowledgeScope { /// /// Visible only Inside a Conversation (Key = ConversationId) ... /// [StringValue(XAiModelsConstants.XAiKnowledgeConversationPrefix)] Conversation = 0, /// /// Visible to all Conversations of a Project (Key = ProjectId) ... /// [StringValue(XAiModelsConstants.XAiKnowledgeProjectPrefix)] Project = 1, /// /// Visible to Everyone (Write Requires Admin Role) ... /// [StringValue(XAiModelsConstants.XAiKnowledgeGlobalPrefix)] Global = 2, /// /// Personal Knowledge Base of Owner (Key = UserId) ... /// [StringValue(XAiModelsConstants.XAiKnowledgeUserPrefix)] User = 3, } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiMcpConstants.cs namespace xAiModels.Constants { public struct XAiMcpConstants { // public const string XAiMcpProtocol = "2024-11-05"; public const string XAiMcpClientName = "XAiMcpClient"; public const string XAiMcpSessionIdentifier = "Mcp-Session-Id"; public const string XAiMcpProtocolIdentifier = "MCP-Protocol-Version"; // public const string TextKey = "text"; public const string ContentKey = "content"; public const string ServerInfoNameKey = "name"; public const string ServerInfoKey = "serverInfo"; public const string ServerInfoVersionKey = "version"; public const string ProtocolVersionKey = "protocolVersion"; // public const string serverInfoNameValue = "xAiApi"; public const string serverInfoVersionValue = ""; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiMcpMethods.cs using xExceptions.Attributes; namespace xAiModels.Constants { public enum XAiMcpMethods { [StringValue("initialize")] Initialize, [StringValue("tools/list")] ToolsList, [StringValue("tools/call")] ToolsCall, } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiMcpServerUsageScope.cs using xExceptions.Attributes; namespace xAiModels.Constants { public enum XAiMcpServerUsageScope { [StringValue(XAiModelsConstants.XAiMcpServerUsageScopeAll)] All = 1, [StringValue(XAiModelsConstants.XAiMcpServerUsageScopeOwner)] Owner = 2 } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiModelProviderType.cs namespace xAiModels.Constants { /// /// Specifiy Provider Type ... /// public enum XAiModelProviderType { None, OpenAI, Ollama, DeepSeek, HuggingFace } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Constants\XAiModelsConstants.cs namespace xAiModels.Constants { public struct XAiModelsConstants { // // Service Extensions Log Tag ... public const string XAiModelsDILogTag = "XAiModels"; // // Table Mapping Identifiers ... public const string XAiVectorTable = "AiVectors"; public const string XAiMessageTable = "AiMessages"; public const string XAiProjectTable = "AiProjects"; public const string XAiMcpServerTable = "AiMcpServers"; public const string XAiConversationTable = "AiConversations"; // // GraphQL Collection Mappings ... public const string XAiMessageSingleName = "aiMessage"; public const string XAiProjectSingleName = "aiProject"; public const string XAiMcpServerSingleName = "aiMcpServer"; public const string XAiConversationSignleName = "aiConversation"; public const string XAiMessageCollectionName = "aiMessages"; public const string XAiProjectCollectionName = "AiProjectsa"; public const string XAiMcpServerCollectionName = "aiMcpServers"; public const string XAiConversationCollectionName = "aiConversations"; public const string XAiVectorSingleName = "aiVector"; public const string XAiVectorCollectionName = "aiVectors"; // // Hubs ... public const string XAiMessageDtoHub = "aiMessageDto"; public const string XAiMessageEntityHub = "aiMessageEntity"; public const string XAiProjectDtoHub = "aiProjectDto"; public const string XAiProjectEntityHub = "aiProjectEntity"; public const string XAiMcpServerDtoHub = "aiMcpServerDto"; public const string XAiMcpServerEntityHub = "aiMcpServerEntity"; public const string XAiConversationDtoHub = "aiConversationDto"; public const string XAiConversationEntityHub = "aiConversationEntity"; public const string XAiVectorDtoHub = "aiVectorDto"; public const string XAiVectorEntityHub = "aiVectorEntity"; // // 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 GetXAiVectorEFRepositoryDescriptor = "GetXAiVectorEFRepositoryDescriptor"; public const string GetXAiMessageEFRepositoryDescriptor = "GetXAiMessageEFRepositoryDescriptor"; public const string GetXAiProjectEFRepositoryDescriptor = "GetXAiProjectEFRepositoryDescriptor"; public const string GetXAiMcpServerEFRepositoryDescriptor = "GetXAiMcpServerEFRepositoryDescriptor"; public const string GetXAiConversationEFRepositoryDescriptor = "GetXAiConversationEFRepositoryDescriptor"; // public const string DefaultXAiProjectTitleResourceID = "XAiPrjT"; public const string DefaultXAiConversationTitleResourceID = "XAiCnvT"; public const string DefaultXAiProjectDescriptionResourceID = "XAiPrjD"; // public const string XOpenAINoKey = "no-key-required"; // // Knowledge (Persistent RAG) ... public const string XAiDefaultKnowledgeType = "XAiKnowledge"; public const string XAiKnowledgeSeparator = "/"; public const string XAiKnowledgeOwnerSeparator = "/"; public const string XAiKnowledgeChunkSeparator = "#"; public const string XAiKnowledgeUserPrefix = "user"; public const string XAiKnowledgeGlobalPrefix = "global"; public const string XAiKnowledgeProjectPrefix = "project"; public const string XAiKnowledgeConversationPrefix = "conversation"; // // Error Handler Route (Production) ... public const string XAiErrorRoute = "/error"; // // Knowledge Metadata Keys ... public const string XAiKnowledgeMetadataType = "type"; public const string XAiKnowledgeMetadataScope = "scope"; public const string XAiKnowledgeMetadataScopeId = "scopeId"; public const string XAiKnowledgeMetadataOwnerId = "ownerId"; public const string XAiKnowledgeMetadataIngestedAtUtc = "ingestedAtUtc"; // // Mcp Server ... public const int XAiMcpServerMinTimeoutSeconds = 30; public const string XAiMcpServerUsageScopeAll = "All"; public const string XAiMcpServerUsageScopeOwner = "Owner"; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\DI\XDIHelperExtension.cs using System; using xDataService.Db; using xPushService.DI; using xDataService.DI; using xCommons.Helpers; using xAiModels.Helpers; using xDataService.Models; using xAiModels.Providers; using xAiModels.Constants; using xCommons.Extensions; using xPushService.Helpers; using xAiModels.Interfaces; using xExceptions.Constants; using xDataService.Constants; using xAiModels.Providers.Dtos; using xAiModels.Interfaces.Dtos; using Microsoft.AspNetCore.Builder; using xAiModels.Providers.Entities; using xAiModels.Interfaces.Entities; using xAiModels.Providers.Enrichers; using xAiModels.Interfaces.Enrichers; using Microsoft.Extensions.DependencyInjection; namespace xAiModels.DI { /// /// Service Registration Extensions Classes ... /// public static class XDIHelperExtension { /// /// Register Service ... /// /// /// /// public static void AddXAiDataService( this IServiceCollection services, XRepositoryType repositoryType, ServiceLifetime lifeTime = ServiceLifetime.Scoped ) { AddAiDataService( contextType: null, services: services, lifeTime: lifeTime, repositoryType: repositoryType ); } /// /// Register Service ... /// /// /// /// /// public static void AddXAiDataService( this IServiceCollection services, XRepositoryType repositoryType, ServiceLifetime lifeTime = ServiceLifetime.Scoped ) where TContext : XDbContext { AddAiDataService( services: services, lifeTime: lifeTime, contextType: typeof(TContext), repositoryType: repositoryType ); } /// /// Use XSubCategoryService Middleware ... /// /// /// public static void UseXAiDataService( this IApplicationBuilder app, bool isDevelopmentEnvironment = false ) { // #region Using Hubs ... // var pushHelper = new XPushServiceHelper(); // // XAiVector ... pushHelper.AddHub(XAiModelsConstants.XAiVectorDtoHub); pushHelper.AddHub(XAiModelsConstants.XAiVectorEntityHub); // // XAiMessage ... pushHelper.AddHub(XAiModelsConstants.XAiMessageDtoHub); pushHelper.AddHub(XAiModelsConstants.XAiMessageEntityHub); // // XAiProject ... pushHelper.AddHub(XAiModelsConstants.XAiProjectDtoHub); pushHelper.AddHub(XAiModelsConstants.XAiProjectEntityHub); // // XAiMcpServer ... pushHelper.AddHub(XAiModelsConstants.XAiMcpServerDtoHub); pushHelper.AddHub(XAiModelsConstants.XAiMcpServerEntityHub); // // XAiConversation ... pushHelper.AddHub(XAiModelsConstants.XAiConversationDtoHub); pushHelper.AddHub(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 ); } // // Using XAiMcpServer Repository Descriptor ... if (!aiMcpServerDescriptor.IsNull()) { // app.UseXRepository( descriptor: aiMcpServerDescriptor, isDevelopmentEnvironment: isDevelopmentEnvironment ); } } // #region Private ... private static XRepositoryDescriptor aiVectorDescriptor = null; private static XRepositoryDescriptor aiMessageDescriptor = null; private static XRepositoryDescriptor aiProjectDescriptor = null; private static XRepositoryDescriptor aiMcpServerDescriptor = null; private static XRepositoryDescriptor aiConversationDescriptor = null; /// /// a LogTag for Service ... /// private static string XLogTag = XAiModelsConstants.XAiModelsDILogTag; /// /// print a log in Console ... /// /// private static void Log(string message) { Console.WriteLine($"{XLogTag} => {message}"); } /// /// Register Service ... /// /// /// /// /// 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: // // XAiVector ... aiVectorDescriptor = typeof(XAiModelsHelper) .InvokeGenericMethod( args: null, runtimeType: contextType, methodName: XAiModelsConstants.GetXAiVectorEFRepositoryDescriptor ); // // XAiMessage ... aiMessageDescriptor = typeof(XAiModelsHelper) .InvokeGenericMethod( args: null, runtimeType: contextType, methodName: XAiModelsConstants.GetXAiMessageEFRepositoryDescriptor ); // // XAiProject ... aiProjectDescriptor = typeof(XAiModelsHelper) .InvokeGenericMethod( args: null, runtimeType: contextType, methodName: XAiModelsConstants.GetXAiProjectEFRepositoryDescriptor ); // // XAiMcpServer ... aiMcpServerDescriptor = typeof(XAiModelsHelper) .InvokeGenericMethod( args: null, runtimeType: contextType, methodName: XAiModelsConstants.GetXAiMcpServerEFRepositoryDescriptor ); // // XAiConversation ... aiConversationDescriptor = typeof(XAiModelsHelper) .InvokeGenericMethod( args: null, runtimeType: contextType, methodName: XAiModelsConstants.GetXAiConversationEFRepositoryDescriptor ); break; // case XRepositoryType.Mongo: // // XAiVector ... aiVectorDescriptor = XAiModelsHelper.GetXAiVectorMongoRepositoryDescriptor(); // // XAiMessage ... aiMessageDescriptor = XAiModelsHelper.GetXAiMessageMongoRepositoryDescriptor(); // // XAiProject ... aiProjectDescriptor = XAiModelsHelper.GetXAiProjectMongoRepositoryDescriptor(); // // XAiMcpServer ... aiMcpServerDescriptor = XAiModelsHelper.GetXAiMcpServerMongoRepositoryDescriptor(); // // XAiConversation ... aiConversationDescriptor = XAiModelsHelper.GetXAiConversationMongoRepositoryDescriptor(); break; // case XRepositoryType.InMemory: // // XAiVector ... aiVectorDescriptor = XAiModelsHelper.GetXAiVectorInMemoryRepositoryDescriptor(); // // XAiMessage ... aiMessageDescriptor = XAiModelsHelper.GetXAiMessageInMemoryRepositoryDescriptor(); // // XAiProject ... aiProjectDescriptor = XAiModelsHelper.GetXAiProjectInMemoryRepositoryDescriptor(); // // XAiMcpServer ... aiMcpServerDescriptor = XAiModelsHelper.GetXAiMcpServerInMemoryRepositoryDescriptor(); // // XAiConversation ... aiConversationDescriptor = XAiModelsHelper.GetXAiConversationInMemoryRepositoryDescriptor(); break; } // #region Register Repository Descriptor ... // // XAiVector ... if (!aiVectorDescriptor.IsNull()) { // services.AddXRepository( lifeTime: lifeTime, descriptor: aiVectorDescriptor ); } // // XAiMessage ... if (!aiMessageDescriptor.IsNull()) { // services.AddXRepository( lifeTime: lifeTime, descriptor: aiMessageDescriptor ); } // // XAiProject ... if (!aiProjectDescriptor.IsNull()) { // services.AddXRepository( lifeTime: lifeTime, descriptor: aiProjectDescriptor ); } // // XAiMcpServer ... if (!aiMcpServerDescriptor.IsNull()) { // services.AddXRepository( lifeTime: lifeTime, descriptor: aiMcpServerDescriptor ); } // // XAiConversation ... if (!aiConversationDescriptor.IsNull()) { // services.AddXRepository( lifeTime: lifeTime, descriptor: aiConversationDescriptor ); } #endregion // #region Register Services ... // #region AiVector ... // services.Add( new ServiceDescriptor(typeof(IXAiVectorServiceProvider), typeof(XAiVectorServiceProvider), lifeTime) ); services.Add( new ServiceDescriptor(typeof(IXAiVectorRepositoryService), typeof(XAiVectorRepositoryService), lifeTime) ); services.Add( new ServiceDescriptor(typeof(IXAiVectorRepositoryProvider), typeof(XAiVectorRepositoryProvider), lifeTime) ); // // Enrichers ... services.Add( new ServiceDescriptor(typeof(IXAiVectorEnricher), typeof(XAiVectorEnricher), lifeTime) ); #endregion // #region AiMessage ... // 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) ); // // Enrichers ... services.Add( new ServiceDescriptor(typeof(IXAiMessageEnricher), typeof(XAiMessageEnricher), lifeTime) ); #endregion // #region AiProject ... // 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) ); // // Enrichers ... services.Add( new ServiceDescriptor(typeof(IXAiProjectEnricher), typeof(XAiProjectEnricher), lifeTime) ); #endregion // #region AiMcpServer ... // services.Add( new ServiceDescriptor(typeof(IXAiMcpServerServiceProvider), typeof(XAiMcpServerServiceProvider), lifeTime) ); services.Add( new ServiceDescriptor(typeof(IXAiMcpServerRepositoryService), typeof(XAiMcpServerRepositoryService), lifeTime) ); services.Add( new ServiceDescriptor(typeof(IXAiMcpServerRepositoryProvider), typeof(XAiMcpServerRepositoryProvider), lifeTime) ); // // Enrichers ... services.Add( new ServiceDescriptor(typeof(IXAiMcpServerEnricher), typeof(XAiMcpServerEnricher), lifeTime) ); #endregion // #region AiConversation ... // 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) ); // // Enrichers ... services.Add( new ServiceDescriptor(typeof(IXAiConversationEnricher), typeof(XAiConversationEnricher), lifeTime) ); #endregion #endregion // // Data Provider ... services.Add( new ServiceDescriptor(typeof(IXAiDataProvider), typeof(XAiDataProvider), lifeTime) ); // Log("Service Regitration Succeed ..."); } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\ChatResponseExtensions.cs using xCommons.Extensions; using Microsoft.Extensions.AI; namespace xAiModels.Extensions { public static class ChatResponseExtensions { /// /// Validate a Chat Response ... /// /// /// public static bool IsValid(this ChatResponse source) { // var result = source is not null && !source.IsNullOrDefault() && !string.IsNullOrWhiteSpace(source.Text) && (source.FinishReason == ChatFinishReason.Stop || source.FinishReason == ChatFinishReason.ToolCalls); // return result; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\ChatRoleExtensions.cs using xAiModels.Constants; using xCommons.Extensions; using Microsoft.Extensions.AI; namespace xAiModels.Extensions { /// /// Extensions for ChatRole ... /// public static class ChatRoleExtensions { /// /// Normalize an String to Propper Chat Role Value ... /// > /// /// /// public static string GetChatRoleTitle(this string source) { // var result = XAiChatRoles.None; // if (source.ToNormalString() == XAiChatRoles.None.ToNormalString()) { result = XAiChatRoles.None; } else if (source.ToNormalString() == XAiChatRoles.User.ToNormalString()) { result = XAiChatRoles.User; } else if (source.ToNormalString() == XAiChatRoles.Tool.ToNormalString()) { result = XAiChatRoles.Tool; } else if (source.ToNormalString() == XAiChatRoles.System.ToNormalString()) { result = XAiChatRoles.System; } else if (source.ToNormalString() == XAiChatRoles.Assistant.ToNormalString()) { result = XAiChatRoles.Assistant; } // return result; } /// /// Get Chat Role Title from Chat Role Class ... /// /// /// /// public static string GetRole(this ChatRole source) { // var result = source.Value .GetChatRoleTitle(); // return result; } /// /// Generate Chat Role Class Based on role Title ... /// /// /// public static ChatRole ToChatRole(this string source) { // var role = source.GetChatRoleTitle(); ChatRole result = new ChatRole(role); // return result; } /// /// Generate Chat Role Class Based on role Title ... /// /// /// public static ChatRole ToChatRole(this XAiChatRole source) { // var role = source.GetStringValue(); ChatRole result = new ChatRole(role); // return result; } /// /// Extract Chat Role Enum from Chat Role ... /// /// /// /// /// public static XAiChatRole ToChatRole(this ChatRole source) { // var role = source .GetRole() .GetChatRoleTitle(); // XAiChatRole result = XAiChatRole.User; // if (role == XAiChatRoles.User) { result = XAiChatRole.User; } else if (role == XAiChatRoles.Tool) { result = XAiChatRole.Tool; } else if (role == XAiChatRoles.System) { result = XAiChatRole.System; } else if (role == XAiChatRoles.Assistant) { result = XAiChatRole.Assistant; } // return result; } /// /// Validate an String as Chat Role ... /// /// /// public static bool IsValid(this string source) { // var result = source != XAiChatRoles.None && source.ToNormalString() != XAiChatRoles.None.ToNormalString(); // return result; } /// /// Validate Role ... /// > /// /// /// public static bool IsValid(this XAiChatRole source) { // var result = source != XAiChatRole.None; return result; } /// /// Validate Role ... /// > /// /// /// public static bool IsValid(this ChatRole source) { // var role = source.ToChatRole(); var result = role.IsValid(); return result; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\XAiModelsExtensions.cs using System; using System.Linq; using System.Net.Http; using xAiModels.Models; using xCommons.Constants; using xModels.Extensions; using xCommons.Extensions; using xAiModels.Constants; using xAiModels.Models.Dtos; using xExceptions.Constants; using Microsoft.Extensions.AI; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Extensions { /// /// Extensions Methods for XAiModels ... /// public static class XAiModelsExtensions { /// /// Validate a Project for Add Or Update ... /// /// /// public static bool IsValidForAddOrUpdate(this XAiProject source) { // var result = !source.IsNullOrDefault() && !source.OwnerId.IsNullOrEmpty() && !source.Prompt.IsNullOrEmpty(); // return result; } public static bool IsValidForAddOrUpdate(this XAiProjectDto source) { // var result = !source.IsNullOrDefault() && !source.OwnerId.IsNullOrEmpty() && !source.Prompt.IsNullOrEmpty(); // return result; } /// /// Validate a Conversation for Add Or Update ... /// /// /// public static bool IsValidForAddOrUpdate(this XAiConversation source) { // var result = !source.IsNullOrDefault() && !source.OwnerId.IsNullOrEmpty() && !source.ProjectId.IsNull() && !source.ProjectId.IsDefaultGuid(); // return result; } public static bool IsValidForAddOrUpdate(this XAiConversationDto source) { // var result = !source.IsNullOrDefault() && !source.OwnerId.IsNullOrEmpty() && !source.ProjectId.IsNull() && !source.ProjectId.IsDefaultGuid(); // return result; } /// /// Validate a Message for Add Or Update ... /// /// /// public static bool IsValidForAddOrUpdate(this XAiMessage source) { // var result = !source.IsNullOrDefault() && !source.OwnerId.IsNullOrEmpty() && source.Role.IsValid() && !source.ConversationId.IsNull() && !source.ConversationId.IsDefaultGuid() && !source.Content.IsNullOrEmpty(); // return result; } public static bool IsValidForAddOrUpdate(this XAiMessageDto source) { // var result = !source.IsNullOrDefault() && !source.OwnerId.IsNullOrEmpty() && source.Role.IsValid() && !source.ConversationId.IsNull() && !source.ConversationId.IsDefaultGuid() && !source.Content.IsNullOrEmpty(); // return result; } /// /// Validate a McpServer for Add Or Update ... /// /// /// public static bool IsValidForAddOrUpdate(this XAiMcpServer source) { // var result = !source.IsNullOrDefault() && !source.Name.IsNullOrEmpty() && !source.OwnerId.IsNullOrEmpty() && !source.Endpoint.IsNullOrEmpty(); // return result; } public static bool IsValidForAddOrUpdate(this XAiMcpServerDto source) { // var result = !source.IsNullOrDefault() && !source.Name.IsNullOrEmpty() && !source.OwnerId.IsNullOrEmpty() && !source.Endpoint.IsNullOrEmpty(); // return result; } /// /// Validate a Model Descriptor ... /// /// /// public static bool IsValid(this XAiModelDescriptor source) { // var result = !source.IsNullOrDefault() && !source.Name.IsNullOrEmpty() && !source.Url.IsNullOrEmpty() && source.Url.IsValidUrl() && !source.LLM.IsNullOrEmpty() && source.Provider != Constants.XAiModelProviderType.None; // return result; } /// /// Validate Specified Param ... /// /// /// public static bool IsValid(this XAiPromptParam source) { // var result = !source.IsNullOrDefault() && !source.Name.IsNullOrEmpty() && !source.Param.IsNullOrEmpty(); // return result; } /// /// Validate Specified Prompt ... /// /// /// public static bool IsValid(this XAiPromptDescriptor source) { // var result = !source.IsNullOrDefault() && !source.Name.IsNullOrEmpty() && !source.Template.IsNullOrEmpty(); if (!result) { return result; } // if (source.Params.HasChild()) { result = result && source.Params.All(x => x.IsValid()); } // return result; } /// /// Validate a Request for Retrieve Response in Controllers ... /// /// /// public static bool IsValid(this XAiResponseRequest source) { // var result = !source.IsNullOrDefault() && !source.Prompt.IsNullOrEmpty(); // return result; } /// /// Validate a File Extraction Result ... /// /// /// public static bool IsValid(this XFileExtractionResult source) { // var result = !source.IsNullOrDefault() && ( source.Images.HasChild() || !source.Text.IsNullOrEmpty() || !source.AudioTranscript.IsNullOrEmpty() ); return result; } /// /// Converts a File Extraction Result to AI Contents ... /// /// /// public static IList ToAIContents(this XFileExtractionResult source) { // var result = new List(); // if (source.IsValid()) { // // Main Text ... if (!source.Text.IsNullOrEmpty()) { result.Add(new TextContent(source.Text)); } // // Images ... if (source.Images.HasChild()) { // foreach (var img in source.Images) { result.Add(new DataContent(img.Bytes, img.MimeType)); } } // // Transcripted Audio ... if (!source.AudioTranscript.IsNullOrEmpty()) { result.Add(new TextContent($"[Audio Transcript]\n{source.AudioTranscript}")); } } // return result; } /// /// Check a Collection Contains Default Project for Specified Owner or not ... /// /// /// /// public static bool HasDefaultProject( this IEnumerable source, string ownerId ) { // // Validate Args ... if (!source.HasChild() || ownerId.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // var item = source .FirstOrDefault(x => x.Title .ToNormalString() .Contains(ownerId.ToNormalString()) && x.Title .ToNormalString() .Contains(XAiModelsConstants.DefaultXAiProjectDescriptionResourceID.ToNormalString()) ); // var result = !item.IsNullOrDefault(); // return result; } /// /// Check a Collection Contains Default Conversation for Specified Project or not ... /// /// /// /// /// public static bool HasDefaultConversation( this IEnumerable source, string ownerId, Guid projectId ) { // // Validate Args ... if (!source.HasChild() || projectId.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // var item = source .FirstOrDefault(x => x.Title .ToNormalString() .Contains(ownerId.ToNormalString()) && x.Title .ToNormalString() .Contains(projectId.ToString().ToNormalString()) && x.Title .ToNormalString() .Contains(XAiModelsConstants.DefaultXAiConversationTitleResourceID) ); // var result = !item.IsNullOrDefault(); // return result; } /// /// Retrieve Default Project Id from a Collection ... /// /// /// /// public static Guid GetDafaultProject( this IEnumerable source, string ownerId ) { // // Validate Args ... if (!source.HasChild() || ownerId.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // var item = source .FirstOrDefault(x => x.Title .ToNormalString() .Contains(ownerId.ToNormalString()) && x.Title .ToNormalString() .Contains(XAiModelsConstants.XAiProjectTitleIdentifier.ToNormalString()) ); if (item.IsNullOrDefault()) { XException.NotFound.Throw(); } // return item.Id; } /// /// Get Default Conversation Id from a Collection Contains ... /// /// /// /// /// public static Guid GetDefaultConversation( this IEnumerable source, string ownerId, Guid projectId ) { // // Validate Args ... if (!source.HasChild() || ownerId.IsNullOrEmpty() || projectId.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // var item = source .FirstOrDefault(x => x.Title .ToNormalString() .Contains(ownerId.ToNormalString()) && x.Title .ToNormalString() .Contains(XAiModelsConstants.XAiConversationTitleIdentifier.ToNormalString()) ); if (item.IsNullOrDefault()) { XException.NotFound.Throw(); } // var result = item.Id; // return result; } /// /// Converts a Message Dto to ChatMessage ... /// /// /// /// public static ChatMessage ToChatMessages( this XAiMessageDto source, IList additionalContents = null ) { // ChatMessage result = null; // if (!source.IsNullOrDefault()) { // var contents = new List { // // Add Source Content ... new TextContent(source.Content) }; // // Add Additional Content ... if (additionalContents.HasChild()) { contents.AddRange(additionalContents); } // result = new ChatMessage { Contents = contents, AuthorName = source.Role == XAiChatRole.User && !source.Owner.IsNullOrDefault() ? source.Owner.GetFullname() : string.Empty, Role = source.Role.ToChatRole(), MessageId = source.Id.ToString(), }; } // return result; } /// /// Add Model Provider API Key ... /// /// /// public static void AddModelDescriptorApiKey( this XAiModelDescriptor descriptor, HttpRequestMessage request ) { // // Validate ... if (!descriptor.IsValid() || request.IsNull()) { return; } // var apiKey = descriptor.Provider != XAiModelProviderType.OpenAI ? descriptor.ApiKey : descriptor.ApiKey.IsNullOrEmpty() ? XAiModelsConstants.XOpenAINoKey : descriptor.ApiKey; request.Headers.TryAddWithoutValidation( name: XAuthorization.Header, value: $"{XAuthorization.TokenIdentifier} {apiKey}" ); } /// /// Converts To AITools ... /// /// /// public static IList ToAITools( this IList source ) { // var result = new List(); // foreach (var tool in source) { // var declaration = AIFunctionFactory.CreateDeclaration( name: tool.Name, jsonSchema: tool.InputSchema, description: tool.Description ); // result.Add(declaration); } // return result; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\XEmbeddingExtensions.cs using System; using xCommons.Extensions; namespace xAiModels.Extensions { public static class XEmbeddingExtensions { /// /// Converts String to Embeddings JSON ... /// /// /// public static float[] AsEmbedding(this string source) { // // Validate ... if (source.IsNullOrEmpty()) { return []; } // // JSON is expected to be like: [0.12, 0.34, ...] ... var result = source.FromJSON(); if (!result.HasChild()) { result = []; } // return result; } /// /// Converts ReadOnly Memory to Embedding Representation ... /// /// /// public static string ToEmbedding(this ReadOnlyMemory source) { // var result = string.Empty; // if (!source.IsNull() && !source.IsEmpty) { result = source.ToArray().ToJSON(); } // return result; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Helpers\VectorHelper.cs using System; using xCommons.Extensions; using System.Numerics.Tensors; using xExceptions.Constants; namespace xAiModels.Helpers { public static class VectorHelper { /// /// Normalize a Vector ... /// /// public static void Normalize(float[] vector) { // // Validate ... if (vector.IsNull() || !vector.HasChild()) { return; } // float sum = 0f; foreach (var value in vector) { sum += value * value; } // float norm = MathF.Sqrt(sum); if (norm <= 1e-9f) { return; } // for (int i = 0; i < vector.Length; i++) { vector[i] /= norm; } } /// /// Similarity Check ... /// /// /// /// public static float CosineSimilarity( float[] a, float[] b ) { // // Validate ... if (a.Length != b.Length) { XException.InvalidArgs.Throw(); } // // Check Similarity ... var result = TensorPrimitives .CosineSimilarity( a.AsSpan(), b.AsSpan() ); // return result; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Helpers\XAiMcpHeaderBuilder.cs using xCommons.Constants; using xCommons.Extensions; using xAiModels.Constants; using xIdentityModels.Models; using xCommons.Configurations; using System.Collections.Generic; using xIdentityService.Constants; namespace xAiModels.Helpers { /// /// a Helper Class for Prepare Headers of MCP Client ... /// public static class XAiMcpHeaderBuilder { /// /// Build Headers for MCP Client Connection ... /// /// /// /// /// /// /// public static Dictionary Build( XAppConfiguration appConfiguration, string sessionId = null, string connectionId = null, XUserClaimsInfoDto userInfo = null, string protocolVersion = XAiMcpConstants.XAiMcpProtocol ) { // var headers = new Dictionary { // ["Accept"] = "application/json, text/event-stream", ["Content-Type"] = "application/json", [XAiMcpConstants.XAiMcpProtocolIdentifier] = protocolVersion, [XAuthorization.XPoweredBy] = appConfiguration.XPoweredValue ?? "xAiApi" }; // // Adding Authorization Headers ... if (!userInfo.IsNullOrDefault() && !userInfo.AccessToken.IsNullOrEmpty()) { // headers[XAuthorization.Header] = $"{XAuthorization.TokenIdentifier} {userInfo.AccessToken}"; headers[XAuthorization.ExpiresAt] = userInfo.ExpiresAt.ToString(); // if (!userInfo.RefreshToken.IsNullOrEmpty()) { headers[XAuthorization.RefreshToken] = userInfo.RefreshToken; } } // // شناسه اتصال (برای Push Notification ها) if (!connectionId.IsNullOrEmpty()) { headers[XHeader.ConnectionId.GetStringValue()] = connectionId; } // // Session Id ... if (!sessionId.IsNullOrEmpty()) { headers[XAiMcpConstants.XAiMcpSessionIdentifier] = sessionId; } // return headers; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Helpers\XAiMcpSseReader.cs using System; using System.IO; using System.Text; using System.Threading; using xCommons.Extensions; using xHttpService.Constants; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace xAiModels.Helpers { public static class XAiMcpSseReader { /// /// Read an SSE Event ... /// /// /// /// public static async IAsyncEnumerable ReadAsync( Stream stream, [EnumeratorCancellation] CancellationToken cancellationToken = default ) { // using var reader = new StreamReader(stream, Encoding.UTF8); var dataBuffer = new StringBuilder(); while (!reader.EndOfStream) { // var line = await reader.ReadLineAsync(); if (line is null) { break; } // if (cancellationToken.IsCancellationRequested) { yield break; } // // Empty Line equals End of an Event ... if (line.IsNullOrEmpty()) { // if (dataBuffer.Length > 0) { // yield return dataBuffer.ToString(); dataBuffer.Clear(); } // continue; } // if (line.StartsWith(XSSEConstants.DataIdentifier, StringComparison.OrdinalIgnoreCase)) { // var data = line .Substring(XSSEConstants.DataIdentifier.Length) .TrimStart(); // if (dataBuffer.Length > 0) { dataBuffer.Append('\n'); } // dataBuffer.Append(data); } } // if (dataBuffer.Length > 0) { yield return dataBuffer.ToString(); } } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Helpers\XAiModelsHelper.cs using System; using GraphQL.Types; using xDataService.Db; using xDataService.Models; using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Providers.GraphQL; using xAiModels.Providers.Entities; using xAiModels.Interfaces.Entities; 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 > GetXAiConversationEFRepositoryDescriptor() where TContext : XDbContext { // var result = new XEFRepositoryDescriptor< XAiConversation, Guid, IXAiConversationKeyGenerator, XAiConversationKeyGenerator, IXAiConversationRepositoryEvents, XAiConversationRepositoryEvents, XAiConversationGraphType, GuidGraphType, XAiConversationGraphQuery, IXAiConversationGraphQLTypeHelper, XAiConversationGraphQLTypeHelper, XAiConversationGraphSchema, IXAiConversationRepository, XAiConversationEFRepository, TContext >(); // return result; } public static XEFRepositoryDescriptor< XAiConversation, Guid, IXAiConversationKeyGenerator, XAiConversationKeyGenerator, IXAiConversationRepositoryEvents, XAiConversationRepositoryEvents, XAiConversationGraphType, GuidGraphType, XAiConversationGraphQuery, IXAiConversationGraphQLTypeHelper, XAiConversationGraphQLTypeHelper, XAiConversationGraphSchema, IXAiConversationRepository, XAiConversationEFRepository, TContext, IXAiConversationSeeder, TSeederImplementation > GetXAiConversationEFRepositoryDescriptor() where TContext : XDbContext where TSeederImplementation : XBaseDbSeeder { // var result = new XEFRepositoryDescriptor< XAiConversation, Guid, IXAiConversationKeyGenerator, XAiConversationKeyGenerator, IXAiConversationRepositoryEvents, XAiConversationRepositoryEvents, XAiConversationGraphType, GuidGraphType, XAiConversationGraphQuery, IXAiConversationGraphQLTypeHelper, XAiConversationGraphQLTypeHelper, XAiConversationGraphSchema, IXAiConversationRepository, XAiConversationEFRepository, 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() where TSeederImplementation : XBaseDbSeeder { // 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() where TSeederImplementation : XBaseDbSeeder { // 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 > GetXAiMessageEFRepositoryDescriptor() where TContext : XDbContext { // var result = new XEFRepositoryDescriptor< XAiMessage, Guid, IXAiMessageKeyGenerator, XAiMessageKeyGenerator, IXAiMessageRepositoryEvents, XAiMessageRepositoryEvents, XAiMessageGraphType, GuidGraphType, XAiMessageGraphQuery, IXAiMessageGraphQLTypeHelper, XAiMessageGraphQLTypeHelper, XAiMessageGraphSchema, IXAiMessageRepository, XAiMessageEFRepository, TContext >(); // return result; } public static XEFRepositoryDescriptor< XAiMessage, Guid, IXAiMessageKeyGenerator, XAiMessageKeyGenerator, IXAiMessageRepositoryEvents, XAiMessageRepositoryEvents, XAiMessageGraphType, GuidGraphType, XAiMessageGraphQuery, IXAiMessageGraphQLTypeHelper, XAiMessageGraphQLTypeHelper, XAiMessageGraphSchema, IXAiMessageRepository, XAiMessageEFRepository, TContext, IXAiMessageSeeder, TSeederImplementation > GetXAiMessageEFRepositoryDescriptor() where TContext : XDbContext where TSeederImplementation : XBaseDbSeeder { // var result = new XEFRepositoryDescriptor< XAiMessage, Guid, IXAiMessageKeyGenerator, XAiMessageKeyGenerator, IXAiMessageRepositoryEvents, XAiMessageRepositoryEvents, XAiMessageGraphType, GuidGraphType, XAiMessageGraphQuery, IXAiMessageGraphQLTypeHelper, XAiMessageGraphQLTypeHelper, XAiMessageGraphSchema, IXAiMessageRepository, XAiMessageEFRepository, 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() where TSeederImplementation : XBaseDbSeeder { // 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() where TSeederImplementation : XBaseDbSeeder { // 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 > GetXAiProjectEFRepositoryDescriptor() where TContext : XDbContext { // var result = new XEFRepositoryDescriptor< XAiProject, Guid, IXAiProjectKeyGenerator, XAiProjectKeyGenerator, IXAiProjectRepositoryEvents, XAiProjectRepositoryEvents, XAiProjectGraphType, GuidGraphType, XAiProjectGraphQuery, IXAiProjectGraphQLTypeHelper, XAiProjectGraphQLTypeHelper, XAiProjectGraphSchema, IXAiProjectRepository, XAiProjectEFRepository, TContext >(); // return result; } public static XEFRepositoryDescriptor< XAiProject, Guid, IXAiProjectKeyGenerator, XAiProjectKeyGenerator, IXAiProjectRepositoryEvents, XAiProjectRepositoryEvents, XAiProjectGraphType, GuidGraphType, XAiProjectGraphQuery, IXAiProjectGraphQLTypeHelper, XAiProjectGraphQLTypeHelper, XAiProjectGraphSchema, IXAiProjectRepository, XAiProjectEFRepository, TContext, IXAiProjectSeeder, TSeederImplementation > GetXAiProjectEFRepositoryDescriptor() where TContext : XDbContext where TSeederImplementation : XBaseDbSeeder { // var result = new XEFRepositoryDescriptor< XAiProject, Guid, IXAiProjectKeyGenerator, XAiProjectKeyGenerator, IXAiProjectRepositoryEvents, XAiProjectRepositoryEvents, XAiProjectGraphType, GuidGraphType, XAiProjectGraphQuery, IXAiProjectGraphQLTypeHelper, XAiProjectGraphQLTypeHelper, XAiProjectGraphSchema, IXAiProjectRepository, XAiProjectEFRepository, 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() where TSeederImplementation : XBaseDbSeeder { // 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() where TSeederImplementation : XBaseDbSeeder { // var result = new XInMemoryRepositoryDescriptor< XAiProject, Guid, IXAiProjectKeyGenerator, XAiProjectKeyGenerator, IXAiProjectRepositoryEvents, XAiProjectRepositoryEvents, XAiProjectGraphType, GuidGraphType, XAiProjectGraphQuery, IXAiProjectGraphQLTypeHelper, XAiProjectGraphQLTypeHelper, XAiProjectGraphSchema, IXAiProjectRepository, XAiProjectInMemoryRepository, IXAiProjectSeeder, TSeederImplementation >(); // return result; } #endregion #endregion // #region XAiVector ... // #region EF Repository Descriptor Provider(s) ... public static XEFRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorEFRepository, TContext > GetXAiVectorEFRepositoryDescriptor() where TContext : XDbContext { // var result = new XEFRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorEFRepository, TContext >(); // return result; } public static XEFRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorEFRepository, TContext, IXAiVectorSeeder, TSeederImplementation > GetXAiVectorEFRepositoryDescriptor() where TContext : XDbContext where TSeederImplementation : XBaseDbSeeder { // var result = new XEFRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorEFRepository, TContext, IXAiVectorSeeder, TSeederImplementation >(); // return result; } #endregion // #region Mongo Repository Descriptor Provider(s) ... public static XMongoRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorMongoRepository > GetXAiVectorMongoRepositoryDescriptor() { // var result = new XMongoRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorMongoRepository >(); // return result; } public static XMongoRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorMongoRepository, IXAiVectorSeeder, TSeederImplementation > GetXAiVectorMongoRepositoryDescriptor() where TSeederImplementation : XBaseDbSeeder { // var result = new XMongoRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorMongoRepository, IXAiVectorSeeder, TSeederImplementation >(); // return result; } #endregion // #region InMemory Repository Descriptor Provider(s) ... public static XInMemoryRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorInMemoryRepository > GetXAiVectorInMemoryRepositoryDescriptor() { // var result = new XInMemoryRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorInMemoryRepository >(); // return result; } public static XInMemoryRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorInMemoryRepository, IXAiVectorSeeder, TSeederImplementation > GetXAiVectorInMemoryRepositoryDescriptor() where TSeederImplementation : XBaseDbSeeder { // var result = new XInMemoryRepositoryDescriptor< XAiVector, Guid, IXAiVectorKeyGenerator, XAiVectorKeyGenerator, IXAiVectorRepositoryEvents, XAiVectorRepositoryEvents, XAiVectorGraphType, GuidGraphType, XAiVectorGraphQuery, IXAiVectorGraphQLTypeHelper, XAiVectorGraphQLTypeHelper, XAiVectorGraphSchema, IXAiVectorRepository, XAiVectorInMemoryRepository, IXAiVectorSeeder, TSeederImplementation >(); // return result; } #endregion #endregion // #region XAiMcpServer ... // #region EF Repository Descriptor Provider(s) ... public static XEFRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerEFRepository, TContext > GetXAiMcpServerEFRepositoryDescriptor() where TContext : XDbContext { // var result = new XEFRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerEFRepository, TContext >(); // return result; } public static XEFRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerEFRepository, TContext, IXAiMcpServerSeeder, TSeederImplementation > GetXAiMcpServerEFRepositoryDescriptor() where TContext : XDbContext where TSeederImplementation : XBaseDbSeeder { // var result = new XEFRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerEFRepository, TContext, IXAiMcpServerSeeder, TSeederImplementation >(); // return result; } #endregion // #region Mongo Repository Descriptor Provider(s) ... public static XMongoRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerMongoRepository > GetXAiMcpServerMongoRepositoryDescriptor() { // var result = new XMongoRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerMongoRepository >(); // return result; } public static XMongoRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerMongoRepository, IXAiMcpServerSeeder, TSeederImplementation > GetXAiMcpServerMongoRepositoryDescriptor() where TSeederImplementation : XBaseDbSeeder { // var result = new XMongoRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerMongoRepository, IXAiMcpServerSeeder, TSeederImplementation >(); // return result; } #endregion // #region InMemory Repository Descriptor Provider(s) ... public static XInMemoryRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerInMemoryRepository > GetXAiMcpServerInMemoryRepositoryDescriptor() { // var result = new XInMemoryRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerInMemoryRepository >(); // return result; } public static XInMemoryRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerInMemoryRepository, IXAiMcpServerSeeder, TSeederImplementation > GetXAiMcpServerInMemoryRepositoryDescriptor() where TSeederImplementation : XBaseDbSeeder { // var result = new XInMemoryRepositoryDescriptor< XAiMcpServer, Guid, IXAiMcpServerKeyGenerator, XAiMcpServerKeyGenerator, IXAiMcpServerRepositoryEvents, XAiMcpServerRepositoryEvents, XAiMcpServerGraphType, GuidGraphType, XAiMcpServerGraphQuery, IXAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphQLTypeHelper, XAiMcpServerGraphSchema, IXAiMcpServerRepository, XAiMcpServerInMemoryRepository, IXAiMcpServerSeeder, TSeederImplementation >(); // return result; } #endregion #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiConversationTitleResourceProvider.cs using xStringService.Interfaces; namespace xAiModels.Interfaces { public interface IXAiConversationTitleResourceProvider : IXOwnedItemResourceProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiDataProvider.cs using System; using xModels.Dtos; using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using System.Collections.Generic; namespace xAiModels.Interfaces { /// /// All Data Manipulation Requirements ... /// public interface IXAiDataProvider { // #region Getters ... /// /// Retrieve Specified Project ... /// /// /// /// /// /// Task GetProject( Guid id, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Retrieve Specified Conversation ... /// /// /// /// /// Task GetConversation( Guid id, bool fillMessages = false, CancellationToken cancellationToken = default ); #endregion // #region Loaders ... /// /// Load Projects List of Specified Owner ... /// /// /// /// /// /// /// Task> LoadProjects( string ownerId, string connectionId = null, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Load List of Conversations for Specified Project ... /// /// /// /// /// /// Task> LoadConversations( Guid projectId, bool fillMessages = false, string connectionId = null, CancellationToken cancellationToken = default ); /// /// Load Messages of Specified Conversation ... /// /// /// /// Task> LoadMessages( Guid conversationId, CancellationToken cancellationToken = default ); #endregion // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// /// Task Enrich( XAiProjectDto source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// /// Task Enrich( XAiConversationDto source, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiMessageDto source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); #endregion // #region Defaults ... /// /// Retrieve Default Project of Specified Owner ... /// Create it if not Handled ... /// /// /// /// /// Task GetDefaultProject( string ownerId, string connectionId = null, CancellationToken cancellationToken = default ); /// /// Retrieve Default Conversation of Specified Owner ... /// Create it if not Handled ... /// /// /// /// /// /// Task GetDefaultConversation( string ownerId, Guid? projectId, string connectionId = null, CancellationToken cancellationToken = default ); #endregion // #region Creator/Adders ... /// /// Create Project ... /// /// /// /// /// /// Task CreateProject( string ownerId, XAiProjectDto item = null, string connectionId = null, CancellationToken cancellationToken = default ); /// /// Create Conversation ... /// /// /// /// /// /// /// Task CreateConversation( string ownerId, Guid projectId, XAiConversationDto item = null, string connectionId = null, CancellationToken cancellationToken = default ); /// /// Add Message ... /// /// /// /// /// /// Task AddMessage( Guid conversationId, XAiMessageDto item, string connectionId = null, CancellationToken cancellationToken = default ); #endregion // #region Query ... /// /// Query Projects ... /// /// /// /// /// Task> QueryProjects( string ownerId, XQuery query, CancellationToken cancellationToken = default ); /// /// Query Conversations ... /// /// /// /// /// /// Task> QueryConversations( string ownerId, Guid projectId, XQuery query, CancellationToken cancellationToken = default ); /// /// Query Messages ... /// /// /// /// /// /// Task> QueryMessages( string ownerId, Guid conversationId, XQuery query, CancellationToken cancellationToken = default ); #endregion // #region Vectors ... /// /// Insert or Update a Single Vector (Matched by Identifier) ... /// /// /// /// /// /// /// /// Task UpsertVectorAsync( string identifier, string text, ReadOnlyMemory embedding, Dictionary metadata = null, string type = null, CancellationToken cancellationToken = default ); /// /// Insert or Update a Batch of Vectors (Matched by Identifier) ... /// /// /// /// Count of Stored Vectors Task UpsertVectorsAsync( IEnumerable items, CancellationToken cancellationToken = default ); /// /// Search Vectors by Cosine Similarity (Top K) ... /// /// /// /// /// Optional: Restrict Search to Vectors whose Identifier Starts with this Prefix /// Optional: Restrict Search to Vectors of Specified Type /// /// Task> SearchVectorsAsync( ReadOnlyMemory queryEmbedding, int topK = 5, float minScore = 0f, string identifierPrefix = null, string type = null, CancellationToken cancellationToken = default ); /// /// Load Vectors whose Identifier Starts with Specified Prefix ... /// /// /// /// Optional: Restrict to Vectors of Specified Type /// /// Task> LoadVectorsAsync( string identifierPrefix, bool includeEmbedding = false, string type = null, CancellationToken cancellationToken = default ); /// /// Remove Vectors whose Identifier Starts with Specified Prefix ... /// /// /// Optional: Restrict to Vectors of Specified Type /// /// Count of Removed Vectors Task RemoveVectorsAsync( string identifierPrefix, string type = null, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiProjectDescriptionResourceProvider.cs using xStringService.Interfaces; namespace xAiModels.Interfaces { public interface IXAiProjectDescriptionResourceProvider : IXOwnedItemResourceProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\IXAiProjectTitleResourceProvider.cs using xStringService.Interfaces; namespace xAiModels.Interfaces { public interface IXAiProjectTitleResourceProvider : IXOwnedItemResourceProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiConversationDtoHub.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiConversationDtoHub : IXBaseDtoHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiConversationRepositoryService.cs using System; using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xDataService.Interfaces; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Dtos { public interface IXAiConversationRepositoryService : IXBaseRepositoryService { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// Task Enrich( XAiConversation source, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// /// Task Enrich( XAiConversationDto source, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiConversationServiceProvider.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Providers.Dtos; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiConversationServiceProvider : IXBaseDtoProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMcpServerDtoHub.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiMcpServerDtoHub : IXBaseDtoHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMcpServerRepositoryService.cs using System; using xAiModels.Models.Dtos; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiMcpServerRepositoryService : IXBaseRepositoryService { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMcpServerServiceProvider.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Providers.Dtos; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiMcpServerServiceProvider : IXBaseDtoProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMessageDtoHub.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiMessageDtoHub : IXBaseDtoHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMessageRepositoryService.cs using System; using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xDataService.Interfaces; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Dtos { public interface IXAiMessageRepositoryService : IXBaseRepositoryService { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiMessage source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiMessageDto source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiMessageServiceProvider.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Providers.Dtos; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiMessageServiceProvider : IXBaseDtoProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiProjectDtoHub.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiProjectDtoHub : IXBaseDtoHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiProjectRepositoryService.cs using System; using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xDataService.Interfaces; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Dtos { public interface IXAiProjectRepositoryService : IXBaseRepositoryService { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// /// Task Enrich( XAiProject source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// /// /// Task Enrich( XAiProjectDto source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiProjectServiceProvider.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Providers.Dtos; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiProjectServiceProvider : IXBaseDtoProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiVectorDtoHub.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiVectorDtoHub : IXBaseDtoHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiVectorRepositoryService.cs using System; using xAiModels.Models.Dtos; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiVectorRepositoryService : IXBaseRepositoryService { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Dtos\IXAiVectorServiceProvider.cs using System; using xAiModels.Models.Dtos; using xPushService.Interfaces; using xAiModels.Providers.Dtos; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Dtos { public interface IXAiVectorServiceProvider : IXBaseDtoProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Enrichers\IXAiConversationEnricher.cs using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Enrichers { /// /// Ai Conversation Enricher ... /// public interface IXAiConversationEnricher { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// Task Enrich( XAiConversation source, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// /// Task Enrich( XAiConversationDto source, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Enrichers\IXAiMcpServerEnricher.cs using System.Threading; using System.Threading.Tasks; using xAiModels.Models.Dtos; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Enrichers { public interface IXAiMcpServerEnricher { Task Enrich( XAiMcpServer source, CancellationToken cancellationToken = default ); Task Enrich( XAiMcpServerDto source, CancellationToken cancellationToken = default ); Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Enrichers\IXAiMessageEnricher.cs using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Enrichers { public interface IXAiMessageEnricher { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiMessage source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiMessageDto source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Enrichers\IXAiProjectEnricher.cs using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Enrichers { public interface IXAiProjectEnricher { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// /// Task Enrich( XAiProject source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// /// /// Task Enrich( XAiProjectDto source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// /// /// Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Enrichers\IXAiVectorEnricher.cs using System.Threading; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; namespace xAiModels.Interfaces.Enrichers { public interface IXAiVectorEnricher { // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiVector source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Item ... /// /// /// /// Task Enrich( XAiVectorDto source, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); /// /// Enrich Specified Items ... /// /// /// /// Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ); #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationEntityHub.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationEntityHub : IXBaseEntityHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationGraphQLTypeHelper.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationGraphQLTypeHelper : IXBaseGraphQLTypeHelper { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationKeyGenerator.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationKeyGenerator : IXKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationRepository.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationRepository : IXBaseRepository { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationRepositoryEvents.cs using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationRepositoryEvents : IXBaseRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationRepositoryProvider.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; using xAiModels.Providers.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationRepositoryProvider : IXBaseEntityProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiConversationSeeder.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiConversationSeeder : IXBaseDbSeeder { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiDocumentEntityHub.cs using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace xAiModels.Interfaces.Entities { public interface IXAiDocumentEntityHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerEntityHub.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerEntityHub : IXBaseEntityHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerGraphQLTypeHelper.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerGraphQLTypeHelper : IXBaseGraphQLTypeHelper { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerKeyGenerator.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerKeyGenerator : IXKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerRepository.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerRepository : IXBaseRepository { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerRepositoryEvents.cs using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerRepositoryEvents : IXBaseRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerRepositoryProvider.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; using xAiModels.Providers.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerRepositoryProvider : IXBaseEntityProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMcpServerSeeder.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMcpServerSeeder : IXBaseDbSeeder { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageEntityHub.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageEntityHub : IXBaseEntityHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageGraphQLTypeHelper.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageGraphQLTypeHelper : IXBaseGraphQLTypeHelper { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageKeyGenerator.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageKeyGenerator : IXKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageRepository.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageRepository : IXBaseRepository { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageRepositoryEvents.cs using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageRepositoryEvents : IXBaseRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageRepositoryProvider.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; using xAiModels.Providers.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageRepositoryProvider : IXBaseEntityProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiMessageSeeder.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiMessageSeeder : IXBaseDbSeeder { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectEntityHub.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectEntityHub : IXBaseEntityHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectGraphQLTypeHelper.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectGraphQLTypeHelper : IXBaseGraphQLTypeHelper { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectKeyGenerator.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectKeyGenerator : IXKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectRepository.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectRepository : IXBaseRepository { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectRepositoryEvents.cs using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectRepositoryEvents : IXBaseRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectRepositoryProvider.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; using xAiModels.Providers.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectRepositoryProvider : IXBaseEntityProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiProjectSeeder.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiProjectSeeder : IXBaseDbSeeder { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorEntityHub.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorEntityHub : IXBaseEntityHub { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorGraphQLTypeHelper.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorGraphQLTypeHelper : IXBaseGraphQLTypeHelper { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorKeyGenerator.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorKeyGenerator : IXKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorRepository.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorRepository : IXBaseRepository { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorRepositoryEvents.cs using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorRepositoryEvents : IXBaseRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorRepositoryProvider.cs using System; using xPushService.Interfaces; using xAiModels.Models.Entities; using xAiModels.Providers.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorRepositoryProvider : IXBaseEntityProvider { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Interfaces\Entities\IXAiVectorSeeder.cs using System; using xDataService.Interfaces; using xAiModels.Models.Entities; namespace xAiModels.Interfaces.Entities { public interface IXAiVectorSeeder : IXBaseDbSeeder { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiMcpJsonRpcError.cs using System.Text.Json; using System.Text.Json.Serialization; namespace xAiModels.Models { public class XAiMcpJsonRpcError { [JsonPropertyName("code")] public int Code { get; set; } [JsonPropertyName("message")] public string Message { get; set; } [JsonPropertyName("data")] public JsonElement? Data { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiMcpJsonRpcRequest.cs using System; using System.Text.Json.Serialization; namespace xAiModels.Models { public class XAiMcpJsonRpcRequest { [JsonPropertyName("jsonrpc")] public string JsonRpc { get; set; } = "2.0"; [JsonPropertyName("id")] public string Id { get; set; } = Guid.NewGuid().ToString("N"); [JsonPropertyName("method")] public string Method { get; set; } [JsonPropertyName("params")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public object Params { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiMcpJsonRpcResponse.cs using System.Text.Json; using System.Text.Json.Serialization; namespace xAiModels.Models { public class XAiMcpJsonRpcResponse { [JsonPropertyName("jsonrpc")] public string JsonRpc { get; set; } [JsonPropertyName("id")] public string Id { get; set; } [JsonPropertyName("result")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public JsonElement? Result { get; set; } [JsonPropertyName("error")] [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] public XAiMcpJsonRpcError Error { get; set; } [JsonIgnore] public bool IsSuccess => Error is null; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiMcpToolDefinition.cs using System.Text.Json; using System.Text.Json.Serialization; namespace xAiModels.Models { public class XAiMcpToolDefinition { [JsonPropertyName("name")] public string Name { get; set; } [JsonPropertyName("description")] public string Description { get; set; } [JsonPropertyName("inputSchema")] public JsonElement InputSchema { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiMcpToolDescriptor.cs using System; using System.Threading; using Newtonsoft.Json.Linq; using System.Threading.Tasks; namespace xAiModels.Models { public class XAiMcpToolDescriptor { public string Name { get; set; } public string Description { get; set; } public JObject InputSchema { get; set; } public string RequiredPolicy { get; set; } public bool RequiresAuthentication { get; set; } = false; public Func> Execute { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiModelDescriptor.cs using xAiModels.Constants; namespace xAiModels.Models { /// /// Describe a Provided Model ... /// public class XAiModelDescriptor { /// /// Provider Name ... /// public string Name { get; set; } /// /// LLM Provider Url ... /// public string Url { get; set; } /// /// Model Name ... /// public string LLM { get; set; } /// /// Api Key for Connection ... /// public string ApiKey { get; set; } /// /// Specified Model Provider Type ... /// public XAiModelProviderType Provider { get; set; } = XAiModelProviderType.Ollama; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiPromptDescriptor.cs namespace xAiModels.Models { /// /// Describe Specified Prompt ... /// public class XAiPromptDescriptor { /// /// Prompt Name ... /// public string Name { get; set; } /// /// Prompt Template ... /// public string Template { get; set; } /// /// Prompt Description ... /// public string Description { get; set; } /// /// Prompt Template Params ... /// public XAiPromptParam[] Params { get; set; } = []; } /// /// Specified a Prompt Param ... /// public class XAiPromptParam { /// /// Param Name ... /// public string Name { get; set; } /// /// Param Identifier ... /// public string Param { get; set; } /// /// Parma Description ... /// public string Description { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiResonseMessage.cs using System; using xModels.Base; using xAiModels.Constants; namespace xAiModels.Models { public class XAiResonseMessage : XBaseDto { public long Sequence { get; set; } public Guid RespondTo { get; set; } public string OwnerId { get; set; } public string Content { get; set; } public XAiChatRole Role { get; set; } public DateTime RespondedOn { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiResponseRequest.cs using System; using xAiModels.Constants; namespace xAiModels.Models { /// /// /Request for a Response in Controllers ... /// public class XAiResponseRequest { /// /// Prompt Text ... /// public string Prompt { get; set; } /// /// Knowledge Type ... /// public string Type { get; set; } = XAiModelsConstants.XAiDefaultKnowledgeType; /// /// Provided TopK in Vector Searchs ... /// public int? TopK { get; set; } /// /// Min Score for Vector Searchs ... /// public float? MinScore { get; set; } /// /// Specified Project Id ... /// public Guid? ProjectId { get; set; } /// /// Specified Conversation Id ... /// public Guid? ConversationId { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XFileExtractionResult.cs using System.Collections.Generic; namespace xAiModels.Models { /// /// Holds File Extraction Result ... /// public class XFileExtractionResult { /// /// Extracted String Content ... /// public string Text { get; set; } = string.Empty; /// /// Extracted Images for Vision Model ... /// public IList Images { get; set; } = []; /// /// Extracted Content from Audio File ... /// public string AudioTranscript { get; set; } = string.Empty; /// /// Main File Name ... /// public string FileName { get; set; } /// /// Main File MIME Type ... /// public string MimeType { get; set; } /// /// Specified Fallback done using Images or not ... /// public bool UsedImageFallback { get; set; } = false; /// /// Error Message ... /// public string ErrorMessage { get; set; } } /// /// Extracted Image ... /// public class XExtractedImage { /// /// Content as Byte ... /// public byte[] Bytes { get; set; } /// /// MIME Type of Image ... /// public string MimeType { get; set; } = "image/png"; /// /// for PDF Files ... /// public int? PageNumber { get; set; } /// /// Describe Image ... /// public string Description { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiConversationDto.cs using System; using xModels.Base; using xModels.Dtos; using System.Collections.Generic; namespace xAiModels.Models.Dtos { /// /// Conversation Describe ... /// public class XAiConversationDto : XBaseGuidIDEntityDto { /// /// User Identifier ... /// /// public string OwnerId { get; set; } /// /// Owner Info ... /// public virtual XPersonDto Owner { get; set; } = null; /// /// Conversation Title Resource ID ... /// public string Title { get; set; } /// /// All Exists Title Locale Resources ... /// public virtual XResourceDto TitleResource { get; set; } /// /// Created Time ... /// public DateTime CreatedOn { get; set; } /// /// Updated Time ... /// public DateTime UpdatedAt { get; set; } /// /// Conversation Messages ... /// public virtual IEnumerable Messages { get; set; } = []; /// /// Project ID ... /// public Guid ProjectId { get; set; } /// /// Project Title Resource ID ... /// public virtual string ProjectTitle { get; set; } = null; /// /// Project Description Resource ID ... /// public virtual string ProjectDescription { get; set; } = null; /// /// Project Title Locale Resources ... /// public virtual XResourceDto ProjectTitleResource { get; set; } /// /// Project Description Locale Resources ... /// public virtual XResourceDto ProjectDescriptionResource { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiMcpServerDto.cs using System; using xModels.Base; using xModels.Dtos; using xAiModels.Constants; namespace xAiModels.Models.Dtos { public class XAiMcpServerDto : XBaseGuidIDEntityDto { /// /// Owner ... /// public string OwnerId { get; set; } public virtual XPersonDto Owner { get; set; } /// /// Specified Which Scope can Use MCP Server ... /// public XAiMcpServerUsageScope Scope { get; set; } = XAiMcpServerUsageScope.Owner; /// /// MCP Server Name ... /// public string Name { get; set; } /// /// Description ... /// public string Description { get; set; } /// /// Enabled or Disabled ... /// public bool Enabled { get; set; } = true; /// /// Environment Variables as JSON Object ... /// public string EnvironmentVariables { get; set; } /// /// Endpoint to Connect ... /// public string Endpoint { get; set; } /// /// Headers List as Json Object ... /// public string Headers { get; set; } /// /// Timout Secconds ... /// public int TimeoutSeconds { get; set; } = 30; public DateTime CreatedOn { get; set; } public DateTime UpdatedAt { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiMessageDto.cs using System; using xModels.Base; using xModels.Dtos; using xAiModels.Constants; using xCommons.Extensions; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; namespace xAiModels.Models.Dtos { public class XAiMessageDto : XBaseGuidIDEntityDto { /// /// User Identifier ... /// /// public string OwnerId { get; set; } /// /// Owner Info ... /// public virtual XPersonDto Owner { get; set; } = null; /// /// Message of Chat ... /// public string Content { get; set; } /// /// Role of Message ... /// public XAiChatRole Role { get; set; } /// /// Created Time ... /// public DateTime CreatedOn { get; set; } /// /// Updated Time ... /// public DateTime UpdatedAt { get; set; } /// /// Conversation Id ... /// public Guid ConversationId { get; set; } /// /// Conversation Info ... /// public virtual string ConversationTitle { get; set; } = null; public virtual XResourceDto ConversationTitleResouce { get; set; } = null; // #region Meta Data Property ... private string _metadata; /// /// Meta Data of Message ... /// [NotMapped] public IDictionary Metadata { get; private set; } = null; /// /// Meta Data of MEssage in Json ... /// public string MetaDatas { // get => _metadata; // set { // // Converts Json String to Dictionary ... if (!value.IsNullOrEmpty()) { Metadata = value.FromJSON>(); } // _metadata = value; } } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiProjectDto.cs using System; using xModels.Base; using xModels.Dtos; using System.Collections.Generic; namespace xAiModels.Models.Dtos { /// /// Describe a Project ... /// public class XAiProjectDto : XBaseGuidIDEntityDto { /// /// User Identifier ... /// /// public string OwnerId { get; set; } /// /// Owner Info ... /// public virtual XPersonDto Owner { get; set; } = null; /// /// Title of Project ... /// public string Title { get; set; } /// /// All Exists Title Locale Resources ... /// public virtual XResourceDto TitleResource { get; set; } /// /// Description of Project ... /// public string Description { get; set; } /// /// All Exists Description Locale Resources ... /// public virtual XResourceDto DescriptionResource { get; set; } /// /// a Prompt for Project Start ... /// public string Prompt { get; set; } /// /// Created Time ... /// public DateTime CreatedOn { get; set; } /// /// Updated Time ... /// public DateTime UpdatedAt { get; set; } /// /// Conversations ... /// public virtual IList Conversations { get; set; } = []; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiVectorDto.cs using System; using xModels.Base; using System.Collections.Generic; namespace xAiModels.Models.Dtos { /// /// Vector DTO for AI Vector data ... /// public class XAiVectorDto : XBaseGuidIDEntityDto { /// /// Text content of the vector ... /// public string Text { get; set; } /// /// Doc and Chunk Identifier ... /// public string Identifier { get; set; } /// /// Knowledge Base Type / Domain (Optional Filter on Search) ... /// public string Type { get; set; } /// /// Embedding vector representation ... /// public virtual ReadOnlyMemory Embedding { get; set; } = null; /// /// Metadata associated with the vector ... /// public virtual Dictionary Metadata { get; set; } = null; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Dtos\XAiVectorSearchResult.cs using System; using System.Collections.Generic; namespace xAiModels.Models.Dtos { public class XAiVectorSearchResult { public Guid Id { get; set; } public string Text { get; set; } public float Score { get; set; } public string Type { get; set; } public string Identifier { get; set; } public Dictionary Metadata { get; set; } = null; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiConversation.cs using System; using xModels.Base; using System.ComponentModel.DataAnnotations; namespace xAiModels.Models.Entities { /// /// Conversation Describe ... /// public class XAiConversation : XBaseGuidIDEntity { /// /// User Identifier ... /// /// [Required] [StringLength(255)] public string OwnerId { get; set; } /// /// Title of Conversation ... /// [Required] [StringLength(255)] public string Title { get; set; } /// /// Created Time ... /// public DateTime CreatedOn { get; set; } /// /// Updated Time ... /// public DateTime UpdatedAt { get; set; } /// /// Project ID ... /// [Required] public Guid ProjectId { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiMcpServer.cs using System; using xModels.Base; using xAiModels.Constants; using System.ComponentModel.DataAnnotations; namespace xAiModels.Models.Entities { /// /// An MCP Server Descriptor for Adding Tools to XAI ... /// public class XAiMcpServer : XBaseGuidIDEntity { /// /// Owner ... /// [Required] [StringLength(255)] public string OwnerId { get; set; } /// /// Specified Which Scope can Use MCP Server ... /// public XAiMcpServerUsageScope Scope { get; set; } = XAiMcpServerUsageScope.Owner; /// /// MCP Server Name ... /// [Required] [StringLength(255)] public string Name { get; set; } /// /// Description ... /// [StringLength(1000)] public string Description { get; set; } /// /// Enabled or Disabled ... /// public bool Enabled { get; set; } = true; /// /// Environment Variables as JSON Object ... /// public string EnvironmentVariables { get; set; } /// /// Endpoint to Connect ... /// [StringLength(1000)] public string Endpoint { get; set; } /// /// Headers List as Json Object ... /// public string Headers { get; set; } /// /// Timout Secconds ... /// public int TimeoutSeconds { get; set; } = 30; public DateTime CreatedOn { get; set; } public DateTime UpdatedAt { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiMessage.cs using System; using xModels.Base; using xAiModels.Constants; using xCommons.Extensions; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace xAiModels.Models.Entities { /// /// Message Model of Ai ... /// public class XAiMessage : XBaseGuidIDEntity { /// /// User Identifier ... /// /// [Required] [StringLength(255)] public string OwnerId { get; set; } /// /// Message of Chat ... /// [Required] public string Content { get; set; } /// /// Role of Message ... /// public XAiChatRole Role { get; set; } /// /// Created Time ... /// public DateTime CreatedOn { get; set; } /// /// Updated Time ... /// public DateTime UpdatedAt { get; set; } /// /// Conversation Id ... /// [StringLength(255)] public Guid ConversationId { get; set; } // #region Meta Data Property ... private string _metadata; /// /// Meta Data of Message ... /// [NotMapped] public IDictionary Metadata { get; private set; } = null; /// /// Meta Data of MEssage in Json ... /// public string MetaDatas { // get => _metadata; // set { // // Converts Json String to Dictionary ... if (!value.IsNullOrEmpty()) { Metadata = value.FromJSON>(); } // _metadata = value; } } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiProject.cs using System; using xModels.Base; using System.ComponentModel.DataAnnotations; namespace xAiModels.Models.Entities { /// /// Describe a Project ... /// public class XAiProject : XBaseGuidIDEntity { /// /// User Identifier ... /// /// [Required] [StringLength(255)] public string OwnerId { get; set; } /// /// Title of Project ... /// [Required] [StringLength(255)] public string Title { get; set; } /// /// Description of Project ... /// [StringLength(1000)] public string Description { get; set; } /// /// a Prompt for Project Start ... /// public string Prompt { get; set; } /// /// Created Time ... /// public DateTime CreatedOn { get; set; } /// /// Updated Time ... /// public DateTime UpdatedAt { get; set; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\Entities\XAiVector.cs using xModels.Base; using System.ComponentModel.DataAnnotations; namespace xAiModels.Models.Entities { public class XAiVector : XBaseGuidIDEntity { /// /// Thge Content Which Embedded ... /// public string Text { get; set; } /// /// Doc and Chunk Identifier ... /// public string Identifier { get; set; } /// /// Knowledge Base Type / Domain (e.g. "Legal", "Medical") ... /// Used for Filtering on Search and Retrieve ... /// [StringLength(100)] public string Type { get; set; } /// /// a Json String which Represents IReadOnlyList of float ... /// public string Embedding { get; set; } /// /// a Json String Which Represents MetaData ... /// public string Metadata { get; set; } = string.Empty; } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiConversationEntityRegisterar.cs using System; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using xAiModels.Configurations.Entities; namespace xAiModels.Providers { public class XAiConversationEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar { public XAiConversationEntityRegisterar() : base(nameof(XAiConversationEntityRegisterar)) { // // Add Entity ... AddEntity(); } /// /// Configure Entities ... /// /// public override void ConfigureEntities(ModelBuilder modelBuilder) { // // Configure Entity Using Provided ... modelBuilder .ApplyConfigurationsFromAssembly(typeof(XAiConversationEntityConfiguration).Assembly); // base.ConfigureEntities(modelBuilder); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiConversationTitleResourceProvider.cs using xAiModels.Constants; using xAiModels.Interfaces; using xCommons.Configurations; using xStringService.Providers; using xStringService.Interfaces.Dtos; namespace xAiModels.Providers { public class XAiConversationTitleResourceProvider : XBaseOwnedItemResourceProvider, IXAiConversationTitleResourceProvider { public XAiConversationTitleResourceProvider( XAppConfiguration appConfig, IXStringServiceProvider stringProvider ) : base( appConfig: appConfig, stringProvider: stringProvider, item: XAiModelsConstants.XAiConversationTitleIdentifier ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiDataProvider.cs using System; using System.Linq; using xModels.Dtos; using System.Threading; using xAiModels.Helpers; using xAiModels.Constants; using xCommons.Extensions; using xAiModels.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using xExceptions.Constants; using System.Threading.Tasks; using xCommons.Configurations; using System.Linq.Expressions; using xDataService.Extensions; using xAiModels.Providers.Hubs; using xAiModels.Interfaces.Dtos; using xStringService.Interfaces; using xAiModels.Models.Entities; using System.Collections.Generic; using Microsoft.AspNetCore.SignalR; using xAiModels.Interfaces.Entities; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers { /// /// All Data Manipulation Requirements ... /// public class XAiDataProvider : IXAiDataProvider { // #region Properties ... private readonly IXStringProvider stringProvider; private readonly IXAiVectorEnricher vectorEnricher; private readonly XAppConfiguration appConfiguration; private readonly IHubContext hub; private readonly IXAiMessageEnricher messageEnricher; private readonly IXAiProjectEnricher projectEnricher; private readonly IXAiVectorRepository vectorRepository; private readonly IXAiMcpServerEnricher mcpServerEnricher; private readonly IXAiMcpServerRepository mcpServerRepository; private readonly IXAiConversationEnricher conversationEnricher; private readonly IXAiVectorRepositoryService vectorRepositoryService; private readonly IXAiMessageRepositoryService messageRepositoryService; private readonly IXAiProjectRepositoryService projectRepositoryService; private readonly IXAiMcpServerRepositoryService mcpServerRepositoryService; private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; private readonly IXAiConversationRepositoryService conversationRepositoryService; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; #endregion public XAiDataProvider( IXStringProvider stringProvider, IXAiVectorEnricher vectorEnricher, XAppConfiguration appConfiguration, IHubContext hub, IXAiProjectEnricher projectEnricher, IXAiMessageEnricher messageEnricher, IXAiVectorRepository vectorRepository, IXAiMcpServerEnricher mcpServerEnricher, IXAiMcpServerRepository mcpServerRepository, IXAiConversationEnricher conversationEnricher, IXAiVectorRepositoryService vectorRepositoryService, IXAiMessageRepositoryService messageRepositoryService, IXAiProjectRepositoryService projectRepositoryService, IXAiMcpServerRepositoryService mcpServerRepositoryService, IXAiProjectTitleResourceProvider projectTitleResourceProvider, IXAiConversationRepositoryService conversationRepositoryService, IXAiConversationTitleResourceProvider conversationTitleResourceProvider, IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) { this.hub = hub; this.stringProvider = stringProvider; this.vectorEnricher = vectorEnricher; this.projectEnricher = projectEnricher; this.messageEnricher = messageEnricher; this.appConfiguration = appConfiguration; this.vectorRepository = vectorRepository; this.mcpServerEnricher = mcpServerEnricher; this.mcpServerRepository = mcpServerRepository; this.conversationEnricher = conversationEnricher; this.vectorRepositoryService = vectorRepositoryService; this.messageRepositoryService = messageRepositoryService; this.projectRepositoryService = projectRepositoryService; this.mcpServerRepositoryService = mcpServerRepositoryService; this.projectTitleResourceProvider = projectTitleResourceProvider; this.conversationRepositoryService = conversationRepositoryService; this.conversationTitleResourceProvider = conversationTitleResourceProvider; this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } // #region Loaders ... /// /// Load Projects List of Specified Owner ... /// /// /// /// /// /// /// public async Task> LoadProjects( string ownerId, string connectionId = null, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // // Validate Args ... if (ownerId.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // // Handle Default Project and Conversation ... // // Default Project ... bool hasDefault = await HasDefaultProject( ownerId: ownerId, cancellationToken: cancellationToken ); if (!hasDefault) { // await CreateDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); } var defaultProject = await GetDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); // // Default Project's Default Conversation ... hasDefault = await HasDefaultConversation( ownerId: ownerId, projectId: defaultProject.Id, cancellationToken: cancellationToken ); if (!hasDefault) { // await CreateDefaultConversation( ownerId: ownerId, connectionId: connectionId, projectId: defaultProject.Id, cancellationToken: cancellationToken ); } // // Retrieve Project List ... var result = await projectRepositoryService.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, predicate: x => x.OwnerId == ownerId, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); // if (result.HasChild()) { // result = await projectEnricher.EnrichRange( sources: result, cancellationToken: cancellationToken, fillConversations: fillConversations, fillConversationMessages: fillConversationMessages ); } // return result; } /// /// Load List of Conversations for Specified Project ... /// /// /// /// /// /// public async Task> LoadConversations( Guid projectId, bool fillMessages = false, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... if (projectId.IsNull() || projectId.IsDefaultGuid() ) { XException.InvalidArgs.Throw(); } // // Retrieve Project ... var project = await projectRepositoryService.GetAsync( id: projectId, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); if (project.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Default Conversation ... var hasDefault = await HasDefaultConversation( projectId: projectId, ownerId: project.OwnerId, connectionId: connectionId, cancellationToken: cancellationToken ); if (!hasDefault) { // await CreateDefaultConversation( projectId: projectId, ownerId: project.OwnerId, connectionId: connectionId, cancellationToken: cancellationToken ); } // // Retrieve Conversation's List ... var result = await conversationRepositoryService.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: x => x.ProjectId == projectId, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); // if (result.HasChild()) { // result = await conversationEnricher.EnrichRange( sources: result, fillMessages: fillMessages, cancellationToken: cancellationToken ); } // return result; } /// /// Load Messages of Specified Conversation ... /// /// /// /// public async Task> LoadMessages( Guid conversationId, CancellationToken cancellationToken = default ) { // // Validate Args ... if (conversationId.IsNull() || conversationId.IsDefaultGuid() ) { XException.InvalidArgs.Throw(); } // var conversation = await conversationRepositoryService.GetAsync( id: conversationId, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); if (conversation.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Retrieve Message Lists of Specified Conversation ... var result = await messageRepositoryService.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn), predicate: x => x.ConversationId == conversationId ); // if (result.HasChild()) { // result = await messageEnricher.EnrichRange( sources: result, cancellationToken: cancellationToken ); } // return result; } #endregion // #region Getters ... /// /// Retrieve Specified Project ... /// /// /// /// /// /// public async Task GetProject( Guid id, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // // Validate Args ... if (id.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // var result = await projectRepositoryService.GetAsync( id: id, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); if (result.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Handle Enrichment ... result = await projectEnricher.Enrich( source: result, fillConversations: fillConversations, cancellationToken: cancellationToken, fillConversationMessages: fillConversationMessages ); // return result; } /// /// Retrieve Specified Conversation ... /// /// /// /// /// public async Task GetConversation( Guid id, bool fillMessages = false, CancellationToken cancellationToken = default ) { // // Validate Args ... if (id.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // var result = await conversationRepositoryService.GetAsync( id: id, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); if (result.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Handle Enrichment ... result = await conversationEnricher.Enrich( source: result, fillMessages: fillMessages, cancellationToken: cancellationToken ); // return result; } #endregion // #region Creator/Adders ... /// /// Create Project ... /// /// /// /// /// /// public async Task CreateProject( string ownerId, XAiProjectDto item = null, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... if (ownerId.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // // Check Project Provided or not ... var hasProject = !item.IsNullOrDefault(); // // Normalize Provided Project ... if (hasProject) { // item.OwnerId = ownerId; item.CreatedOn = DateTime.UtcNow; // // Validate Item ... if (!item.IsValidForAddOrUpdate()) { XException.InvalidData.Throw(); } } // XAiProjectDto result = null; var defaultLanguage = appConfiguration.DefaultLanguage; // // Create Provided Project ... if (hasProject) { // // Add Item for ID Gneneration ... result = await projectRepositoryService.AddAsync( item: item, saveChanges: true, cancellationToken: cancellationToken ); // // Checking Resources ... // // Titles ... var titleResource = string.Empty; if (!item.TitleResource.IsNullOrDefault() && item.TitleResource.Locales.HasChild()) { // // Adding Title Resource Locales ... var isDefaultLanguageHandled = false; foreach (var trl in item.TitleResource.Locales) { // // Attaching Default Language ... if (!isDefaultLanguageHandled && trl.Language.IsNullOrEmpty()) { // trl.Language = defaultLanguage; isDefaultLanguageHandled = true; } // // Check Value Exists ... if (trl.Value.IsNullOrEmpty()) { continue; } // var resource = await projectTitleResourceProvider.AddOrUpdateLocale( locale: trl, owner: ownerId, identifier: result.Id, connectionId: connectionId, cancellationToken: cancellationToken ); if (!resource.IsNullOrDefault() && titleResource.IsNullOrEmpty()) { titleResource = resource.Resource; } } } // // Descriptions ... var descriptionResource = string.Empty; if (!item.DescriptionResource.IsNullOrDefault() && item.DescriptionResource.Locales.HasChild()) { // // Adding Description Resource Locales .... var isDefaultLanguageHandled = false; foreach (var trl in item.DescriptionResource.Locales) { // // Attaching Default Language ... if (!isDefaultLanguageHandled && trl.Language.IsNullOrEmpty()) { // trl.Language = defaultLanguage; isDefaultLanguageHandled = true; } // // Check Value Exists ... if (trl.Value.IsNullOrEmpty()) { continue; } // var resource = await projectDescriptionResourceProvider.AddOrUpdateLocale( locale: trl, owner: ownerId, identifier: result.Id, connectionId: connectionId, cancellationToken: cancellationToken ); if (!resource.IsNullOrDefault() && descriptionResource.IsNullOrEmpty()) { descriptionResource = resource.Resource; } } } // // Update Data ... result.Title = titleResource; result.Description = descriptionResource; result = await projectRepositoryService.UpdateAsync( item: result, id: result.Id, saveChanges: true, cancellationToken: cancellationToken ); if (!result.IsNullOrDefault()) { // result = await projectEnricher.Enrich( source: result, fillConversations: false, fillConversationMessages: false, cancellationToken: cancellationToken ); } // // Handling Send Push Notification ... if (!result.IsNullOrDefault() && !connectionId.IsNullOrEmpty() ) { // await SendPush( connectionId: connectionId, cancellationToken: cancellationToken, payLoad: item.ToJSON(camelCase: true), action: XAiDataProviderHubActions.ProjectCreated.GetStringValue() ); } } // // Check Default Project ... else { // // Check Default Project Exists or not ... var hasDefault = await HasDefaultProject( ownerId: ownerId, cancellationToken: cancellationToken ); // // If Default Project Exists, Throw Exception ... if (hasDefault) { XException.InvalidArgs.Throw(); } // // Create and Retrive Default Project ... result = await GetDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); } // // Validate ... if (result.IsNullOrDefault()) { XException.ActionFailed.Throw(); } // // Handle Enrichment ... result = await Enrich( source: result, fillConversations: false, fillConversationMessages: false, cancellationToken: cancellationToken ); // return result; } /// /// Create an AI Conversation ... /// /// /// /// /// /// /// public async Task CreateConversation( string ownerId, Guid projectId, XAiConversationDto item = null, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... if (projectId.IsNull() || projectId.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // // Handle Proejct ... XAiProjectDto project = await projectRepositoryService.GetAsync( id: projectId, includeBuilder: null, ignoreSoftDeleteds: true, // fillConversations: false, // fillConversationMessages: false, cancellationToken: cancellationToken ); if (project.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Check Conversation Provided or not ... var hasConversation = !item.IsNullOrDefault(); // // Normalize Conversation if Provided ... if (hasConversation) { // item.OwnerId = ownerId; item.ProjectId = project.Id; item.CreatedOn = DateTime.UtcNow; // // Validate Item ... if (!item.IsValidForAddOrUpdate()) { XException.InvalidData.Throw(); } } // XAiConversationDto result = null; var defaultLanguage = appConfiguration.DefaultLanguage; // // Create Provided Conversation ... if (hasConversation) { // // Add Item for ID Gneneration ... result = await conversationRepositoryService.AddAsync( item: item, saveChanges: true, // fillMessages: false, cancellationToken: cancellationToken ); // // Checking Resources ... // // Titles ... var titleResource = string.Empty; if (!item.TitleResource.IsNullOrDefault() && item.TitleResource.Locales.HasChild()) { // // Adding Title Resource Locales ... var isDefaultLanguageHandled = false; foreach (var trl in item.TitleResource.Locales) { // // Attaching Default Language ... if (!isDefaultLanguageHandled && trl.Language.IsNullOrEmpty()) { // trl.Language = defaultLanguage; isDefaultLanguageHandled = true; } // // Check Value Exists ... if (trl.Value.IsNullOrEmpty()) { continue; } // var resource = await conversationTitleResourceProvider.AddOrUpdateLocale( locale: trl, owner: ownerId, identifier: result.Id, connectionId: connectionId, cancellationToken: cancellationToken ); if (!resource.IsNullOrDefault() && titleResource.IsNullOrEmpty()) { titleResource = resource.Resource; } } } // // Update Data ... result.Title = titleResource; result = await conversationRepositoryService.UpdateAsync( item: result, id: result.Id, saveChanges: true, cancellationToken: cancellationToken ); if (!result.IsNullOrDefault()) { // result = await conversationEnricher.Enrich( source: result, fillMessages: false, cancellationToken: cancellationToken ); } // // Handling Send Push Notification ... if (!result.IsNullOrDefault() && !connectionId.IsNullOrEmpty() ) { // await SendPush( connectionId: connectionId, cancellationToken: cancellationToken, payLoad: item.ToJSON(camelCase: true), action: XAiDataProviderHubActions.ConversationCreated.GetStringValue() ); } } // // Check Default Conversation ... else { // // Check Default Conversation Exists or not ... var hasDefault = await HasDefaultConversation( projectId: project.Id, ownerId: project.OwnerId, cancellationToken: cancellationToken ); // // If Default Project Exists, Throw Exception ... if (hasDefault) { XException.InvalidArgs.Throw(); } // // Create and Retrive Default Conversation ... result = await GetDefaultConversation( projectId: project.Id, ownerId: project.OwnerId, connectionId: connectionId, cancellationToken: cancellationToken ); } // // Validate ... if (result.IsNullOrDefault()) { XException.ActionFailed.Throw(); } // // Handle Enrichment ... result = await Enrich( source: result, fillMessages: false, cancellationToken: cancellationToken ); // return result; } /// /// Add Message ... /// /// /// /// /// /// public async Task AddMessage( Guid conversationId, XAiMessageDto item, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... if (item.IsNullOrDefault() || conversationId.IsNull() || conversationId.IsDefaultGuid() ) { XException.InvalidArgs.Throw(); } // // Normalize ... item.CreatedOn = DateTime.UtcNow; item.ConversationId = conversationId; // // Validate Item ... if (!item.IsValidForAddOrUpdate()) { XException.InvalidData.Throw(); } // var result = await messageRepositoryService.AddAsync( item: item, saveChanges: true, cancellationToken: cancellationToken ); // // Handle Enrichment ... if (!result.IsNullOrDefault()) { // result = await Enrich( source: result, cancellationToken: cancellationToken ); } // // Handling Send Push Notification ... if (!result.IsNullOrDefault() && !connectionId.IsNullOrEmpty() ) { // await SendPush( connectionId: connectionId, cancellationToken: cancellationToken, payLoad: item.ToJSON(camelCase: true), action: XAiDataProviderHubActions.MessageCreated.GetStringValue() ); } // return result; } #endregion // #region Updaters ... #endregion // #region Defaults ... /// /// Retrieve Default Project of Specified Owner ... /// Create it if not Handled ... /// /// /// /// /// public async Task GetDefaultProject( string ownerId, string connectionId = null, CancellationToken cancellationToken = default ) { // // Check Default Project Exists or noit ... var isExists = await HasDefaultProject( ownerId: ownerId, cancellationToken: cancellationToken ); if (!isExists) { // await CreateDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); } // var resource = await stringProvider.FindOne( cancellationToken: cancellationToken, predicate: x => x.ResourceTitle .ToNormalString() .Contains(ownerId.ToNormalString()) && x.ResourceTitle .ToNormalString() .Contains(XAiModelsConstants.XAiProjectTitleIdentifier.ToNormalString()) && x.TranslatedValue .ToNormalString() .Contains(XAiDataProviderConstants.XDefaultAiProjectSuffix.ToNormalString()) ); if (resource.IsNullOrDefault()) { XException.NotFound.Throw(); } // var result = await projectRepositoryService.FindOneAsync( cancellationToken: cancellationToken, predicate: x => x.Title .Equals( resource.ResourceTitle, StringComparison.InvariantCultureIgnoreCase ) ); if (result.IsNullOrDefault()) { XException.NotFound.Throw(); } // return result; } /// /// Retrieve Default Conversation of Specified Owner ... /// Create it if not Handled ... /// /// /// /// /// /// public async Task GetDefaultConversation( string ownerId, Guid? projectId, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... if (ownerId.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // // Prepare Project ... XAiProjectDto project = null; if (!projectId.HasValue || projectId.Value.IsDefaultGuid() ) { // project = await GetDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); } else { // project = await projectRepositoryService.GetAsync( id: projectId.Value, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); } if (project.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Check Default Conversation Exists or noit ... var isExists = await HasDefaultConversation( ownerId: ownerId, projectId: project.Id, connectionId: connectionId, cancellationToken: cancellationToken ); if (!isExists) { // await CreateDefaultConversation( ownerId: ownerId, projectId: project.Id, connectionId: connectionId, cancellationToken: cancellationToken ); } // // Check Default Owner Exists or not ... var resource = await stringProvider.FindOne( cancellationToken: cancellationToken, predicate: x => x.ResourceTitle .ToNormalString() .Contains(ownerId.ToString().ToNormalString()) && x.ResourceTitle .ToNormalString() .Contains(XAiModelsConstants.XAiConversationTitleIdentifier.ToNormalString()) && x.TranslatedValue .ToNormalString() .Contains(XAiDataProviderConstants.XDefaultAiConversationSuffix.ToNormalString()) ); if (resource.IsNullOrDefault()) { XException.NotFound.Throw(); } // var result = await conversationRepositoryService.FindOneAsync( cancellationToken: cancellationToken, predicate: x => x.ProjectId == project.Id && x.Title == resource.ResourceTitle ); // return result; } #endregion // #region Query ... /// /// Query Projects ... /// /// /// /// /// public async Task> QueryProjects( string ownerId, XQuery query, CancellationToken cancellationToken = default ) { // Expression> predicate = null; if (!ownerId.IsNullOrEmpty()) { predicate = x => x.OwnerId == ownerId; } // var result = await projectRepositoryService.QueryAsync( query: query, predicate: predicate, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); if (!result.IsNullOrDefault() && result.Items.HasChild()) { // result.Items = [..await EnrichRange( sources: result.Items, fillConversations: false, fillConversationMessages: false, cancellationToken: cancellationToken )]; } // return result; } /// /// Query Messages ... /// /// /// /// /// /// public async Task> QueryMessages( string ownerId, Guid conversationId, XQuery query, CancellationToken cancellationToken = default ) { // // Validate ... if (conversationId.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // // Retrieve Conversation ... var conversation = await conversationRepositoryService.GetAsync( id: conversationId, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); if (conversation.IsNullOrDefault()) { XException.NotFound.Throw(); } // Expression> predicate = x => x.ConversationId == conversationId; if (!ownerId.IsNullOrEmpty()) { // predicate = x => x.OwnerId == ownerId && x.ConversationId == conversationId; } // var result = await messageRepositoryService.QueryAsync( query: query, predicate: predicate, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); if (!result.IsNullOrDefault() && result.Items.HasChild()) { // result.Items = [..await EnrichRange( sources: result.Items, cancellationToken: cancellationToken )]; } // return result; } /// /// Query McpServers ... /// /// /// /// /// public async Task> QueryMcpServers( XQuery query, Expression> predicate = null, CancellationToken cancellationToken = default ) { // var result = await mcpServerRepositoryService.QueryAsync( query: query, predicate: predicate, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); if (!result.IsNullOrDefault() && result.Items.HasChild()) { // result.Items = [..await EnrichRange( sources: result.Items, cancellationToken: cancellationToken )]; } // return result; } /// /// Query Conversations ... /// /// /// /// /// /// public async Task> QueryConversations( string ownerId, Guid projectId, XQuery query, CancellationToken cancellationToken = default ) { // // Validate ... if (projectId.IsDefaultGuid()) { XException.InvalidArgs.Throw(); } // // Retrieve Project ... var project = await projectRepositoryService.GetAsync( id: projectId, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); if (project.IsNullOrDefault()) { XException.NotFound.Throw(); } // Expression> predicate = x => x.ProjectId == projectId; if (!ownerId.IsNullOrEmpty()) { // predicate = x => x.OwnerId == ownerId && x.ProjectId == projectId; } // var result = await conversationRepositoryService.QueryAsync( query: query, predicate: predicate, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); if (!result.IsNullOrDefault() && result.Items.HasChild()) { // result.Items = [..await EnrichRange( fillMessages: false, sources: result.Items, cancellationToken: cancellationToken )]; } // return result; } #endregion // #region Vectors ... /// /// Insert or Update a Single Vector (Matched by Identifier) ... /// /// /// /// /// /// /// /// public async Task UpsertVectorAsync( string identifier, string text, ReadOnlyMemory embedding, Dictionary metadata = null, string type = null, CancellationToken cancellationToken = default ) { // // Validate ... if ( embedding.IsEmpty || text.IsNullOrEmpty() || identifier.IsNullOrEmpty() ) { XException.InvalidArgs.Throw(); } // var exists = await vectorRepository.FindOneAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: x => x.Identifier == identifier ); var isExists = !exists.IsNullOrDefault(); if (isExists) { // exists.Text = text; exists.Embedding = embedding.ToJSON(); exists.Type = type.IsNullOrEmpty() ? exists.Type : type; exists.Metadata = metadata.IsNullOrDefault() ? exists.Metadata : metadata.ToJSON(); } else { // exists = new XAiVector { Text = text, Type = type, Identifier = identifier, Metadata = metadata.ToJSON(), Embedding = embedding.ToJSON(), }; } // await vectorRepository.AddOrUpdateAsync( item: exists, saveChanges: true, cancellationToken: cancellationToken ); } /// /// Search Vectors by Cosine Similarity (Top K) ... /// /// /// /// /// /// /// /// public async Task> SearchVectorsAsync( ReadOnlyMemory queryEmbedding, int topK = 5, float minScore = 0f, string identifierPrefix = null, string type = null, CancellationToken cancellationToken = default ) { // // Validate ... if ( topK <= 0 || queryEmbedding.IsEmpty ) { XException.InvalidArgs.Throw(); } // // Normalize ... if (type.IsNullOrEmpty()) { type = XAiModelsConstants.XAiDefaultKnowledgeType; } // // Converts Question Vector to Vector Array ... var queryVector = queryEmbedding.ToArray(); var scoredResult = new List<(XAiVectorSearchResult Result, float Score)>(); // // Load Candidates (Restricted by Prefix / Type when Provided) ... var predicateExp = BuildVectorPredicateExpression(identifierPrefix, type); IAsyncEnumerable candidates; if (predicateExp.IsNull()) { // candidates = vectorRepository .GetAllAsAsyncEnumerable( ignoreSoftDeleteds: true, orderBuilder: null, includeBuilder: null ); } else { // candidates = (await vectorRepository .FindManyAsync( predicate: predicateExp, ignoreSoftDeleteds: true, orderBuilder: null, includeBuilder: null, cancellationToken: cancellationToken )) .ToAsyncEnumerable(); } // await foreach (var vector in candidates.WithCancellation(cancellationToken)) { // // Validate Vector ... if (vector.Embedding.IsNullOrEmpty()) { continue; } // // Ignore Unsame Vectors ... var embd = vector.Embedding.AsEmbedding(); if ( embd.IsNull() || embd.Length != queryEmbedding.Length ) { continue; } // // Calculate Cosine Similarity Score ... var score = VectorHelper.CosineSimilarity(queryVector, embd); if (score < minScore) { continue; } // scoredResult.Add((new XAiVectorSearchResult { // Score = score, Id = vector.Id, Text = vector.Text, Type = vector.Type, Identifier = vector.Identifier, Metadata = vector.Metadata.AsMetadat(), }, score)); } // var result = scoredResult .OrderByDescending(x => x.Score) .Take(topK) .Select(x => x.Result) .ToList(); // return result; } /// /// Insert or Update a Batch of Vectors (Matched by Identifier) ... /// /// /// /// Count of Stored Vectors public async Task UpsertVectorsAsync( IEnumerable items, CancellationToken cancellationToken = default ) { // // Validate & Normalize (Last One Wins on Duplicate Identifiers) ... var validItems = (items ?? []) .Where(x => !x.IsNullOrDefault() && !x.Embedding.IsEmpty && !x.Text.IsNullOrEmpty() && !x.Identifier.IsNullOrEmpty() ) .GroupBy(x => x.Identifier) .Select(g => g.Last()) .ToList(); if (!validItems.HasChild()) { return 0; } // // Load Existing Vectors with Same Identifiers ... var identifiers = validItems .Select(x => x.Identifier) .ToList(); var existings = await vectorRepository.FindManyAsync( ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: x => identifiers.Contains(x.Identifier) ); var existingMap = (existings ?? []) .GroupBy(x => x.Identifier) .ToDictionary(g => g.Key, g => g.First()); // // Split to Insert / Update ... var toAdd = new List(); var toUpdate = new List(); foreach (var item in validItems) { // if (existingMap.TryGetValue(item.Identifier, out var exists)) { // exists.Text = item.Text; exists.Embedding = item.Embedding.ToEmbedding(); exists.Type = item.Type.IsNullOrEmpty() ? exists.Type : item.Type; exists.Metadata = item.Metadata.IsNullOrDefault() ? exists.Metadata : item.Metadata.ToJSON(); toUpdate.Add(exists); } else { // toAdd.Add(new XAiVector { Text = item.Text, Type = item.Type, Identifier = item.Identifier, Metadata = item.Metadata.ToJSON(), Embedding = item.Embedding.ToEmbedding(), Id = item.Id.IsDefaultGuid() ? Guid.NewGuid() : item.Id, }); } } // if (toUpdate.HasChild()) { await vectorRepository.UpdateRangeAsync( items: toUpdate, saveChanges: false, cancellationToken: cancellationToken ); } if (toAdd.HasChild()) { await vectorRepository.AddRangeAsync( items: toAdd, saveChanges: false, cancellationToken: cancellationToken ); } // await vectorRepository.SaveChangesAsync(cancellationToken); // var result = toAdd.Count + toUpdate.Count; return result; } /// /// Load Vectors whose Identifier Starts with Specified Prefix ... /// /// /// /// /// /// public async Task> LoadVectorsAsync( string identifierPrefix, bool includeEmbedding = false, string type = null, CancellationToken cancellationToken = default ) { // // Validate ... if (identifierPrefix.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // var vectors = await vectorRepository.FindManyAsync( ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: BuildVectorPredicateExpression(identifierPrefix, type) ); // var result = (vectors ?? []) .Select(v => new XAiVectorDto { Id = v.Id, Text = v.Text, Type = v.Type, Identifier = v.Identifier, Metadata = v.Metadata.AsMetadat(), Embedding = includeEmbedding ? v.Embedding.AsEmbedding() : null, }) .ToList(); // return result; } /// /// Remove Vectors whose Identifier Starts with Specified Prefix ... /// /// /// /// /// Count of Removed Vectors public async Task RemoveVectorsAsync( string identifierPrefix, string type = null, CancellationToken cancellationToken = default ) { // // Validate ... if (identifierPrefix.IsNullOrEmpty()) { XException.InvalidArgs.Throw(); } // var vectors = await vectorRepository.FindManyAsync( ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: BuildVectorPredicateExpression(identifierPrefix, type) ); var toRemove = (vectors ?? []).ToList(); if (!toRemove.HasChild()) { return 0; } // // Hard Delete (Vectors are Disposable Data) ... await vectorRepository.RemoveRangeAsync( items: toRemove, softDelete: false, saveChanges: true, cancellationToken: cancellationToken ); // var result = toRemove.Count; return result; } #endregion // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// public async Task Enrich( XAiVectorDto source, CancellationToken cancellationToken = default ) { // var result = await vectorEnricher.Enrich( source: source, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// public async Task Enrich( XAiVector source, CancellationToken cancellationToken = default ) { // var result = await vectorEnricher.Enrich( source: source, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// public async Task Enrich( XAiMessageDto source, CancellationToken cancellationToken = default ) { // var result = await messageEnricher.Enrich( source: source, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// /// /// public async Task Enrich( XAiProjectDto source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // var result = await projectEnricher.Enrich( source: source, fillConversations: fillConversations, cancellationToken: cancellationToken, fillConversationMessages: fillConversationMessages ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// public async Task Enrich( XAiMcpServerDto source, CancellationToken cancellationToken = default ) { // var result = await mcpServerEnricher.Enrich( source: source, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// /// public async Task Enrich( XAiConversationDto source, bool fillMessages = false, CancellationToken cancellationToken = default ) { // var result = await conversationEnricher.Enrich( source: source, fillMessages: fillMessages, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Items ... /// /// /// /// public async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var result = await vectorEnricher.EnrichRange( sources: sources, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Items ... /// /// /// /// public async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var result = await vectorEnricher.EnrichRange( sources: sources, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Items ... /// /// /// /// /// /// public async Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // var result = await projectEnricher.EnrichRange( sources: sources, fillConversations: fillConversations, cancellationToken: cancellationToken, fillConversationMessages: fillConversationMessages ); // return result; } /// /// Enrich Specified Items ... /// /// /// /// public async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var result = await messageEnricher.EnrichRange( sources: sources, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Items ... /// /// /// /// public async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var result = await mcpServerEnricher.EnrichRange( sources: sources, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Items ... /// /// /// /// /// public async Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ) { // var result = await conversationEnricher.EnrichRange( sources: sources, fillMessages: fillMessages, cancellationToken: cancellationToken ); // return result; } #endregion // #region Private ... /// /// Check Default Project Exists or not ... /// /// /// /// private async Task HasDefaultProject( string ownerId, CancellationToken cancellationToken = default ) { // // Validate Args ... var result = !ownerId.IsNullOrEmpty(); if (!result) { return result; } // // Check Default Owner Exists or not ... var defaultProjectResource = await stringProvider.FindOne( cancellationToken: cancellationToken, predicate: x => x.ResourceTitle .ToNormalString() .Contains(ownerId.ToNormalString()) && x.ResourceTitle .ToNormalString() .Contains(XAiModelsConstants.XAiProjectTitleIdentifier.ToNormalString()) && x.TranslatedValue .ToNormalString() .Contains(XAiDataProviderConstants.XDefaultAiProjectSuffix.ToNormalString()) ); result = !defaultProjectResource.IsNullOrDefault(); // return result; } /// /// Create Default Project for Specified Owner ... /// /// /// /// /// private async Task CreateDefaultProject( string ownerId, string connectionId = null, CancellationToken cancellationToken = default ) { // if (ownerId.IsNullOrEmpty()) { return; } // var defaultLang = appConfiguration.DefaultLanguage; // // Check Default Owner Exists or not ... var isExists = await HasDefaultProject( ownerId: ownerId, cancellationToken: cancellationToken ); if (isExists) { return; } // // Create Default ... var item = new XAiProjectDto() { OwnerId = ownerId, CreatedOn = DateTime.UtcNow, Title = Guid.NewGuid().ToString(), Description = Guid.NewGuid().ToString(), }; item = await projectRepositoryService.AddAsync( item: item, saveChanges: true, cancellationToken: cancellationToken ); // // Prepare Tile and Description Resource Ids ... var titleResource = await projectTitleResourceProvider.AddOrUpdateLocale( owner: ownerId, identifier: item.Id, locale: new XLocaleResourceDto { Language = defaultLang, Value = XAiDataProviderConstants.XDefaultAiProjectSuffix }, cancellationToken: cancellationToken ); var descriptionResource = await projectDescriptionResourceProvider.AddOrUpdateLocale( owner: ownerId, identifier: item.Id, new XLocaleResourceDto { Language = defaultLang, Value = XAiDataProviderConstants.XDefaultAiProjectSuffix }, cancellationToken: cancellationToken ); if (titleResource.IsNullOrDefault() || descriptionResource.IsNullOrDefault() ) { return; } // // Update Project Resources ... item.Title = titleResource.Resource; item.Description = descriptionResource.Resource; item = await projectRepositoryService.UpdateAsync( id: item.Id, item: item, saveChanges: true, cancellationToken: cancellationToken ); // // Sending Push ... if (!connectionId.IsNullOrEmpty()) { // await SendPush( connectionId: connectionId, cancellationToken: cancellationToken, payLoad: item.ToJSON(camelCase: true), action: XAiDataProviderHubActions.ProjectCreated.GetStringValue() ); } } /// /// Check Default Conversation Exists or not ... /// /// /// /// /// /// private async Task HasDefaultConversation( string ownerId, Guid? projectId, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... var result = !ownerId.IsNullOrEmpty(); if (!result) { return result; } // // Prepare Project ... XAiProjectDto project = null; if (!projectId.HasValue || projectId.Value.IsDefaultGuid() ) { // project = await GetDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); } else { // project = await projectRepositoryService.GetAsync( id: projectId.Value, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); } if (project.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Check Default Owner Exists or not ... var resource = await stringProvider.FindOne( cancellationToken: cancellationToken, predicate: x => x.ResourceTitle .ToNormalString() .Contains(ownerId.ToString().ToNormalString()) && x.ResourceTitle .ToNormalString() .Contains(XAiModelsConstants.XAiConversationTitleIdentifier.ToNormalString()) && x.TranslatedValue .ToNormalString() .Contains(XAiDataProviderConstants.XDefaultAiConversationSuffix.ToNormalString()) ); result = !resource.IsNullOrDefault(); if (!result) { return result; } // var defaultConversation = await conversationRepositoryService.FindOneAsync( cancellationToken: cancellationToken, predicate: x => x.ProjectId == project.Id && x.Title == resource.ResourceTitle ); result = !defaultConversation.IsNullOrDefault(); // return result; } /// /// Check Default Conversation Exists or not ... /// /// /// /// /// /// private async Task CreateDefaultConversation( string ownerId, Guid? projectId, string connectionId = null, CancellationToken cancellationToken = default ) { // // Validate Args ... var isValid = !ownerId.IsNullOrEmpty(); if (!isValid) { return; } // var defaultLang = appConfiguration.DefaultLanguage; // // Prepare Project ... XAiProjectDto project = null; if (!projectId.HasValue || projectId.Value.IsDefaultGuid() ) { // project = await GetDefaultProject( ownerId: ownerId, connectionId: connectionId, cancellationToken: cancellationToken ); } else { // project = await projectRepositoryService.GetAsync( id: projectId.Value, includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken ); } if (project.IsNullOrDefault()) { XException.NotFound.Throw(); } // // Check Default Owner Exists or not ... isValid = await HasDefaultConversation( ownerId: ownerId, projectId: project.Id, cancellationToken: cancellationToken ); if (isValid) { return; } // // Create Default Conversation ... var item = new XAiConversationDto { OwnerId = ownerId, ProjectId = project.Id, CreatedOn = DateTime.UtcNow, Title = Guid.NewGuid().ToString() }; item = await conversationRepositoryService.AddAsync( item: item, saveChanges: true, cancellationToken: cancellationToken ); // // Prepare Title Resource Ids ... var titleResource = await conversationTitleResourceProvider.AddOrUpdateLocale( owner: ownerId, identifier: item.Id, locale: new XLocaleResourceDto { Language = defaultLang, Value = XAiDataProviderConstants.XDefaultAiConversationSuffix }, cancellationToken: cancellationToken ); if (titleResource.IsNullOrDefault()) { return; } // // Update Conversation Resources ... item.Title = titleResource.Resource; item = await conversationRepositoryService.UpdateAsync( item: item, id: item.Id, saveChanges: true, cancellationToken: cancellationToken ); // // Sending Push ... if (!connectionId.IsNullOrEmpty()) { // await SendPush( connectionId: connectionId, cancellationToken: cancellationToken, payLoad: item.ToJSON(camelCase: true), action: XAiDataProviderHubActions.ConversationCreated.GetStringValue() ); } } /// /// Send Custom Push Message ... /// /// /// /// /// /// public async Task SendPush( string action, string payLoad, string connectionId = null, CancellationToken cancellationToken = default ) { // try { // // Collect Allowed Actions ... var actions = new List { XAiDataProviderHubActions.ProjectCreated.GetStringValue(), XAiDataProviderHubActions.ProjectUpdated.GetStringValue(), XAiDataProviderHubActions.ProjectRemoved.GetStringValue(), XAiDataProviderHubActions.MessageCreated.GetStringValue(), XAiDataProviderHubActions.MessageUpdated.GetStringValue(), XAiDataProviderHubActions.MessageRemoved.GetStringValue(), XAiDataProviderHubActions.ConversationCreated.GetStringValue(), XAiDataProviderHubActions.ConversationUpdated.GetStringValue(), XAiDataProviderHubActions.ConversationRemoved.GetStringValue(), }; // // Validate Args ... var isValid = !action.IsNullOrEmpty() && actions.Contains(action); if (!isValid) { return; } // // Retrieve Connection Id ... var clients = hub.Clients.All; if (!connectionId.IsNullOrEmpty()) { clients = hub.Clients.AllExcept(connectionId); } // await clients.SendAsync( action, payLoad, connectionId, cancellationToken ); } catch { } } /// /// Build Database Predicate Expression for Vectors by Optional Identifier Prefix and Type ... /// Returns null when no Filter Provided ... /// /// /// /// private Expression> BuildVectorPredicateExpression( string identifierPrefix, string type ) { // Expression> result = null; // var hasType = !type.IsNullOrEmpty(); var hasPrefix = !identifierPrefix.IsNullOrEmpty(); // if (hasPrefix && hasType) { // result = x => x.Identifier .StartsWith(identifierPrefix) && x.Type == type; } else if (hasPrefix) { // result = x => x.Identifier .StartsWith(identifierPrefix); } else if (hasType) { result = x => x.Type == type; } // return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiMcpServerEntityRegisterar .cs using System; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using xAiModels.Configurations.Entities; namespace xAiModels.Providers { public class XAiMcpServerEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar { public XAiMcpServerEntityRegisterar() : base(nameof(XAiMcpServerEntityRegisterar)) { // // Add Entity ... AddEntity(); } /// /// Configure Entities ... /// /// public override void ConfigureEntities(ModelBuilder modelBuilder) { // // Configure Entity Using Provided ... modelBuilder .ApplyConfigurationsFromAssembly(typeof(XAiMcpServerEntityConfiguration).Assembly); // base.ConfigureEntities(modelBuilder); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiMessageEntityRegisterar.cs using System; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using xAiModels.Configurations.Entities; namespace xAiModels.Providers { public class XAiMessageEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar { public XAiMessageEntityRegisterar() : base(nameof(XAiMessageEntityRegisterar)) { // // Add Entity ... AddEntity(); } /// /// Configure Entities ... /// /// public override void ConfigureEntities(ModelBuilder modelBuilder) { // // Configure Entity Using Provided ... modelBuilder .ApplyConfigurationsFromAssembly(typeof(XAiMessageEntityConfiguration).Assembly); // base.ConfigureEntities(modelBuilder); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiProjectDescriptionResourceProvider.cs using xAiModels.Constants; using xAiModels.Interfaces; using xCommons.Configurations; using xStringService.Providers; using xStringService.Interfaces.Dtos; namespace xAiModels.Providers { public class XAiProjectDescriptionResourceProvider : XBaseOwnedItemResourceProvider, IXAiProjectDescriptionResourceProvider { public XAiProjectDescriptionResourceProvider( XAppConfiguration appConfig, IXStringServiceProvider stringProvider ) : base( appConfig: appConfig, stringProvider: stringProvider, item: XAiModelsConstants.XAiProjectDescriptionIdentifier ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiProjectEntityRegisterar.cs using System; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using xAiModels.Configurations.Entities; namespace xAiModels.Providers { public class XAiProjectEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar { public XAiProjectEntityRegisterar() : base(nameof(XAiProjectEntityRegisterar)) { // // Add Entity ... AddEntity(); } /// /// Configure Entities ... /// /// public override void ConfigureEntities(ModelBuilder modelBuilder) { // // Configure Entity Using Provided ... modelBuilder .ApplyConfigurationsFromAssembly(typeof(XAiProjectEntityConfiguration).Assembly); // base.ConfigureEntities(modelBuilder); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiProjectTitleResourceProvider.cs using xAiModels.Constants; using xAiModels.Interfaces; using xCommons.Configurations; using xStringService.Providers; using xStringService.Interfaces.Dtos; namespace xAiModels.Providers { public class XAiProjectTitleResourceProvider : XBaseOwnedItemResourceProvider, IXAiProjectTitleResourceProvider { public XAiProjectTitleResourceProvider( XAppConfiguration appConfig, IXStringServiceProvider stringProvider ) : base( appConfig: appConfig, stringProvider: stringProvider, item: XAiModelsConstants.XAiProjectTitleIdentifier ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\XAiVectorEntityRegisterar.cs using System; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using Microsoft.EntityFrameworkCore; using xAiModels.Configurations.Entities; namespace xAiModels.Providers { public class XAiVectorEntityRegisterar : XBaseEntityRegisterar, IXEntityRegisterar { public XAiVectorEntityRegisterar() : base(nameof(XAiVectorEntityRegisterar)) { // // Add Entity ... AddEntity(); } /// /// Configure Entities ... /// /// public override void ConfigureEntities(ModelBuilder modelBuilder) { // // Configure Entity Using Provided ... modelBuilder .ApplyConfigurationsFromAssembly(typeof(XAiVectorEntityConfiguration).Assembly); // base.ConfigureEntities(modelBuilder); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiConversationDtoHub.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; namespace xAiModels.Providers.Dtos { public class XAiConversationDtoHub : XBaseDtoHub, IXAiConversationDtoHub { public XAiConversationDtoHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiConversationRepositoryService.cs using System; using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xDataService.Providers; using xAiModels.Configurations; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xIdentityService.Extensions; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Dtos { public class XAiConversationRepositoryService : XBaseRepositoryService, IXAiConversationRepositoryService { private readonly IXIdentityProvider identityProvider; private readonly IXAiConversationRepository repository; private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; public XAiConversationRepositoryService( IXIdentityProvider identityProvider, IXAiConversationRepository repository, IXAiProjectTitleResourceProvider projectTitleResourceProvider, IXAiConversationTitleResourceProvider conversationTitleResourceProvider, IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) : base( repository, mapperProfiles: [ new XAiModelMappersProfile() ] ) { this.repository = repository; this.identityProvider = identityProvider; this.projectTitleResourceProvider = projectTitleResourceProvider; this.conversationTitleResourceProvider = conversationTitleResourceProvider; this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// public virtual async Task Enrich( XAiConversation source, bool fillMessages = false, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = Mapper.Map(source); result = await Enrich( source: result, fillMessages: fillMessages, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// /// public virtual async Task Enrich( XAiConversationDto source, bool fillMessages = false, CancellationToken cancellationToken = default ) { // // Handdle Owner ... XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { // // Try to Retrieve User Info ... var device = identityProvider.GetDevice(); var userInfo = await identityProvider.GetUserInfo( device: device, userSelectByParam: source.OwnerId ); owner = userInfo.ToXPersonDto(); } // // Handle Title Resource ... XResourceDto titleResource = null; if (!source.Title.IsNullOrEmpty()) { // titleResource = await conversationTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.Id, cancellationToken: cancellationToken ); } // // Handle Project Info ... XResourceDto projectTitleResource = null; XResourceDto projectDescriptionResource = null; if (!source.ProjectId.IsDefaultGuid()) { // projectTitleResource = await projectTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.ProjectId, cancellationToken: cancellationToken ); // projectDescriptionResource = await projectDescriptionResourceProvider.GetResource( owner: source.OwnerId, identifier: source.ProjectId, cancellationToken: cancellationToken ); } // // Attach Extracted Items ... var result = Mapper.Map(source, options => { // options.Items[nameof(source.Owner)] = owner; options.Items[nameof(source.TitleResource)] = titleResource; options.Items[nameof(source.ProjectTitleResource)] = projectTitleResource; options.Items[nameof(source.ProjectDescriptionResource)] = projectDescriptionResource; }); // return result; } /// /// Enrich Specified Items ... /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, fillMessages: fillMessages, cancellationToken: cancellationToken )); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, fillMessages: fillMessages, cancellationToken: cancellationToken )); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiConversationServiceProvider.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; namespace xAiModels.Providers.Dtos { public class XAiConversationServiceProvider : XBaseDtoProvider, IXAiConversationServiceProvider { public XAiConversationServiceProvider( IHubContext hub, XDataServiceConfiguration dataConfiguration, IXAiConversationRepositoryService service, IXIdentityProvider identityProvider = null ) : base( hub, dataConfiguration, service, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMcpServerDtoHub.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; namespace xAiModels.Providers.Dtos { public class XAiMcpServerDtoHub : XBaseDtoHub, IXAiMcpServerDtoHub { public XAiMcpServerDtoHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMcpServerRepositoryService.cs using System; using xAiModels.Models.Dtos; using xDataService.Providers; using xAiModels.Configurations; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers.Dtos { public class XAiMcpServerRepositoryService : XBaseRepositoryService, IXAiMcpServerRepositoryService { private readonly IXAiMcpServerEnricher enricher; private readonly IXAiMcpServerRepository repository; public XAiMcpServerRepositoryService( IXAiMcpServerRepository repository, IXAiMcpServerEnricher enricher ) : base(repository, mapperProfiles: [new XAiModelMappersProfile()]) { this.enricher = enricher; this.repository = repository; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMcpServerServiceProvider.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; namespace xAiModels.Providers.Dtos { public class XAiMcpServerServiceProvider : XBaseDtoProvider, IXAiMcpServerServiceProvider { public XAiMcpServerServiceProvider( IHubContext hub, XDataServiceConfiguration dataConfiguration, IXAiMcpServerRepositoryService service, IXIdentityProvider identityProvider = null ) : base(hub, dataConfiguration, service, identityProvider) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMessageDtoHub.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; namespace xAiModels.Providers.Dtos { public class XAiMessageDtoHub : XBaseDtoHub, IXAiMessageDtoHub { public XAiMessageDtoHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMessageRepositoryService.cs using System; using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xDataService.Providers; using xAiModels.Configurations; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xIdentityService.Extensions; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Dtos { public class XAiMessageRepositoryService : XBaseRepositoryService, IXAiMessageRepositoryService { private readonly IXIdentityProvider identityProvider; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; public XAiMessageRepositoryService( IXAiMessageRepository repository, IXIdentityProvider identityProvider, IXAiConversationTitleResourceProvider conversationTitleResourceProvider ) : base( repository, mapperProfiles: [ new XAiModelMappersProfile() ] ) { this.identityProvider = identityProvider; this.conversationTitleResourceProvider = conversationTitleResourceProvider; } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// public virtual async Task Enrich( XAiMessage source, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = Mapper.Map(source); result = await Enrich( source: result, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// public virtual async Task Enrich( XAiMessageDto source, CancellationToken cancellationToken = default ) { // // Handdle Owner ... XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { // // Try to Retrieve User Info ... var device = identityProvider.GetDevice(); var userInfo = await identityProvider.GetUserInfo( device: device, userSelectByParam: source.OwnerId ); owner = userInfo.ToXPersonDto(); } // // Hanlde Conversation Title ... string conversationTitle = string.Empty; XResourceDto conversationTitleResource = null; if (!source.ConversationId.IsDefaultGuid()) { // conversationTitleResource = await conversationTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.ConversationId, cancellationToken: cancellationToken ); if (!conversationTitleResource.IsNullOrDefault()) { conversationTitle = conversationTitleResource.Resource; } } // // Attach Extracted Items ... var result = Mapper.Map(source, options => { // options.Items[nameof(source.Owner)] = owner; options.Items[nameof(source.ConversationTitle)] = conversationTitle; options.Items[nameof(source.ConversationTitleResouce)] = conversationTitleResource; }); // return result; } /// /// Enrich Specified Items ... /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich(x, cancellationToken)); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich(x, cancellationToken)); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiMessageServiceProvider.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; namespace xAiModels.Providers.Dtos { public class XAiMessageServiceProvider : XBaseDtoProvider, IXAiMessageServiceProvider { public XAiMessageServiceProvider( IHubContext hub, XDataServiceConfiguration dataConfiguration, IXAiMessageRepositoryService service, IXIdentityProvider identityProvider = null ) : base( hub, dataConfiguration, service, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiProjectDtoHub.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; namespace xAiModels.Providers.Dtos { public class XAiProjectDtoHub : XBaseDtoHub, IXAiProjectDtoHub { public XAiProjectDtoHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiProjectRepositoryService.cs using System; using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xDataService.Providers; using xAiModels.Configurations; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xIdentityService.Extensions; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Dtos { public class XAiProjectRepositoryService : XBaseRepositoryService, IXAiProjectRepositoryService { private readonly IXIdentityProvider identityProvider; private readonly IXAiMessageRepository messageRepository; private readonly IXAiConversationRepository conversationRepository; private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; public XAiProjectRepositoryService( IXAiProjectRepository repository, IXIdentityProvider identityProvider, IXAiMessageRepository messageRepository, IXAiConversationRepository conversationRepository, IXAiProjectTitleResourceProvider projectTitleResourceProvider, IXAiConversationTitleResourceProvider conversationTitleResourceProvider, IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) : base( repository, mapperProfiles: [ new XAiModelMappersProfile() ] ) { // this.identityProvider = identityProvider; this.messageRepository = messageRepository; this.conversationRepository = conversationRepository; this.projectTitleResourceProvider = projectTitleResourceProvider; this.conversationTitleResourceProvider = conversationTitleResourceProvider; this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// /// public virtual async Task Enrich( XAiProject source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = Mapper.Map(source); result = await Enrich( source: result, fillConversations: fillConversations, cancellationToken: cancellationToken, fillConversationMessages: fillConversationMessages ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// /// /// public virtual async Task Enrich( XAiProjectDto source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // // Handle Owner ... XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { // // Try to Retrieve User Info ... var device = identityProvider.GetDevice(); var userInfo = await identityProvider.GetUserInfo( device: device, userSelectByParam: source.OwnerId ); owner = userInfo.ToXPersonDto(); } // // Handle Title ... XResourceDto titleResource = null; if (!source.Title.IsNullOrEmpty()) { // titleResource = await projectTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.Id, cancellationToken: cancellationToken ); } // // Handle Description ... XResourceDto descriptionResource = null; if (!source.Description.IsNullOrEmpty()) { // descriptionResource = await projectDescriptionResourceProvider.GetResource( owner: source.OwnerId, identifier: source.Id, cancellationToken: cancellationToken ); } // // Handle Conversations ... IEnumerable conversations = []; if (fillConversations) { // // Reading Entities ... var entitiies = await conversationRepository.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: x => x.ProjectId == source.Id, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); // // Converts to Dto Enumerable ... conversations = entitiies .MapConvert(); // // Handle Conversation Enrichment ... foreach (var conversation in conversations) { // // Handle Owner ... if (!conversation.OwnerId.IsNullOrEmpty()) { conversation.Owner = owner; } // // Handle Title Resource ... if (!conversation.Title.IsNullOrEmpty()) { // conversation.TitleResource = await conversationTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: conversation.Id, cancellationToken: cancellationToken ); } // // Handle Project Info ... if (!conversation.ProjectId.IsDefaultGuid()) { conversation.ProjectTitle = source.Title; conversation.ProjectTitleResource = titleResource; conversation.ProjectDescription = source.Description; conversation.ProjectDescriptionResource = descriptionResource; } } // // Handle Fill Messages ... if (fillConversationMessages) { // foreach (var conversation in conversations) { // IEnumerable messages = []; // // Retrieve Message Entities ... var messageEntities = await messageRepository.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn), predicate: x => x.ConversationId == conversation.Id ); if (messageEntities.HasChild()) { // // Converts to Message ... messages = messageEntities .MapConvert(); // // Ennrich Messages ... foreach (var message in messages) { // // Handle Owner ... if (!message.OwnerId.IsNullOrEmpty()) { message.Owner = owner; } // // Handle Conversation ... if (!message.ConversationId.IsDefaultGuid()) { message.ConversationTitle = conversation.Title; message.ConversationTitleResouce = conversation.TitleResource; } } } // conversation.Messages = [.. messages]; } } } // // Attach Extracted Items ... var result = Mapper.Map(source, options => { // options.Items[nameof(source.Owner)] = owner; options.Items[nameof(source.Conversations)] = conversations; options.Items[nameof(source.TitleResource)] = titleResource; options.Items[nameof(source.DescriptionResource)] = descriptionResource; }); // return result; } /// /// Enrich Specified Items ... /// /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, cancellationToken: cancellationToken, fillConversations: fillConversations, fillConversationMessages: fillConversationMessages )); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, cancellationToken: cancellationToken, fillConversations: fillConversations, fillConversationMessages: fillConversationMessages )); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiProjectServiceProvider.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; namespace xAiModels.Providers.Dtos { public class XAiProjectServiceProvider : XBaseDtoProvider, IXAiProjectServiceProvider { public XAiProjectServiceProvider( IHubContext hub, XDataServiceConfiguration dataConfiguration, IXAiProjectRepositoryService service, IXIdentityProvider identityProvider = null ) : base( hub, dataConfiguration, service, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiVectorDtoHub.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; namespace xAiModels.Providers.Dtos { public class XAiVectorDtoHub : XBaseDtoHub, IXAiVectorDtoHub { public XAiVectorDtoHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiVectorRepositoryService.cs using System; using xAiModels.Models.Dtos; using xDataService.Providers; using xAiModels.Configurations; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Dtos { public class XAiVectorRepositoryService : XBaseRepositoryService, IXAiVectorRepositoryService { public XAiVectorRepositoryService( IXAiVectorRepository repository ) : base( repository, mapperProfiles: [ new XAiModelMappersProfile() ] ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Dtos\XAiVectorServiceProvider.cs using System; using xPushService.Base; using xAiModels.Models.Dtos; using xAiModels.Interfaces.Dtos; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; namespace xAiModels.Providers.Dtos { public class XAiVectorServiceProvider : XBaseDtoProvider, IXAiVectorServiceProvider { public XAiVectorServiceProvider( IHubContext hub, XDataServiceConfiguration dataConfiguration, IXAiVectorRepositoryService service, IXIdentityProvider identityProvider = null ) : base( hub, dataConfiguration, service, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Enrichers\XAiConversationEnricher.cs using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xIdentityService.Extensions; using xAiModels.Interfaces.Entities; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers.Enrichers { public class XAiConversationEnricher : IXAiConversationEnricher { private readonly IXIdentityProvider identityProvider; private readonly IXAiConversationRepository repository; private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; public XAiConversationEnricher( IXIdentityProvider identityProvider, IXAiConversationRepository repository, IXAiProjectTitleResourceProvider projectTitleResourceProvider, IXAiConversationTitleResourceProvider conversationTitleResourceProvider, IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) { // this.repository = repository; this.identityProvider = identityProvider; this.projectTitleResourceProvider = projectTitleResourceProvider; this.conversationTitleResourceProvider = conversationTitleResourceProvider; this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// public virtual async Task Enrich( XAiConversation source, bool fillMessages = false, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = source.MapConvert(); result = await Enrich( source: result, fillMessages: fillMessages, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// /// public virtual async Task Enrich( XAiConversationDto source, bool fillMessages = false, CancellationToken cancellationToken = default ) { // // Handdle Owner ... XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { // // Try to Retrieve User Info ... var device = identityProvider.GetDevice(); var userInfo = await identityProvider.GetUserInfo( device: device, userSelectByParam: source.OwnerId ); owner = userInfo.ToXPersonDto(); } // // Handle Title Resource ... XResourceDto titleResource = null; if (!source.Title.IsNullOrEmpty()) { // titleResource = await conversationTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.Id, cancellationToken: cancellationToken ); } // // Handle Project Info ... XResourceDto projectTitleResource = null; XResourceDto projectDescriptionResource = null; if (!source.ProjectId.IsDefaultGuid()) { // projectTitleResource = await projectTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.ProjectId, cancellationToken: cancellationToken ); // projectDescriptionResource = await projectDescriptionResourceProvider.GetResource( owner: source.OwnerId, identifier: source.ProjectId, cancellationToken: cancellationToken ); } // // Attach Extracted Items ... var result = source.MapConvert(); result.Owner = owner; result.TitleResource = titleResource; result.ProjectTitleResource = projectTitleResource; result.ProjectTitle = projectTitleResource.Resource; result.ProjectDescriptionResource = projectDescriptionResource; result.ProjectDescription = projectDescriptionResource.Resource; // return result; } /// /// Enrich Specified Items ... /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, fillMessages: fillMessages, cancellationToken: cancellationToken )); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, fillMessages: fillMessages, cancellationToken: cancellationToken )); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Enrichers\XAiMcpServerEnricher.cs using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers.Enrichers { public class XAiMcpServerEnricher : IXAiMcpServerEnricher { private readonly IXPersonService personService; public XAiMcpServerEnricher( IXPersonService personService ) { this.personService = personService; } public virtual async Task Enrich( XAiMcpServer source, CancellationToken cancellationToken = default ) { // var result = source.MapConvert(); result = await Enrich( source: result, cancellationToken: cancellationToken ); // return result; } public virtual async Task Enrich( XAiMcpServerDto source, CancellationToken cancellationToken = default ) { // XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { owner = await personService.GetPerson(source.OwnerId); } // var result = source.MapConvert(); result.Owner = owner; // return result; } public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { var tasks = sources.Select(x => Enrich(x, cancellationToken)); return await Task.WhenAll(tasks); } public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { var tasks = sources.Select(x => Enrich(x, cancellationToken)); return await Task.WhenAll(tasks); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Enrichers\XAiMessageEnricher.cs using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xIdentityService.Extensions; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers.Enrichers { public class XAiMessageEnricher : IXAiMessageEnricher { private readonly IXPersonService personService; private readonly IXIdentityProvider identityProvider; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; public XAiMessageEnricher( IXPersonService personService, IXIdentityProvider identityProvider, IXAiConversationTitleResourceProvider conversationTitleResourceProvider ) { this.personService = personService; this.identityProvider = identityProvider; this.conversationTitleResourceProvider = conversationTitleResourceProvider; } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// public virtual async Task Enrich( XAiMessage source, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = source.MapConvert(); result = await Enrich( source: result, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// public virtual async Task Enrich( XAiMessageDto source, CancellationToken cancellationToken = default ) { // // Handdle Owner ... XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { owner = await personService.GetPerson(source.OwnerId); } // // Hanlde Conversation Title ... string conversationTitle = string.Empty; XResourceDto conversationTitleResource = null; if (!source.ConversationId.IsDefaultGuid()) { // conversationTitleResource = await conversationTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.ConversationId, cancellationToken: cancellationToken ); if (!conversationTitleResource.IsNullOrDefault()) { conversationTitle = conversationTitleResource.Resource; } } // // Attach Extracted Items ... var result = source.MapConvert(); result.Owner = owner; result.ConversationTitle = conversationTitle; result.ConversationTitleResouce = conversationTitleResource; // return result; } /// /// Enrich Specified Items ... /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich(x, cancellationToken)); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich(x, cancellationToken)); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Enrichers\XAiProjectEnricher.cs using System.Linq; using xModels.Dtos; using System.Threading; using xCommons.Extensions; using xAiModels.Interfaces; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; using xIdentityService.Interfaces; using xAiModels.Interfaces.Entities; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers.Enrichers { public class XAiProjectEnricher : IXAiProjectEnricher { private readonly IXPersonService personService; private readonly IXIdentityProvider identityProvider; private readonly IXAiMessageRepository messageRepository; private readonly IXAiConversationRepository conversationRepository; private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider; private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider; private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider; public XAiProjectEnricher( IXPersonService personService, IXIdentityProvider identityProvider, IXAiMessageRepository messageRepository, IXAiConversationRepository conversationRepository, IXAiProjectTitleResourceProvider projectTitleResourceProvider, IXAiConversationTitleResourceProvider conversationTitleResourceProvider, IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider ) { // this.personService = personService; this.identityProvider = identityProvider; this.messageRepository = messageRepository; this.conversationRepository = conversationRepository; this.projectTitleResourceProvider = projectTitleResourceProvider; this.conversationTitleResourceProvider = conversationTitleResourceProvider; this.projectDescriptionResourceProvider = projectDescriptionResourceProvider; } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// /// /// public virtual async Task Enrich( XAiProject source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = source.MapConvert(); result = await Enrich( source: result, fillConversations: fillConversations, cancellationToken: cancellationToken, fillConversationMessages: fillConversationMessages ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// /// /// public virtual async Task Enrich( XAiProjectDto source, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // // Handle Owner ... XPersonDto owner = null; if (!source.OwnerId.IsNullOrEmpty()) { owner = await personService.GetPerson(source.OwnerId); } // // Handle Title ... XResourceDto titleResource = null; if (!source.Title.IsNullOrEmpty()) { // titleResource = await projectTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: source.Id, cancellationToken: cancellationToken ); } // // Handle Description ... XResourceDto descriptionResource = null; if (!source.Description.IsNullOrEmpty()) { // descriptionResource = await projectDescriptionResourceProvider.GetResource( owner: source.OwnerId, identifier: source.Id, cancellationToken: cancellationToken ); } // // Handle Conversations ... IEnumerable conversations = []; if (fillConversations) { // // Reading Entities ... var entitiies = await conversationRepository.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, predicate: x => x.ProjectId == source.Id, orderBuilder: x => x.OrderBy(y => y.CreatedOn) ); // // Converts to Dto Enumerable ... conversations = entitiies .MapConvert(); // // Handle Conversation Enrichment ... foreach (var conversation in conversations) { // // Handle Owner ... if (!conversation.OwnerId.IsNullOrEmpty()) { conversation.Owner = owner; } // // Handle Title Resource ... if (!conversation.Title.IsNullOrEmpty()) { // conversation.TitleResource = await conversationTitleResourceProvider.GetResource( owner: source.OwnerId, identifier: conversation.Id, cancellationToken: cancellationToken ); } // // Handle Project Info ... if (!conversation.ProjectId.IsDefaultGuid()) { conversation.ProjectTitle = source.Title; conversation.ProjectTitleResource = titleResource; conversation.ProjectDescription = source.Description; conversation.ProjectDescriptionResource = descriptionResource; } } // // Handle Fill Messages ... if (fillConversationMessages) { // foreach (var conversation in conversations) { // IEnumerable messages = []; // // Retrieve Message Entities ... var messageEntities = await messageRepository.FindManyAsync( includeBuilder: null, ignoreSoftDeleteds: true, cancellationToken: cancellationToken, orderBuilder: x => x.OrderBy(y => y.CreatedOn), predicate: x => x.ConversationId == conversation.Id ); if (messageEntities.HasChild()) { // // Converts to Message ... messages = messageEntities .MapConvert(); // // Ennrich Messages ... foreach (var message in messages) { // // Handle Owner ... if (!message.OwnerId.IsNullOrEmpty()) { message.Owner = owner; } // // Handle Conversation ... if (!message.ConversationId.IsDefaultGuid()) { message.ConversationTitle = conversation.Title; message.ConversationTitleResouce = conversation.TitleResource; } } } // conversation.Messages = [.. messages]; } } } // // Attach Extracted Items ... var result = source.MapConvert(); result.Owner = owner; result.TitleResource = titleResource; result.Conversations = [.. conversations]; result.DescriptionResource = descriptionResource; // return result; } /// /// Enrich Specified Items ... /// /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, cancellationToken: cancellationToken, fillConversations: fillConversations, fillConversationMessages: fillConversationMessages )); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, bool fillConversations = false, bool fillConversationMessages = false, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, cancellationToken: cancellationToken, fillConversations: fillConversations, fillConversationMessages: fillConversationMessages )); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Enrichers\XAiVectorEnricher.cs using System.Linq; using System.Threading; using xCommons.Extensions; using xAiModels.Extensions; using xAiModels.Models.Dtos; using System.Threading.Tasks; using xAiModels.Models.Entities; using System.Collections.Generic; using xAiModels.Interfaces.Enrichers; namespace xAiModels.Providers.Enrichers { public class XAiVectorEnricher : IXAiVectorEnricher { public XAiVectorEnricher() { } // #region Enrichers ... /// /// Enrich Specified Item ... /// /// /// /// public virtual async Task Enrich( XAiVector source, CancellationToken cancellationToken = default ) { // // Mapping Default ... var result = source.MapConvert(); // // Here we Converts Embeddings ... result.Metadata = source.Metadata.AsMetadat(); result.Embedding = source.Embedding.AsEmbedding(); // result = await Enrich( source: result, cancellationToken: cancellationToken ); // return result; } /// /// Enrich Specified Item ... /// /// /// /// public virtual async Task Enrich( XAiVectorDto source, CancellationToken cancellationToken = default ) { // // Currently no additional enrichment needed for XAiVector // This can be extended in the future if needed return await Task.FromResult(source); } /// /// Enrich Specified Items ... /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, cancellationToken: cancellationToken )); // var result = await Task.WhenAll(tasks); return result; } /// /// Enrich Specified Items ... /// /// /// /// public virtual async Task> EnrichRange( IEnumerable sources, CancellationToken cancellationToken = default ) { // var tasks = sources .Select(x => Enrich( source: x, cancellationToken: cancellationToken )); // var result = await Task.WhenAll(tasks); return result; } #endregion } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationEFRepository.cs using System; using xDataService.Db; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationEFRepository : XBaseEFRepository, IXAiConversationRepository where TContext : XDbContext { public XAiConversationEFRepository( IXUnitOfWorks unitOfWorks, XDataServiceConfiguration configuration, IXAiConversationKeyGenerator keyGenerator = null, IXAiConversationRepositoryEvents baseRepositoryEvents = null ) : base( unitOfWorks, configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationEntityHub.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationEntityHub : XBaseEntityHub, IXAiConversationEntityHub { public XAiConversationEntityHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationInMemoryRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationInMemoryRepository : XBaseInMemoryRepository, IXAiConversationRepository { public XAiConversationInMemoryRepository( XDataServiceConfiguration configuration, IXAiConversationKeyGenerator keyGenerator = null, IXAiConversationRepositoryEvents baseRepositoryEvents = null ) : base( configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationKeyGenerator.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationKeyGenerator : XGuidKeyGenerator, IXAiConversationKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationMongoRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationMongoRepository : XBaseMongoRepository, IXAiConversationRepository { public XAiConversationMongoRepository( XDataBaseConfiguration dbConfiguration, XDataServiceConfiguration configuration, string collectionName = null, IXAiConversationKeyGenerator keyGenerator = null, IXAiConversationRepositoryEvents baseRepositoryEvents = null ) : base( dbConfiguration, configuration, collectionName, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationRepositoryEvents.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationRepositoryEvents : XBaseRepositoryEvents, IXAiConversationRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationRepositoryProvider.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiConversationRepositoryProvider : XBaseEntityProvider, IXAiConversationRepositoryProvider { public XAiConversationRepositoryProvider( IHubContext hub, IXAiConversationRepository repository, XDataServiceConfiguration dataConfiguration, IXIdentityProvider identityProvider = null ) : base( hub, repository, dataConfiguration, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiConversationSeederBase.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public abstract class XAiConversationSeederBase : XBaseDbSeeder, IXAiConversationSeeder { protected XAiConversationSeederBase( string entity, string database, IXAiConversationRepository repository, XDataServiceConfiguration dataServiceConfiguration ) : base( entity, database, repository, dataServiceConfiguration ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerEFRepository.cs using System; using xDataService.Db; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMcpServerEFRepository : XBaseEFRepository, IXAiMcpServerRepository where TContext : XDbContext { public XAiMcpServerEFRepository( IXUnitOfWorks unitOfWorks, XDataServiceConfiguration configuration, IXAiMcpServerKeyGenerator keyGenerator = null, IXAiMcpServerRepositoryEvents baseRepositoryEvents = null ) : base(unitOfWorks, configuration, keyGenerator, baseRepositoryEvents) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerEntityHub.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMcpServerEntityHub : XBaseEntityHub, IXAiMcpServerEntityHub { public XAiMcpServerEntityHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerInMemoryRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMcpServerInMemoryRepository : XBaseInMemoryRepository, IXAiMcpServerRepository { public XAiMcpServerInMemoryRepository( XDataServiceConfiguration configuration, IXAiMcpServerKeyGenerator keyGenerator = null, IXAiMcpServerRepositoryEvents baseRepositoryEvents = null ) : base(configuration, keyGenerator, baseRepositoryEvents) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerKeyGenerator.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMcpServerKeyGenerator : XGuidKeyGenerator, IXAiMcpServerKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerMongoRepository.cs using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using xAiModels.Interfaces.Entities; using xAiModels.Models.Entities; using xDataService.Configuration; using xDataService.Providers; namespace xAiModels.Providers.Entities { public class XAiMcpServerMongoRepository : XBaseMongoRepository, IXAiMcpServerRepository { public XAiMcpServerMongoRepository( XDataBaseConfiguration dbConfiguration, XDataServiceConfiguration configuration, string collectionName = null, IXAiMcpServerKeyGenerator keyGenerator = null, IXAiMcpServerRepositoryEvents baseRepositoryEvents = null ) : base(dbConfiguration, configuration, collectionName, keyGenerator, baseRepositoryEvents) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerRepositoryEvents.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMcpServerRepositoryEvents : XBaseRepositoryEvents, IXAiMcpServerRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerRepositoryProvider.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMcpServerRepositoryProvider : XBaseEntityProvider, IXAiMcpServerRepositoryProvider { public XAiMcpServerRepositoryProvider( IHubContext hub, IXAiMcpServerRepository repository, XDataServiceConfiguration dataConfiguration, IXIdentityProvider identityProvider = null ) : base(hub, repository, dataConfiguration, identityProvider) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMcpServerSeederBase.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public abstract class XAiMcpServerSeederBase : XBaseDbSeeder, IXAiMcpServerSeeder { protected XAiMcpServerSeederBase( string entity, string database, IXAiMcpServerRepository repository, XDataServiceConfiguration dataServiceConfiguration ) : base( entity, database, repository, dataServiceConfiguration ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageEFRepository.cs using System; using xDataService.Db; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageEFRepository : XBaseEFRepository, IXAiMessageRepository where TContext : XDbContext { public XAiMessageEFRepository( IXUnitOfWorks unitOfWorks, XDataServiceConfiguration configuration, IXAiMessageKeyGenerator keyGenerator = null, IXAiMessageRepositoryEvents baseRepositoryEvents = null ) : base( unitOfWorks, configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageEntityHub.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageEntityHub : XBaseEntityHub, IXAiMessageEntityHub { public XAiMessageEntityHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageInMemoryRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageInMemoryRepository : XBaseInMemoryRepository, IXAiMessageRepository { public XAiMessageInMemoryRepository( XDataServiceConfiguration configuration, IXAiMessageKeyGenerator keyGenerator = null, IXAiMessageRepositoryEvents baseRepositoryEvents = null ) : base( configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageKeyGenerator.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageKeyGenerator : XGuidKeyGenerator, IXAiMessageKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageMongoRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageMongoRepository : XBaseMongoRepository, IXAiMessageRepository { public XAiMessageMongoRepository( XDataBaseConfiguration dbConfiguration, XDataServiceConfiguration configuration, string collectionName = null, IXAiMessageKeyGenerator keyGenerator = null, IXAiMessageRepositoryEvents baseRepositoryEvents = null ) : base( dbConfiguration, configuration, collectionName, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageRepositoryEvents.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageRepositoryEvents : XBaseRepositoryEvents, IXAiMessageRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageRepositoryProvider.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiMessageRepositoryProvider : XBaseEntityProvider, IXAiMessageRepositoryProvider { public XAiMessageRepositoryProvider( IHubContext hub, IXAiMessageRepository repository, XDataServiceConfiguration dataConfiguration, IXIdentityProvider identityProvider = null ) : base( hub, repository, dataConfiguration, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiMessageSeederBase.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public abstract class XAiMessageSeederBase : XBaseDbSeeder, IXAiMessageSeeder { protected XAiMessageSeederBase( string entity, string database, IXAiMessageRepository repository, XDataServiceConfiguration dataServiceConfiguration ) : base( entity, database, repository, dataServiceConfiguration ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectEFRepository.cs using System; using xDataService.Db; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectEFRepository : XBaseEFRepository, IXAiProjectRepository where TContext : XDbContext { public XAiProjectEFRepository( IXUnitOfWorks unitOfWorks, XDataServiceConfiguration configuration, IXAiProjectKeyGenerator keyGenerator = null, IXAiProjectRepositoryEvents baseRepositoryEvents = null ) : base( unitOfWorks, configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectEntityHub.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectEntityHub : XBaseEntityHub, IXAiProjectEntityHub { public XAiProjectEntityHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectInMemoryRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectInMemoryRepository : XBaseInMemoryRepository, IXAiProjectRepository { public XAiProjectInMemoryRepository( XDataServiceConfiguration configuration, IXAiProjectKeyGenerator keyGenerator = null, IXAiProjectRepositoryEvents baseRepositoryEvents = null ) : base( configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectKeyGenerator.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectKeyGenerator : XGuidKeyGenerator, IXAiProjectKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectMongoRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectMongoRepository : XBaseMongoRepository, IXAiProjectRepository { public XAiProjectMongoRepository( XDataBaseConfiguration dbConfiguration, XDataServiceConfiguration configuration, string collectionName = null, IXAiProjectKeyGenerator keyGenerator = null, IXAiProjectRepositoryEvents baseRepositoryEvents = null ) : base( dbConfiguration, configuration, collectionName, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectRepositoryEvents.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectRepositoryEvents : XBaseRepositoryEvents, IXAiProjectRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectRepositoryProvider.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiProjectRepositoryProvider : XBaseEntityProvider, IXAiProjectRepositoryProvider { public XAiProjectRepositoryProvider( IHubContext hub, IXAiProjectRepository repository, XDataServiceConfiguration dataConfiguration, IXIdentityProvider identityProvider = null ) : base( hub, repository, dataConfiguration, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiProjectSeederBase.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public abstract class XAiProjectSeederBase : XBaseDbSeeder, IXAiProjectSeeder { protected XAiProjectSeederBase( string entity, string database, IXAiProjectRepository repository, XDataServiceConfiguration dataServiceConfiguration ) : base( entity, database, repository, dataServiceConfiguration ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorEFRepository.cs using System; using xDataService.Db; using xDataService.Providers; using xDataService.Interfaces; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorEFRepository : XBaseEFRepository, IXAiVectorRepository where TContext : XDbContext { public XAiVectorEFRepository( IXUnitOfWorks unitOfWorks, XDataServiceConfiguration configuration, IXAiVectorKeyGenerator keyGenerator = null, IXAiVectorRepositoryEvents baseRepositoryEvents = null ) : base( unitOfWorks, configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorEntityHub.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using Microsoft.Extensions.Logging; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorEntityHub : XBaseEntityHub, IXAiVectorEntityHub { public XAiVectorEntityHub( ILogger logger ) : base(logger) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorInMemoryRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorInMemoryRepository : XBaseInMemoryRepository, IXAiVectorRepository { public XAiVectorInMemoryRepository( XDataServiceConfiguration configuration, IXAiVectorKeyGenerator keyGenerator = null, IXAiVectorRepositoryEvents baseRepositoryEvents = null ) : base( configuration, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorKeyGenerator.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorKeyGenerator : XGuidKeyGenerator, IXAiVectorKeyGenerator { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorMongoRepository.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorMongoRepository : XBaseMongoRepository, IXAiVectorRepository { public XAiVectorMongoRepository( XDataBaseConfiguration dbConfiguration, XDataServiceConfiguration configuration, string collectionName = null, IXAiVectorKeyGenerator keyGenerator = null, IXAiVectorRepositoryEvents baseRepositoryEvents = null ) : base( dbConfiguration, configuration, collectionName, keyGenerator, baseRepositoryEvents ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorRepositoryEvents.cs using xDataService.Providers; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorRepositoryEvents : XBaseRepositoryEvents, IXAiVectorRepositoryEvents { } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorRepositoryProvider.cs using System; using xPushService.Base; using xAiModels.Models.Entities; using xDataService.Configuration; using xIdentityService.Interfaces; using Microsoft.AspNetCore.SignalR; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public class XAiVectorRepositoryProvider : XBaseEntityProvider, IXAiVectorRepositoryProvider { public XAiVectorRepositoryProvider( IHubContext hub, IXAiVectorRepository repository, XDataServiceConfiguration dataConfiguration, IXIdentityProvider identityProvider = null ) : base( hub, repository, dataConfiguration, identityProvider ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Entities\XAiVectorSeederBase.cs using System; using xDataService.Providers; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.Entities { public abstract class XAiVectorSeederBase : XBaseDbSeeder, IXAiVectorSeeder { protected XAiVectorSeederBase( string entity, string database, IXAiVectorRepository repository, XDataServiceConfiguration dataServiceConfiguration ) : base( entity, database, repository, dataServiceConfiguration ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphQLTypeHelper.cs using System; using xAiModels.Constants; using xDataService.GraphQL; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiConversationGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiConversationGraphQLTypeHelper { public override string GetInQueryCollectionName() { return XAiModelsConstants.XAiConversationCollectionName; } public override string GetInQuerySingleName() { return XAiModelsConstants.XAiConversationSignleName; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphQuery.cs using System; using GraphQL.Types; using xDataService.GraphQL; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiConversationGraphQuery : XBaseGraphQLQuery { public XAiConversationGraphQuery( XDataServiceConfiguration configuration, IXAiConversationRepository repository, IXAiConversationGraphQLTypeHelper helper ) : base( configuration, repository, helper ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphSchema.cs using System; using GraphQL.Types; namespace xAiModels.Providers.GraphQL { public class XAiConversationGraphSchema : Schema { public XAiConversationGraphSchema(IServiceProvider services) : base(services) { Query = (XAiConversationGraphQuery)services.GetService(typeof(XAiConversationGraphQuery)); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiConversationGraphType.cs using System; using xDataService.GraphQL; using xAiModels.Models.Entities; namespace xAiModels.Providers.GraphQL { public class XAiConversationGraphType : XBaseGraphObjectType { public XAiConversationGraphType() : base() { Field(x => x.Title); Field(x => x.OwnerId); Field(x => x.CreatedOn); Field(x => x.UpdatedAt); Field(x => x.ProjectId); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMcpServerGraphQLTypeHelper.cs using System; using xAiModels.Constants; using xDataService.GraphQL; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiMcpServerGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiMcpServerGraphQLTypeHelper { public override string GetInQueryCollectionName() { return XAiModelsConstants.XAiMcpServerCollectionName; } public override string GetInQuerySingleName() { return XAiModelsConstants.XAiMcpServerSingleName; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMcpServerGraphQuery.cs using System; using GraphQL.Types; using xDataService.GraphQL; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiMcpServerGraphQuery : XBaseGraphQLQuery { public XAiMcpServerGraphQuery( XDataServiceConfiguration configuration, IXAiMcpServerRepository repository, IXAiMcpServerGraphQLTypeHelper helper ) : base( configuration, repository, helper ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMcpServerGraphSchema.cs using System; using GraphQL.Types; namespace xAiModels.Providers.GraphQL { public class XAiMcpServerGraphSchema : Schema { public XAiMcpServerGraphSchema(IServiceProvider services) : base(services) { Query = (XAiMcpServerGraphQuery)services.GetService(typeof(XAiMcpServerGraphQuery)); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMcpServerGraphType.cs using System; using xDataService.GraphQL; using xAiModels.Models.Entities; namespace xAiModels.Providers.GraphQL { public class XAiMcpServerGraphType: XBaseGraphObjectType { public XAiMcpServerGraphType() : base() { Field(x => x.Name); Field(x => x.Enabled); Field(x => x.OwnerId); Field(x => x.Headers); Field(x => x.Endpoint); Field(x => x.CreatedOn); Field(x => x.UpdatedAt); Field(x => x.Description); Field(x => x.TimeoutSeconds); Field(x => x.EnvironmentVariables); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphQLTypeHelper.cs using System; using xAiModels.Constants; using xDataService.GraphQL; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiMessageGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiMessageGraphQLTypeHelper { public override string GetInQueryCollectionName() { return XAiModelsConstants.XAiMessageCollectionName; } public override string GetInQuerySingleName() { return XAiModelsConstants.XAiMessageSingleName; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphQuery.cs using System; using GraphQL.Types; using xDataService.GraphQL; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiMessageGraphQuery : XBaseGraphQLQuery { public XAiMessageGraphQuery( XDataServiceConfiguration configuration, IXAiMessageRepository repository, IXAiMessageGraphQLTypeHelper helper ) : base( configuration, repository, helper ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphSchema.cs using System; using GraphQL.Types; namespace xAiModels.Providers.GraphQL { public class XAiMessageGraphSchema : Schema { public XAiMessageGraphSchema(IServiceProvider services) : base(services) { Query = (XAiMessageGraphQuery)services.GetService(typeof(XAiMessageGraphQuery)); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiMessageGraphType.cs using System; using xDataService.GraphQL; using xAiModels.Models.Entities; namespace xAiModels.Providers.GraphQL { public class XAiMessageGraphType: XBaseGraphObjectType { public XAiMessageGraphType() : base() { Field(x => x.Role); Field(x => x.OwnerId); Field(x => x.Content); Field(x => x.Metadata); Field(x => x.CreatedOn); Field(x => x.UpdatedAt); Field(x => x.ConversationId); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphQLTypeHelper.cs using System; using xAiModels.Constants; using xDataService.GraphQL; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiProjectGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiProjectGraphQLTypeHelper { public override string GetInQueryCollectionName() { return XAiModelsConstants.XAiProjectCollectionName; } public override string GetInQuerySingleName() { return XAiModelsConstants.XAiProjectSingleName; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphQuery.cs using System; using GraphQL.Types; using xDataService.GraphQL; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiProjectGraphQuery : XBaseGraphQLQuery { public XAiProjectGraphQuery( XDataServiceConfiguration configuration, IXAiProjectRepository repository, IXAiProjectGraphQLTypeHelper helper ) : base( configuration, repository, helper ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphSchema.cs using System; using GraphQL.Types; namespace xAiModels.Providers.GraphQL { public class XAiProjectGraphSchema : Schema { public XAiProjectGraphSchema(IServiceProvider services) : base(services) { Query = (XAiProjectGraphQuery)services.GetService(typeof(XAiProjectGraphQuery)); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiProjectGraphType.cs using System; using xDataService.GraphQL; using xAiModels.Models.Entities; namespace xAiModels.Providers.GraphQL { public class XAiProjectGraphType : XBaseGraphObjectType { public XAiProjectGraphType() : base() { Field(x => x.Title); Field(x => x.OwnerId); Field(x => x.Prompt); Field(x => x.CreatedOn); Field(x => x.UpdatedAt); Field(x => x.Description); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiVectorGraphQLTypeHelper.cs using System; using xAiModels.Constants; using xDataService.GraphQL; using xAiModels.Models.Entities; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiVectorGraphQLTypeHelper : XBaseGraphQLTypeHelper, IXAiVectorGraphQLTypeHelper { public override string GetInQueryCollectionName() { return XAiModelsConstants.XAiVectorCollectionName; } public override string GetInQuerySingleName() { return XAiModelsConstants.XAiVectorSingleName; } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiVectorGraphQuery.cs using System; using GraphQL.Types; using xDataService.GraphQL; using xAiModels.Models.Entities; using xDataService.Configuration; using xAiModels.Interfaces.Entities; namespace xAiModels.Providers.GraphQL { public class XAiVectorGraphQuery : XBaseGraphQLQuery { public XAiVectorGraphQuery( XDataServiceConfiguration configuration, IXAiVectorRepository repository, IXAiVectorGraphQLTypeHelper helper ) : base( configuration, repository, helper ) { } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiVectorGraphSchema.cs using System; using GraphQL.Types; namespace xAiModels.Providers.GraphQL { public class XAiVectorGraphSchema : Schema { public XAiVectorGraphSchema(IServiceProvider services) : base(services) { Query = (XAiVectorGraphQuery)services.GetService(typeof(XAiVectorGraphQuery)); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\GraphQL\XAiVectorGraphType.cs using System; using xDataService.GraphQL; using xAiModels.Models.Entities; namespace xAiModels.Providers.GraphQL { public class XAiVectorGraphType : XBaseGraphObjectType { public XAiVectorGraphType() : base() { Field(x => x.Text); Field(x => x.Metadata); Field(x => x.Embedding); } } } ### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Providers\Hubs\XAiDataProviderHub.cs using System.Threading; using xPushService.Base; using xAiModels.Constants; using xCommons.Extensions; using xAiModels.Models.Dtos; using System.Threading.Tasks; using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; namespace xAiModels.Providers.Hubs { public class XAiDataProviderHub : XBaseHub { public XAiDataProviderHub( ILogger logger ) : base(logger) { } // #region XAiProject ... /// /// Notify a New Item Created ... /// /// /// /// public async Task ProjectCreated( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.ProjectCreated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Removed ... /// /// /// /// public async Task ProjectRemoved( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.ProjectRemoved.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Updated ... /// /// /// /// public async Task ProjectUpdated( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.ProjectUpdated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } #endregion // #region XAiMessage ... /// /// Notify a New Item Created ... /// /// /// /// public async Task MessageCreated( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.MessageCreated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Removed ... /// /// /// /// public async Task MessageRemoved( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.MessageRemoved.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Updated ... /// /// /// /// public async Task MessageUpdated( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.MessageUpdated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } #endregion // #region XAiMcpServer ... /// /// Notify a New Item Created ... /// /// /// /// public async Task McpServerCreated( XAiMcpServerDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.McpServerCreated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Removed ... /// /// /// /// public async Task McpServerRemoved( XAiMcpServerDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.McpServerRemoved.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Updated ... /// /// /// /// public async Task McpServerUpdated( XAiMcpServerDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.McpServerUpdated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } #endregion // #region XAiConversation ... /// /// Notify a New Item Created ... /// /// /// /// public async Task ConversationCreated( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.ConversationCreated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Removed ... /// /// /// /// public async Task ConversationRemoved( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.ConversationRemoved.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } /// /// Notify an Item Updated ... /// /// /// /// public async Task ConversationUpdated( XAiProjectDto item, CancellationToken cancellationToken = default ) { // var connectionId = Context.ConnectionId; if (!connectionId.IsNullOrEmpty()) { // await Clients .AllExcept(connectionId) .SendAsync( XAiDataProviderHubActions.ConversationUpdated.GetStringValue(), item.ToJSON(camelCase: true), connectionId, cancellationToken ); } } #endregion } }