last works ...
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
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,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Conversation ...
|
||||||
|
[StringValue("ConversationCreated")]
|
||||||
|
ConversationCreated,
|
||||||
|
|
||||||
|
[StringValue("ConversationUpdated")]
|
||||||
|
ConversationUpdated,
|
||||||
|
|
||||||
|
[StringValue("ConversationRemoved")]
|
||||||
|
ConversationRemoved,
|
||||||
|
|
||||||
|
//
|
||||||
|
// Message ...
|
||||||
|
[StringValue("MessageCreated")]
|
||||||
|
MessageCreated,
|
||||||
|
|
||||||
|
[StringValue("MessageUpdated")]
|
||||||
|
MessageUpdated,
|
||||||
|
|
||||||
|
[StringValue("MessageRemoved")]
|
||||||
|
MessageRemoved,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,222 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xModels.Dtos;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
public interface IXAiConversationRepositoryService : IXBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>
|
public interface IXAiConversationRepositoryService : IXBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>
|
||||||
{ }
|
{
|
||||||
|
//
|
||||||
|
#region Actions ...
|
||||||
|
//
|
||||||
|
#region Add ...
|
||||||
|
/// <summary>
|
||||||
|
/// add a new Dto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> AddAsync(
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// add or update a Dto (add if not exists/update if exists) ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> AddOrUpdateAsync(
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Update ...
|
||||||
|
/// <summary>
|
||||||
|
/// Update an Dto values ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> UpdateAsync(
|
||||||
|
Guid id,
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Remove ...
|
||||||
|
/// <summary>
|
||||||
|
/// remove an Dto by it's Id ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="softDelete"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> RemoveAsync(
|
||||||
|
Guid id,
|
||||||
|
bool softDelete = false,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// remove an Dto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="softDelete"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> RemoveAsync(
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool softDelete = false,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Retrieve ...
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve an Dto by it's Id ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> GetAsync(
|
||||||
|
Guid id,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve all exists Dtos ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiConversationDto>> GetAllAsync(
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve all exists Dtos
|
||||||
|
/// as Async Enumerable ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IAsyncEnumerable<XAiConversationDto> GetAllAsAsyncEnumerable(
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// find an Dto by providing a Conditional Expression ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> FindOneAsync(
|
||||||
|
Expression<Func<XAiConversation, bool>> predicate,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// find a collection of Dtos by proving a Conditional Expression ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiConversationDto>> FindManyAsync(
|
||||||
|
Expression<Func<XAiConversation, bool>> predicate,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve Dtos based on XQuery Pagination structure ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XQueryResult<XAiConversationDto>> QueryAsync(
|
||||||
|
XQuery query,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Expression<Func<XAiConversation, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -14,7 +14,6 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
{
|
{
|
||||||
public interface IXAiProjectRepositoryService : IXBaseRepositoryService<XAiProject, XAiProjectDto, Guid>
|
public interface IXAiProjectRepositoryService : IXBaseRepositoryService<XAiProject, XAiProjectDto, Guid>
|
||||||
{
|
{
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Actions ...
|
#region Actions ...
|
||||||
//
|
//
|
||||||
@@ -25,12 +24,14 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> AddAsync(
|
Task<XAiProjectDto> AddAsync(
|
||||||
XAiProjectDto item,
|
XAiProjectDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -40,12 +41,14 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> AddOrUpdateAsync(
|
Task<XAiProjectDto> AddOrUpdateAsync(
|
||||||
XAiProjectDto item,
|
XAiProjectDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
@@ -59,6 +62,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> UpdateAsync(
|
Task<XAiProjectDto> UpdateAsync(
|
||||||
@@ -66,6 +70,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
XAiProjectDto item,
|
XAiProjectDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
@@ -79,6 +84,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="softDelete"></param>
|
/// <param name="softDelete"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> RemoveAsync(
|
Task<XAiProjectDto> RemoveAsync(
|
||||||
@@ -86,6 +92,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
bool softDelete = false,
|
bool softDelete = false,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -96,6 +103,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="softDelete"></param>
|
/// <param name="softDelete"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> RemoveAsync(
|
Task<XAiProjectDto> RemoveAsync(
|
||||||
@@ -103,6 +111,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
bool softDelete = false,
|
bool softDelete = false,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
@@ -116,6 +125,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> GetAsync(
|
Task<XAiProjectDto> GetAsync(
|
||||||
@@ -123,6 +133,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -133,6 +144,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XAiProjectDto>> GetAllAsync(
|
Task<IEnumerable<XAiProjectDto>> GetAllAsync(
|
||||||
@@ -140,6 +152,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -151,6 +164,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
IAsyncEnumerable<XAiProjectDto> GetAllAsAsyncEnumerable(
|
IAsyncEnumerable<XAiProjectDto> GetAllAsAsyncEnumerable(
|
||||||
@@ -158,6 +172,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -168,6 +183,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> FindOneAsync(
|
Task<XAiProjectDto> FindOneAsync(
|
||||||
@@ -175,6 +191,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -186,6 +203,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XAiProjectDto>> FindManyAsync(
|
Task<IEnumerable<XAiProjectDto>> FindManyAsync(
|
||||||
@@ -194,6 +212,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -206,6 +225,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XQueryResult<XAiProjectDto>> QueryAsync(
|
Task<XQueryResult<XAiProjectDto>> QueryAsync(
|
||||||
@@ -215,6 +235,7 @@ namespace xAiModels.Interfaces.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
|
||||||
@@ -7,5 +10,35 @@ namespace xAiModels.Interfaces.Enrichers
|
|||||||
/// Ai Conversation Enricher ...
|
/// Ai Conversation Enricher ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IXAiConversationEnricher : IXBaseEnricher<XAiConversationDto, XAiConversationDto>
|
public interface IXAiConversationEnricher : IXBaseEnricher<XAiConversationDto, XAiConversationDto>
|
||||||
{ }
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a Signle Entity to Dto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="destination"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task EnrichAsync(
|
||||||
|
XAiConversationDto source,
|
||||||
|
XAiConversationDto destination,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a Collection of Entities to Dtos ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="destinations"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task EnrichRangeAsync(
|
||||||
|
IEnumerable<XAiConversationDto> sources,
|
||||||
|
IEnumerable<XAiConversationDto> destinations,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,7 @@ namespace xAiModels.Interfaces.Enrichers
|
|||||||
XAiProjectDto source,
|
XAiProjectDto source,
|
||||||
XAiProjectDto destination,
|
XAiProjectDto destination,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -20,6 +21,7 @@ namespace xAiModels.Interfaces.Enrichers
|
|||||||
IEnumerable<XAiProjectDto> sources,
|
IEnumerable<XAiProjectDto> sources,
|
||||||
IEnumerable<XAiProjectDto> destinations,
|
IEnumerable<XAiProjectDto> destinations,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using xModels.Base;
|
using xModels.Base;
|
||||||
using xModels.Dtos;
|
using xModels.Dtos;
|
||||||
|
|
||||||
@@ -40,6 +41,11 @@ namespace xAiModels.Models.Dtos
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DateTime UpdatedAt { get; set; }
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Conversation Messages ...
|
||||||
|
/// </summary>
|
||||||
|
public virtual IEnumerable<XAiMessageDto> Messages { get; set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Project ID ...
|
/// Project ID ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -53,27 +53,12 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await AddAsync(
|
||||||
var result = await base.AddAsync(
|
|
||||||
item: item,
|
item: item,
|
||||||
|
fillMessages: false,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -89,27 +74,12 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await AddOrUpdateAsync(
|
||||||
var result = await base.AddAsync(
|
|
||||||
item: item,
|
item: item,
|
||||||
|
fillMessages: false,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -130,28 +100,13 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await UpdateAsync(
|
||||||
var result = await base.UpdateAsync(
|
|
||||||
id: id,
|
id: id,
|
||||||
item: item,
|
item: item,
|
||||||
|
fillMessages: false,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -172,28 +127,13 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await RemoveAsync(
|
||||||
var result = await base.RemoveAsync(
|
|
||||||
id: id,
|
id: id,
|
||||||
|
fillMessages: false,
|
||||||
softDelete: softDelete,
|
softDelete: softDelete,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -211,28 +151,13 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await RemoveAsync(
|
||||||
var result = await base.RemoveAsync(
|
|
||||||
item: item,
|
item: item,
|
||||||
|
fillMessages: false,
|
||||||
softDelete: softDelete,
|
softDelete: softDelete,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -253,28 +178,13 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await GetAsync(
|
||||||
var result = await base.GetAsync(
|
|
||||||
id: id,
|
id: id,
|
||||||
|
fillMessages: false,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -292,28 +202,13 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await GetAllAsync(
|
||||||
var result = await base.GetAllAsync(
|
fillMessages: false,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichRangeAsync(
|
|
||||||
sources: result,
|
|
||||||
destinations: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -325,35 +220,20 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override async IAsyncEnumerable<XAiConversationDto> GetAllAsAsyncEnumerable(
|
public override IAsyncEnumerable<XAiConversationDto> GetAllAsAsyncEnumerable(
|
||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
[EnumeratorCancellation] CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return GetAllAsAsyncEnumerable(
|
||||||
var enumerable = base.GetAllAsAsyncEnumerable(
|
fillMessages: false,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
await foreach (var dto in enumerable)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
if (cancellationToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
yield break;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: dto,
|
|
||||||
destination: dto,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
yield return dto;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -371,28 +251,13 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await FindOneAsync(
|
||||||
var result = await base.FindOneAsync(
|
fillMessages: false,
|
||||||
predicate: predicate,
|
predicate: predicate,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -412,29 +277,14 @@ namespace xAiModels.Providers.Dtos
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
return await FindManyAsync(
|
||||||
var result = await base.FindManyAsync(
|
fillMessages: false,
|
||||||
predicate: predicate,
|
predicate: predicate,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichRangeAsync(
|
|
||||||
sources: result,
|
|
||||||
destinations: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -455,6 +305,471 @@ namespace xAiModels.Providers.Dtos
|
|||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
return await QueryAsync(
|
||||||
|
query: query,
|
||||||
|
fillMessages: false,
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
|
);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Actions ...
|
||||||
|
//
|
||||||
|
#region Add ...
|
||||||
|
/// <summary>
|
||||||
|
/// add a new Dto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> AddAsync(
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.AddAsync(
|
||||||
|
item: item,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// add or update a Dto (add if not exists/update if exists) ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> AddOrUpdateAsync(
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.AddAsync(
|
||||||
|
item: item,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Update ...
|
||||||
|
/// <summary>
|
||||||
|
/// Update an Dto values ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> UpdateAsync(
|
||||||
|
Guid id,
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.UpdateAsync(
|
||||||
|
id: id,
|
||||||
|
item: item,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Remove ...
|
||||||
|
/// <summary>
|
||||||
|
/// remove an Dto by it's Id ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="softDelete"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> RemoveAsync(
|
||||||
|
Guid id,
|
||||||
|
bool softDelete = true,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.RemoveAsync(
|
||||||
|
id: id,
|
||||||
|
softDelete: softDelete,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// remove an Dto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="softDelete"></param>
|
||||||
|
/// <param name="saveChanges"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> RemoveAsync(
|
||||||
|
XAiConversationDto item,
|
||||||
|
bool softDelete = true,
|
||||||
|
bool saveChanges = true,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.RemoveAsync(
|
||||||
|
item: item,
|
||||||
|
softDelete: softDelete,
|
||||||
|
saveChanges: saveChanges,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Retrieve ...
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve an Dto by it's Id ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> GetAsync(
|
||||||
|
Guid id,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.GetAsync(
|
||||||
|
id: id,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve all exists Dtos ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XAiConversationDto>> GetAllAsync(
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.GetAllAsync(
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichRangeAsync(
|
||||||
|
sources: result,
|
||||||
|
destinations: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve all exists Dtos
|
||||||
|
/// as Async Enumerable ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async IAsyncEnumerable<XAiConversationDto> GetAllAsAsyncEnumerable(
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
[EnumeratorCancellation] CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var enumerable = base.GetAllAsAsyncEnumerable(
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
|
);
|
||||||
|
await foreach (var dto in enumerable)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: dto,
|
||||||
|
destination: dto,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
yield return dto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// find an Dto by providing a Conditional Expression ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiConversationDto> FindOneAsync(
|
||||||
|
Expression<Func<XAiConversation, bool>> predicate,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.FindOneAsync(
|
||||||
|
predicate: predicate,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichAsync(
|
||||||
|
source: result,
|
||||||
|
destination: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// find a collection of Dtos by proving a Conditional Expression ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XAiConversationDto>> FindManyAsync(
|
||||||
|
Expression<Func<XAiConversation, bool>> predicate,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = await base.FindManyAsync(
|
||||||
|
predicate: predicate,
|
||||||
|
orderBuilder: orderBuilder,
|
||||||
|
includeBuilder: includeBuilder,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Do Enrichment if result Exists ...
|
||||||
|
if (!result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await enricher.EnrichRangeAsync(
|
||||||
|
sources: result,
|
||||||
|
destinations: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// retrieve Dtos based on XQuery Pagination structure ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
|
/// <param name="predicate"></param>
|
||||||
|
/// <param name="orderBuilder"></param>
|
||||||
|
/// <param name="includeBuilder"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XQueryResult<XAiConversationDto>> QueryAsync(
|
||||||
|
XQuery query,
|
||||||
|
bool ignoreSoftDeleteds = true,
|
||||||
|
Expression<Func<XAiConversation, bool>> predicate = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
||||||
|
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
||||||
|
bool fillMessages = true,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.QueryAsync(
|
var result = await base.QueryAsync(
|
||||||
@@ -474,6 +789,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
await enricher.EnrichRangeAsync(
|
await enricher.EnrichRangeAsync(
|
||||||
sources: result.Items,
|
sources: result.Items,
|
||||||
destinations: result.Items,
|
destinations: result.Items,
|
||||||
|
fillMessages: fillMessages,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
item: item,
|
item: item,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -79,6 +80,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
item: item,
|
item: item,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -106,6 +108,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
item: item,
|
item: item,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -133,6 +136,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
softDelete: softDelete,
|
softDelete: softDelete,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -157,6 +161,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
softDelete: softDelete,
|
softDelete: softDelete,
|
||||||
saveChanges: saveChanges,
|
saveChanges: saveChanges,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -183,6 +188,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
id: id,
|
id: id,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
@@ -207,6 +213,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
@@ -232,6 +239,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
@@ -256,6 +264,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
predicate: predicate,
|
predicate: predicate,
|
||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
@@ -283,6 +292,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
fillConversations: false,
|
fillConversations: false,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
@@ -310,8 +320,10 @@ namespace xAiModels.Providers.Dtos
|
|||||||
return await QueryAsync(
|
return await QueryAsync(
|
||||||
query: query,
|
query: query,
|
||||||
predicate: predicate,
|
predicate: predicate,
|
||||||
|
fillConversations: false,
|
||||||
orderBuilder: orderBuilder,
|
orderBuilder: orderBuilder,
|
||||||
includeBuilder: includeBuilder,
|
includeBuilder: includeBuilder,
|
||||||
|
fillConversationMessages: false,
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
ignoreSoftDeleteds: ignoreSoftDeleteds
|
||||||
);
|
);
|
||||||
@@ -329,12 +341,14 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> AddAsync(
|
public virtual async Task<XAiProjectDto> AddAsync(
|
||||||
XAiProjectDto item,
|
XAiProjectDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -354,7 +368,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,12 +383,14 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> AddOrUpdateAsync(
|
public virtual async Task<XAiProjectDto> AddOrUpdateAsync(
|
||||||
XAiProjectDto item,
|
XAiProjectDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -393,7 +410,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,6 +429,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> UpdateAsync(
|
public virtual async Task<XAiProjectDto> UpdateAsync(
|
||||||
@@ -418,6 +437,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
XAiProjectDto item,
|
XAiProjectDto item,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -438,7 +458,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,6 +477,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="softDelete"></param>
|
/// <param name="softDelete"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> RemoveAsync(
|
public virtual async Task<XAiProjectDto> RemoveAsync(
|
||||||
@@ -463,6 +485,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
bool softDelete = false,
|
bool softDelete = false,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -483,7 +506,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,6 +522,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="softDelete"></param>
|
/// <param name="softDelete"></param>
|
||||||
/// <param name="saveChanges"></param>
|
/// <param name="saveChanges"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> RemoveAsync(
|
public virtual async Task<XAiProjectDto> RemoveAsync(
|
||||||
@@ -505,6 +530,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
bool softDelete = false,
|
bool softDelete = false,
|
||||||
bool saveChanges = true,
|
bool saveChanges = true,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -525,7 +551,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,6 +570,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> GetAsync(
|
public virtual async Task<XAiProjectDto> GetAsync(
|
||||||
@@ -550,6 +578,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -570,7 +599,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -585,6 +615,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<IEnumerable<XAiProjectDto>> GetAllAsync(
|
public virtual async Task<IEnumerable<XAiProjectDto>> GetAllAsync(
|
||||||
@@ -592,6 +623,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -612,7 +644,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
sources: result,
|
sources: result,
|
||||||
destinations: result,
|
destinations: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -628,6 +661,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async IAsyncEnumerable<XAiProjectDto> GetAllAsAsyncEnumerable(
|
public virtual async IAsyncEnumerable<XAiProjectDto> GetAllAsAsyncEnumerable(
|
||||||
@@ -635,6 +669,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
[EnumeratorCancellation] CancellationToken cancellationToken = default
|
[EnumeratorCancellation] CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -657,7 +692,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: dto,
|
source: dto,
|
||||||
destination: dto,
|
destination: dto,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
yield return dto;
|
yield return dto;
|
||||||
}
|
}
|
||||||
@@ -670,6 +706,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="ignoreSoftDeleteds"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiProjectDto> FindOneAsync(
|
public virtual async Task<XAiProjectDto> FindOneAsync(
|
||||||
@@ -677,6 +714,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
bool ignoreSoftDeleteds = true,
|
bool ignoreSoftDeleteds = true,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -697,7 +735,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
source: result,
|
source: result,
|
||||||
destination: result,
|
destination: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,6 +752,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<IEnumerable<XAiProjectDto>> FindManyAsync(
|
public virtual async Task<IEnumerable<XAiProjectDto>> FindManyAsync(
|
||||||
@@ -721,6 +761,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -742,7 +783,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
sources: result,
|
sources: result,
|
||||||
destinations: result,
|
destinations: result,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -759,6 +801,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
/// <param name="orderBuilder"></param>
|
/// <param name="orderBuilder"></param>
|
||||||
/// <param name="includeBuilder"></param>
|
/// <param name="includeBuilder"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XQueryResult<XAiProjectDto>> QueryAsync(
|
public virtual async Task<XQueryResult<XAiProjectDto>> QueryAsync(
|
||||||
@@ -768,6 +811,7 @@ namespace xAiModels.Providers.Dtos
|
|||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -790,7 +834,8 @@ namespace xAiModels.Providers.Dtos
|
|||||||
sources: result.Items,
|
sources: result.Items,
|
||||||
destinations: result.Items,
|
destinations: result.Items,
|
||||||
fillConversations: fillConversations,
|
fillConversations: fillConversations,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,16 +17,19 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
public class XAiConversationEnricher : IXAiConversationEnricher
|
public class XAiConversationEnricher : IXAiConversationEnricher
|
||||||
{
|
{
|
||||||
private readonly IXIdentityProvider identityProvider;
|
private readonly IXIdentityProvider identityProvider;
|
||||||
|
private readonly IXAiMessageRepositoryService messageRepositoryService;
|
||||||
private readonly IXAiProjectRepositoryService projectRepositoryService;
|
private readonly IXAiProjectRepositoryService projectRepositoryService;
|
||||||
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
|
|
||||||
public XAiConversationEnricher(
|
public XAiConversationEnricher(
|
||||||
IXIdentityProvider identityProvider,
|
IXIdentityProvider identityProvider,
|
||||||
|
IXAiMessageRepositoryService messageRepositoryService,
|
||||||
IXAiProjectRepositoryService projectRepositoryService,
|
IXAiProjectRepositoryService projectRepositoryService,
|
||||||
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.identityProvider = identityProvider;
|
this.identityProvider = identityProvider;
|
||||||
|
this.messageRepositoryService = messageRepositoryService;
|
||||||
this.projectRepositoryService = projectRepositoryService;
|
this.projectRepositoryService = projectRepositoryService;
|
||||||
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
}
|
}
|
||||||
@@ -43,16 +46,70 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
XAiConversationDto destination,
|
XAiConversationDto destination,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
|
{
|
||||||
|
await EnrichAsync(
|
||||||
|
source: source,
|
||||||
|
fillMessages: false,
|
||||||
|
destination: destination,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a Collection of Entities to Dtos ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="destinations"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task EnrichRangeAsync(
|
||||||
|
IEnumerable<XAiConversationDto> sources,
|
||||||
|
IEnumerable<XAiConversationDto> destinations,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
await EnrichRangeAsync(
|
||||||
|
sources: sources,
|
||||||
|
fillMessages: false,
|
||||||
|
destinations: destinations,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a Signle Entity to Dto ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="destination"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task EnrichAsync(
|
||||||
|
XAiConversationDto source,
|
||||||
|
XAiConversationDto destination,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Run independent async operations concurrently
|
// Run independent async operations concurrently
|
||||||
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
||||||
var projectTask = ResolveProjectAsync(source.ProjectId, cancellationToken);
|
var projectTask = ResolveProjectAsync(source.ProjectId, cancellationToken);
|
||||||
var titleLocalesTask = ResolveTitleLocalesAsync(source.Title, cancellationToken);
|
var titleLocalesTask = ResolveTitleLocalesAsync(source.Title, cancellationToken);
|
||||||
|
var messagesTask = ResolveMessagesAsync(source.Id, cancellationToken);
|
||||||
|
|
||||||
//
|
//
|
||||||
// wait until All Tasks Resolved ...
|
// wait until All Tasks Resolved ...
|
||||||
await Task.WhenAll(ownerTask, titleLocalesTask, projectTask);
|
Task[] tasks = [
|
||||||
|
ownerTask,
|
||||||
|
projectTask,
|
||||||
|
titleLocalesTask
|
||||||
|
];
|
||||||
|
if (fillMessages)
|
||||||
|
{
|
||||||
|
tasks = [.. tasks, messagesTask];
|
||||||
|
}
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Attached Resolved Info to Destination ...
|
// Attached Resolved Info to Destination ...
|
||||||
@@ -66,6 +123,10 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
destination.ProjectTitleResource = project.TitleResource;
|
destination.ProjectTitleResource = project.TitleResource;
|
||||||
destination.ProjectDescriptionResource = project.DescriptionResource;
|
destination.ProjectDescriptionResource = project.DescriptionResource;
|
||||||
}
|
}
|
||||||
|
if (!messagesTask.Result.IsNull())
|
||||||
|
{
|
||||||
|
destination.Messages = [.. messagesTask.Result];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,11 +134,13 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sources"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="destinations"></param>
|
/// <param name="destinations"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task EnrichRangeAsync(
|
public async Task EnrichRangeAsync(
|
||||||
IEnumerable<XAiConversationDto> sources,
|
IEnumerable<XAiConversationDto> sources,
|
||||||
IEnumerable<XAiConversationDto> destinations,
|
IEnumerable<XAiConversationDto> destinations,
|
||||||
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -185,6 +248,37 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Specified Conversation Messages ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="conversationId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<IEnumerable<XAiMessageDto>> ResolveMessagesAsync(
|
||||||
|
Guid conversationId,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = new List<XAiMessageDto>();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (conversationId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = [.. await messageRepositoryService.FindManyAsync(
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
orderBuilder: x => x.OrderBy(y => y.CreatedOn),
|
||||||
|
predicate: x => x.ConversationId == conversationId
|
||||||
|
)];
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -52,14 +52,19 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
XAiProjectDto source,
|
XAiProjectDto source,
|
||||||
XAiProjectDto destination,
|
XAiProjectDto destination,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Run independent async operations concurrently
|
// Run independent async operations concurrently
|
||||||
|
var conversationsTask = ResolveConversationsAsync(
|
||||||
|
source.Id,
|
||||||
|
fillConversationMessages,
|
||||||
|
cancellationToken
|
||||||
|
);
|
||||||
var titleTask = ResolveTitleAsync(source.Title, cancellationToken);
|
var titleTask = ResolveTitleAsync(source.Title, cancellationToken);
|
||||||
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
||||||
var conversationsTask = ResolveConversationsAsync(source.Id, cancellationToken);
|
|
||||||
var descriptionTask = ResolveDescriptionAsync(source.Description, cancellationToken);
|
var descriptionTask = ResolveDescriptionAsync(source.Description, cancellationToken);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -107,13 +112,20 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
IEnumerable<XAiProjectDto> sources,
|
IEnumerable<XAiProjectDto> sources,
|
||||||
IEnumerable<XAiProjectDto> destinations,
|
IEnumerable<XAiProjectDto> destinations,
|
||||||
bool fillConversations = true,
|
bool fillConversations = true,
|
||||||
|
bool fillConversationMessages = true,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Make Tasks Ready ...
|
// Make Tasks Ready ...
|
||||||
var tasks = sources.Zip(destinations, (src, dst) =>
|
var tasks = sources.Zip(destinations, (src, dst) =>
|
||||||
EnrichAsync(src, dst, fillConversations, cancellationToken)
|
EnrichAsync(
|
||||||
|
source: src,
|
||||||
|
destination: dst,
|
||||||
|
fillConversations: fillConversations,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -224,10 +236,12 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
/// Retrieve Project Conversations ...
|
/// Retrieve Project Conversations ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="projectId"></param>
|
/// <param name="projectId"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<List<XAiConversationDto>> ResolveConversationsAsync(
|
private async Task<List<XAiConversationDto>> ResolveConversationsAsync(
|
||||||
Guid projectId,
|
Guid projectId,
|
||||||
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@@ -248,6 +262,7 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
orderBuilder: null,
|
orderBuilder: null,
|
||||||
includeBuilder: null,
|
includeBuilder: null,
|
||||||
ignoreSoftDeleteds: true,
|
ignoreSoftDeleteds: true,
|
||||||
|
fillMessages: fillMessages,
|
||||||
predicate: x => x.Id == projectId,
|
predicate: x => x.Id == projectId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,271 @@
|
|||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xPushService.Base;
|
||||||
|
|
||||||
|
namespace xAiModels.Providers.Hubs
|
||||||
|
{
|
||||||
|
public class XAiDataProviderHub : XBaseHub
|
||||||
|
{
|
||||||
|
public XAiDataProviderHub(
|
||||||
|
ILogger<XBaseHub> logger
|
||||||
|
) : base(logger)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
//
|
||||||
|
#region XAiProject ...
|
||||||
|
/// <summary>
|
||||||
|
/// Notify a New Item Created ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notify an Item Removed ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notify an Item Updated ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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 XAiConversation ...
|
||||||
|
/// <summary>
|
||||||
|
/// Notify a New Item Created ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notify an Item Removed ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notify an Item Updated ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
|
||||||
|
//
|
||||||
|
#region XAiMessage ...
|
||||||
|
/// <summary>
|
||||||
|
/// Notify a New Item Created ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notify an Item Removed ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notify an Item Updated ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="item"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
+495
-32
@@ -1,9 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using xAiModels.Constants;
|
||||||
using xAiModels.Interfaces;
|
using xAiModels.Interfaces;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xAiModels.Interfaces.Dtos;
|
||||||
using xAiModels.Providers.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Providers.Entities;
|
using xAiModels.Providers.Hubs;
|
||||||
|
using xCommons.Configurations;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xExceptions.Constants;
|
||||||
|
using xModels.Dtos;
|
||||||
|
using xStringService.Interfaces;
|
||||||
|
|
||||||
namespace xAiModels.Providers
|
namespace xAiModels.Providers
|
||||||
{
|
{
|
||||||
@@ -12,44 +21,35 @@ namespace xAiModels.Providers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class XAiDataProvider : IXAiDataProvider
|
public class XAiDataProvider : IXAiDataProvider
|
||||||
{
|
{
|
||||||
private readonly IHubContext<XAiMessageDtoHub> messageDtoHub;
|
private readonly IXStringProvider stringProvider;
|
||||||
private readonly IHubContext<XAiProjectDtoHub> projectDtoHub;
|
private readonly XAppConfiguration appConfiguration;
|
||||||
private readonly IXAiMessageRepository messageRepositoryService;
|
private readonly IHubContext<XAiDataProviderHub> hub;
|
||||||
private readonly IXAiProjectRepository projectRepositoryService;
|
private readonly IXAiMessageRepositoryService messageRepositoryService;
|
||||||
private readonly IHubContext<XAiMessageEntityHub> messageEntityHub;
|
private readonly IXAiProjectRepositoryService projectRepositoryService;
|
||||||
private readonly IHubContext<XAiProjectEntityHub> projectEntityHub;
|
|
||||||
private readonly IXAiConversationRepository conversationRepository;
|
|
||||||
private readonly IHubContext<XAiConversationDtoHub> conversationDtoHub;
|
|
||||||
private readonly IHubContext<XAiConversationEntityHub> conversationEntityHub;
|
|
||||||
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
||||||
|
private readonly IXAiConversationRepositoryService conversationRepositoryService;
|
||||||
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
||||||
|
|
||||||
public XAiDataProvider(
|
public XAiDataProvider(
|
||||||
IHubContext<XAiMessageDtoHub> messageDtoHub,
|
IXStringProvider stringProvider,
|
||||||
IHubContext<XAiProjectDtoHub> projectDtoHub,
|
XAppConfiguration appConfiguration,
|
||||||
IXAiMessageRepository messageRepositoryService,
|
IHubContext<XAiDataProviderHub> hub,
|
||||||
IXAiProjectRepository projectRepositoryService,
|
IXAiMessageRepositoryService messageRepositoryService,
|
||||||
IHubContext<XAiMessageEntityHub> messageEntityHub,
|
IXAiProjectRepositoryService projectRepositoryService,
|
||||||
IHubContext<XAiProjectEntityHub> projectEntityHub,
|
|
||||||
IXAiConversationRepository conversationRepository,
|
|
||||||
IHubContext<XAiConversationDtoHub> conversationDtoHub,
|
|
||||||
IHubContext<XAiConversationEntityHub> conversationEntityHub,
|
|
||||||
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
||||||
|
IXAiConversationRepositoryService conversationRepositoryService,
|
||||||
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
|
||||||
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.messageDtoHub = messageDtoHub;
|
this.hub = hub;
|
||||||
this.projectDtoHub = projectDtoHub;
|
this.stringProvider = stringProvider;
|
||||||
this.projectEntityHub = projectEntityHub;
|
this.appConfiguration = appConfiguration;
|
||||||
this.messageEntityHub = messageEntityHub;
|
|
||||||
this.conversationDtoHub = conversationDtoHub;
|
|
||||||
this.conversationEntityHub = conversationEntityHub;
|
|
||||||
this.conversationRepository = conversationRepository;
|
|
||||||
this.messageRepositoryService = messageRepositoryService;
|
this.messageRepositoryService = messageRepositoryService;
|
||||||
this.projectRepositoryService = projectRepositoryService;
|
this.projectRepositoryService = projectRepositoryService;
|
||||||
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
||||||
|
this.conversationRepositoryService = conversationRepositoryService;
|
||||||
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
||||||
}
|
}
|
||||||
@@ -61,18 +61,481 @@ namespace xAiModels.Providers
|
|||||||
//
|
//
|
||||||
#region Private ...
|
#region Private ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle Default Project for Specified Owner ...
|
/// Check Default Project Exists or not ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task HandleDefaultProject(string ownerId) { }
|
private async Task<bool> HasDefaultProject(
|
||||||
|
string ownerId,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
var result = !ownerId.IsNullOrEmpty();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Default Owner Exists or not ...
|
||||||
|
result = !(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)
|
||||||
|
))
|
||||||
|
.IsNullOrDefault();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handle Default Project's Default Conversation for Specified Owner ...
|
/// Retrieve Default Project of Specified Owner ...
|
||||||
|
/// Create it if not Handled ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task HandleDefaultConversation(string ownerId) { }
|
private async Task<XAiProjectDto> 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)
|
||||||
|
);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create Default Project for Specified Owner ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
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()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Default Conversation Exists or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<bool> HasDefaultConversation(
|
||||||
|
string ownerId,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
var result = !ownerId.IsNullOrEmpty();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Default Owner Exists or not ...
|
||||||
|
result = !(await stringProvider.FindOne(
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
predicate: x =>
|
||||||
|
x.ResourceTitle
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(ownerId.ToNormalString()) &&
|
||||||
|
x.ResourceTitle
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(XAiModelsConstants.XAiConversationTitleIdentifier
|
||||||
|
.ToNormalString()) &&
|
||||||
|
x.TranslatedValue
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(XAiDataProviderConstants.XDefaultAiConversationSuffix)
|
||||||
|
))
|
||||||
|
.IsNullOrDefault();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check Default Conversation Exists or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task CreateDefaultConversation(
|
||||||
|
string ownerId,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
var isValid = !ownerId.IsNullOrEmpty();
|
||||||
|
if (!isValid)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var defaultLang = appConfiguration.DefaultLanguage;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Default Project ...
|
||||||
|
var project = await GetDefaultProject(
|
||||||
|
ownerId: ownerId,
|
||||||
|
connectionId: connectionId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check Default Owner Exists or not ...
|
||||||
|
isValid = await HasDefaultConversation(
|
||||||
|
ownerId: ownerId,
|
||||||
|
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()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Default Conversation of Specified Owner ...
|
||||||
|
/// Create it if not Handled ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
private async Task<XAiConversationDto> GetDefaultConversation(
|
||||||
|
string ownerId,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Check Default Conversation Exists or noit ...
|
||||||
|
var isExists = await HasDefaultConversation(
|
||||||
|
ownerId: ownerId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!isExists)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
await CreateDefaultConversation(
|
||||||
|
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)
|
||||||
|
);
|
||||||
|
if (resource.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await conversationRepositoryService.FindOneAsync(
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
predicate: x => x.Title
|
||||||
|
.Equals(
|
||||||
|
resource.ResourceTitle,
|
||||||
|
StringComparison.InvariantCultureIgnoreCase
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if (result.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send Custom Push Message ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="action"></param>
|
||||||
|
/// <param name="payLoad"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task SendPush(
|
||||||
|
string action,
|
||||||
|
string payLoad,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Collect Allowed Actions ...
|
||||||
|
var actions = new List<string>
|
||||||
|
{
|
||||||
|
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 { }
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user