Compare commits
20
Commits
73fb9a01b8
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26df2c7ebc | ||
|
|
755eafa7d2 | ||
|
|
47b2cbc0d2 | ||
|
|
f48b9257a3 | ||
|
|
5d3601ba44 | ||
|
|
33922537d5 | ||
|
|
8e23a09f7b | ||
|
|
2aa0607e85 | ||
|
|
a4dee3b5a4 | ||
|
|
9f27b7825e | ||
|
|
eb27e9ce1f | ||
|
|
490058d1a8 | ||
|
|
f9b5f1f6aa | ||
|
|
a9b75b3c33 | ||
|
|
88607a9e4d | ||
|
|
7ef56fbc1e | ||
|
|
7f47c449e7 | ||
|
|
89b848709f | ||
|
|
54883b760b | ||
|
|
337899ba85 |
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using xAiModels.Constants;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
|
||||||
|
|
||||||
namespace xAiModels.Configurations.Entities
|
namespace xAiModels.Configurations.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using xAiModels.Constants;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
|
||||||
|
|
||||||
namespace xAiModels.Configurations.Entities
|
namespace xAiModels.Configurations.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||||
using xAiModels.Constants;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
|
||||||
|
|
||||||
namespace xAiModels.Configurations.Entities
|
namespace xAiModels.Configurations.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using xAiModels.Constants;
|
|
||||||
using xAiModels.Models;
|
using xAiModels.Models;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
|
||||||
namespace xAiModels.Configurations
|
namespace xAiModels.Configurations
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace xAiModels.Constants
|
|||||||
public enum XAiModelProviderType
|
public enum XAiModelProviderType
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
OpenAI,
|
||||||
Ollama,
|
Ollama,
|
||||||
DeepSeek,
|
DeepSeek,
|
||||||
HuggingFace
|
HuggingFace
|
||||||
|
|||||||
+20
-14
@@ -1,25 +1,25 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using xAiModels.Providers.Dtos;
|
|
||||||
using xAiModels.Providers.Entities;
|
|
||||||
using xCommons.Extensions;
|
|
||||||
using xDataService.Constants;
|
|
||||||
using xDataService.Db;
|
using xDataService.Db;
|
||||||
using xDataService.Models;
|
|
||||||
using xExceptions.Constants;
|
|
||||||
using xPushService.Helpers;
|
|
||||||
using xPushService.DI;
|
using xPushService.DI;
|
||||||
using xDataService.DI;
|
using xDataService.DI;
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Helpers;
|
|
||||||
using xCommons.Helpers;
|
using xCommons.Helpers;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xAiModels.Helpers;
|
||||||
using xAiModels.Interfaces;
|
using xDataService.Models;
|
||||||
using xAiModels.Providers;
|
using xAiModels.Providers;
|
||||||
using xAiModels.Constants;
|
using xAiModels.Constants;
|
||||||
using xAiModels.Interfaces.Enrichers;
|
using xCommons.Extensions;
|
||||||
|
using xPushService.Helpers;
|
||||||
|
using xAiModels.Interfaces;
|
||||||
|
using xExceptions.Constants;
|
||||||
|
using xDataService.Constants;
|
||||||
|
using xAiModels.Providers.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using xAiModels.Providers.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
using xAiModels.Providers.Enrichers;
|
using xAiModels.Providers.Enrichers;
|
||||||
|
using xAiModels.Interfaces.Enrichers;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace xAiModels.DI
|
namespace xAiModels.DI
|
||||||
{
|
{
|
||||||
@@ -495,6 +495,12 @@ namespace xAiModels.DI
|
|||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
// Data Provider ...
|
||||||
|
services.Add(
|
||||||
|
new ServiceDescriptor(typeof(IXAiDataProvider), typeof(XAiDataProvider), lifeTime)
|
||||||
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
Log("Service Regitration Succeed ...");
|
Log("Service Regitration Succeed ...");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using Microsoft.Extensions.AI;
|
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using Microsoft.Extensions.AI;
|
||||||
|
|
||||||
namespace xAiModels.Extensions
|
namespace xAiModels.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using Microsoft.Extensions.AI;
|
|
||||||
using xAiModels.Constants;
|
using xAiModels.Constants;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using Microsoft.Extensions.AI;
|
||||||
|
|
||||||
namespace xAiModels.Extensions
|
namespace xAiModels.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using xAiModels.Configurations;
|
|
||||||
using xAiModels.Models;
|
using xAiModels.Models;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Configurations;
|
||||||
|
|
||||||
namespace xAiModels.Extensions
|
namespace xAiModels.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
using xAiModels.Models.Dtos;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
using System.Linq;
|
||||||
|
using xAiModels.Models;
|
||||||
|
using xModels.Extensions;
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using xExceptions.Constants;
|
||||||
|
using Microsoft.Extensions.AI;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Extensions
|
namespace xAiModels.Extensions
|
||||||
{
|
{
|
||||||
@@ -20,7 +28,6 @@ namespace xAiModels.Extensions
|
|||||||
var result =
|
var result =
|
||||||
!source.IsNullOrDefault() &&
|
!source.IsNullOrDefault() &&
|
||||||
!source.OwnerId.IsNullOrEmpty() &&
|
!source.OwnerId.IsNullOrEmpty() &&
|
||||||
!source.Title.IsNullOrEmpty() &&
|
|
||||||
!source.Prompt.IsNullOrEmpty();
|
!source.Prompt.IsNullOrEmpty();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -32,7 +39,6 @@ namespace xAiModels.Extensions
|
|||||||
var result =
|
var result =
|
||||||
!source.IsNullOrDefault() &&
|
!source.IsNullOrDefault() &&
|
||||||
!source.OwnerId.IsNullOrEmpty() &&
|
!source.OwnerId.IsNullOrEmpty() &&
|
||||||
!source.Title.IsNullOrEmpty() &&
|
|
||||||
!source.Prompt.IsNullOrEmpty();
|
!source.Prompt.IsNullOrEmpty();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -50,7 +56,6 @@ namespace xAiModels.Extensions
|
|||||||
var result =
|
var result =
|
||||||
!source.IsNullOrDefault() &&
|
!source.IsNullOrDefault() &&
|
||||||
!source.OwnerId.IsNullOrEmpty() &&
|
!source.OwnerId.IsNullOrEmpty() &&
|
||||||
!source.Title.IsNullOrEmpty() &&
|
|
||||||
!source.ProjectId.IsNull() &&
|
!source.ProjectId.IsNull() &&
|
||||||
!source.ProjectId.IsDefaultGuid();
|
!source.ProjectId.IsDefaultGuid();
|
||||||
|
|
||||||
@@ -63,7 +68,6 @@ namespace xAiModels.Extensions
|
|||||||
var result =
|
var result =
|
||||||
!source.IsNullOrDefault() &&
|
!source.IsNullOrDefault() &&
|
||||||
!source.OwnerId.IsNullOrEmpty() &&
|
!source.OwnerId.IsNullOrEmpty() &&
|
||||||
!source.Title.IsNullOrEmpty() &&
|
|
||||||
!source.ProjectId.IsNull() &&
|
!source.ProjectId.IsNull() &&
|
||||||
!source.ProjectId.IsDefaultGuid();
|
!source.ProjectId.IsDefaultGuid();
|
||||||
|
|
||||||
@@ -104,5 +108,359 @@ namespace xAiModels.Extensions
|
|||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate a Model Descriptor ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsValid(this XAiModelDescriptor source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
!source.IsNullOrDefault() &&
|
||||||
|
!source.Name.IsNullOrEmpty() &&
|
||||||
|
!source.Url.IsNullOrEmpty() &&
|
||||||
|
source.Url.IsValidUrl() &&
|
||||||
|
!source.LLM.IsNullOrEmpty() &&
|
||||||
|
source.Provider != Constants.XAiModelProviderType.None;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate Specified Param ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsValid(this XAiPromptParam source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
!source.IsNullOrDefault() &&
|
||||||
|
!source.Name.IsNullOrEmpty() &&
|
||||||
|
!source.Param.IsNullOrEmpty();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate Specified Prompt ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsValid(this XAiPromptDescriptor source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
!source.IsNullOrDefault() &&
|
||||||
|
!source.Name.IsNullOrEmpty() &&
|
||||||
|
!source.Template.IsNullOrEmpty();
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
if (source.Params.HasChild())
|
||||||
|
{
|
||||||
|
result =
|
||||||
|
result &&
|
||||||
|
source.Params.All(x => x.IsValid());
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate a Request for Retrieve Response in Controllers ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsValid(this XAiResponseRequest source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
!source.IsNullOrDefault() &&
|
||||||
|
!source.Prompt.IsNullOrEmpty();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Validate a File Extraction Result ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool IsValid(this XFileExtractionResult source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result =
|
||||||
|
!source.IsNullOrDefault() &&
|
||||||
|
(
|
||||||
|
source.Images.HasChild() ||
|
||||||
|
!source.Text.IsNullOrEmpty() ||
|
||||||
|
!source.AudioTranscript.IsNullOrEmpty()
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a File Extraction Result to AI Contents ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static IList<AIContent> ToAIContents(this XFileExtractionResult source)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var result = new List<AIContent>();
|
||||||
|
|
||||||
|
//
|
||||||
|
if (source.IsValid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Main Text ...
|
||||||
|
if (!source.Text.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
result.Add(new TextContent(source.Text));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Images ...
|
||||||
|
if (source.Images.HasChild())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
foreach (var img in source.Images)
|
||||||
|
{
|
||||||
|
result.Add(new DataContent(img.Bytes, img.MimeType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Transcripted Audio ...
|
||||||
|
if (!source.AudioTranscript.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
result.Add(new TextContent($"[Audio Transcript]\n{source.AudioTranscript}"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check a Collection Contains Default Project for Specified Owner or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasDefaultProject(
|
||||||
|
this IEnumerable<XAiProjectDto> source,
|
||||||
|
string ownerId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (source.HasChild() ||
|
||||||
|
ownerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var item = source
|
||||||
|
.FirstOrDefault(x =>
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(ownerId.ToNormalString()) &&
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(XAiModelsConstants.DefaultXAiProjectDescriptionResourceID.ToNormalString())
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = !item.IsNullOrDefault();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check a Collection Contains Default Conversation for Specified Project or not ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="projectId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static bool HasDefaultConversation(
|
||||||
|
this IEnumerable<XAiConversationDto> source,
|
||||||
|
string ownerId,
|
||||||
|
Guid projectId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (source.HasChild() ||
|
||||||
|
projectId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var item = source
|
||||||
|
.FirstOrDefault(x =>
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(ownerId.ToNormalString()) &&
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(projectId.ToString().ToNormalString()) &&
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(XAiModelsConstants.DefaultXAiConversationTitleResourceID)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = !item.IsNullOrDefault();
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Default Project Id from a Collection ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Guid GetDafualtProject(
|
||||||
|
this IEnumerable<XAiProjectDto> source,
|
||||||
|
string ownerId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (!source.HasChild() ||
|
||||||
|
ownerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var item = source
|
||||||
|
.FirstOrDefault(x =>
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(ownerId.ToNormalString()) &&
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(XAiModelsConstants.XAiProjectTitleIdentifier.ToNormalString())
|
||||||
|
);
|
||||||
|
if (item.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return item.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get Default Conversation Id from a Collection Contains ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="projectId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Guid GetDefaultConversation(
|
||||||
|
this IEnumerable<XAiConversationDto> source,
|
||||||
|
string ownerId,
|
||||||
|
Guid projectId
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Validate Args ...
|
||||||
|
if (!source.HasChild() ||
|
||||||
|
ownerId.IsNullOrEmpty() ||
|
||||||
|
projectId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
XException.InvalidArgs.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var item = source
|
||||||
|
.FirstOrDefault(x =>
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(ownerId.ToNormalString()) &&
|
||||||
|
x.Title
|
||||||
|
.ToNormalString()
|
||||||
|
.Contains(XAiModelsConstants.XAiConversationTitleIdentifier.ToNormalString())
|
||||||
|
);
|
||||||
|
if (item.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
XException.NotFound.Throw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = item.Id;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a Message Dto to ChatMessage ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="additionalContents"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static ChatMessage ToChatMessages(
|
||||||
|
this XAiMessageDto source,
|
||||||
|
IList<AIContent> additionalContents = null
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
ChatMessage result = null;
|
||||||
|
|
||||||
|
//
|
||||||
|
if (!source.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var contents = new List<AIContent>
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Add Source Content ...
|
||||||
|
new TextContent(source.Content)
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// Add Additional Content ...
|
||||||
|
if (additionalContents.HasChild())
|
||||||
|
{
|
||||||
|
contents.AddRange(additionalContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
result = new ChatMessage
|
||||||
|
{
|
||||||
|
Contents = contents,
|
||||||
|
AuthorName =
|
||||||
|
source.Role == XAiChatRole.User &&
|
||||||
|
!source.Owner.IsNullOrDefault()
|
||||||
|
? source.Owner.GetFullname()
|
||||||
|
: string.Empty,
|
||||||
|
Role = source.Role.ToChatRole(),
|
||||||
|
MessageId = source.Id.ToString(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using GraphQL.Types;
|
using GraphQL.Types;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xAiModels.Providers.Entities;
|
|
||||||
using xAiModels.Providers.GraphQL;
|
|
||||||
using xDataService.Db;
|
using xDataService.Db;
|
||||||
using xDataService.Models;
|
using xDataService.Models;
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Providers.GraphQL;
|
||||||
|
using xAiModels.Providers.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Helpers
|
namespace xAiModels.Helpers
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,222 +1,68 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using System.Threading.Tasks;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xModels.Dtos;
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
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 Enrichers ...
|
||||||
//
|
|
||||||
#region Add ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add a new Dto ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiConversationDto> AddAsync(
|
Task<XAiConversationDto> Enrich(
|
||||||
XAiConversationDto item,
|
XAiConversation source,
|
||||||
bool saveChanges = true,
|
bool fillMessages = false,
|
||||||
bool fillMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add or update a Dto (add if not exists/update if exists) ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiConversationDto> AddOrUpdateAsync(
|
Task<XAiConversationDto> Enrich(
|
||||||
XAiConversationDto item,
|
XAiConversationDto source,
|
||||||
bool saveChanges = true,
|
bool fillMessages = false,
|
||||||
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
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// remove an Dto ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiConversationDto> RemoveAsync(
|
Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
XAiConversationDto item,
|
IEnumerable<XAiConversation> sources,
|
||||||
bool softDelete = false,
|
bool fillMessages = 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
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve all exists Dtos ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XAiConversationDto>> GetAllAsync(
|
Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
bool ignoreSoftDeleteds = true,
|
IEnumerable<XAiConversationDto> sources,
|
||||||
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
bool fillMessages = false,
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
|
||||||
bool fillMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
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
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xAiModels.Providers.Dtos;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Providers.Dtos;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,60 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using System.Threading.Tasks;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
public interface IXAiMessageRepositoryService : IXBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>
|
public interface IXAiMessageRepositoryService : IXBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>
|
||||||
{ }
|
{
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiMessageDto> Enrich(
|
||||||
|
XAiMessage source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiMessageDto> Enrich(
|
||||||
|
XAiMessageDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessage> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessageDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xAiModels.Providers.Dtos;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Providers.Dtos;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,244 +1,76 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using System.Threading.Tasks;
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
using xModels.Dtos;
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
public interface IXAiProjectRepositoryService : IXBaseRepositoryService<XAiProject, XAiProjectDto, Guid>
|
public interface IXAiProjectRepositoryService : IXBaseRepositoryService<XAiProject, XAiProjectDto, Guid>
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
#region Actions ...
|
#region Enrichers ...
|
||||||
//
|
|
||||||
#region Add ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add a new Dto ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
/// <param name="fillConversationMessages"></param>
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> AddAsync(
|
Task<XAiProjectDto> Enrich(
|
||||||
XAiProjectDto item,
|
XAiProject source,
|
||||||
bool saveChanges = true,
|
bool fillConversations = false,
|
||||||
bool fillConversations = true,
|
bool fillConversationMessages = false,
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add or update a Dto (add if not exists/update if exists) ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
/// <param name="fillConversationMessages"></param>
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> AddOrUpdateAsync(
|
Task<XAiProjectDto> Enrich(
|
||||||
XAiProjectDto item,
|
XAiProjectDto source,
|
||||||
bool saveChanges = true,
|
bool fillConversations = false,
|
||||||
bool fillConversations = true,
|
bool fillConversationMessages = false,
|
||||||
bool fillConversationMessages = 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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<XAiProjectDto> UpdateAsync(
|
|
||||||
Guid id,
|
|
||||||
XAiProjectDto item,
|
|
||||||
bool saveChanges = true,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = 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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<XAiProjectDto> RemoveAsync(
|
|
||||||
Guid id,
|
|
||||||
bool softDelete = false,
|
|
||||||
bool saveChanges = true,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// remove an Dto ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
/// <param name="fillConversationMessages"></param>
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiProjectDto> RemoveAsync(
|
Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
XAiProjectDto item,
|
IEnumerable<XAiProject> sources,
|
||||||
bool softDelete = false,
|
bool fillConversations = false,
|
||||||
bool saveChanges = true,
|
bool fillConversationMessages = false,
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = 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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<XAiProjectDto> GetAsync(
|
|
||||||
Guid id,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve all exists Dtos ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
/// <param name="fillConversationMessages"></param>
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XAiProjectDto>> GetAllAsync(
|
Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
bool ignoreSoftDeleteds = true,
|
IEnumerable<XAiProjectDto> sources,
|
||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
bool fillConversations = false,
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
bool fillConversationMessages = false,
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
IAsyncEnumerable<XAiProjectDto> GetAllAsAsyncEnumerable(
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = 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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<XAiProjectDto> FindOneAsync(
|
|
||||||
Expression<Func<XAiProject, bool>> predicate,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = 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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<IEnumerable<XAiProjectDto>> FindManyAsync(
|
|
||||||
Expression<Func<XAiProject, bool>> predicate,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = 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="fillConversations"></param>
|
|
||||||
/// <param name="fillConversationMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<XQueryResult<XAiProjectDto>> QueryAsync(
|
|
||||||
XQuery query,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Expression<Func<XAiProject, bool>> predicate = null,
|
|
||||||
Func<IQueryable<XAiProject>, IOrderedQueryable<XAiProject>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiProject>, IIncludableQueryable<XAiProject, object>> includeBuilder = null,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
);
|
|
||||||
#endregion
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xAiModels.Providers.Dtos;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Providers.Dtos;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Dtos
|
namespace xAiModels.Interfaces.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,44 +1,69 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xDataService.Interfaces;
|
using System.Threading.Tasks;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Enrichers
|
namespace xAiModels.Interfaces.Enrichers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ai Conversation Enricher ...
|
/// Ai Conversation Enricher ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IXAiConversationEnricher : IXBaseEnricher<XAiConversationDto, XAiConversationDto>
|
public interface IXAiConversationEnricher
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a Signle Entity to Dto ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="source"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="destination"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task EnrichAsync(
|
Task<XAiConversationDto> Enrich(
|
||||||
XAiConversationDto source,
|
XAiConversation source,
|
||||||
XAiConversationDto destination,
|
|
||||||
bool fillMessages = false,
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a Collection of Entities to Dtos ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sources"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="destinations"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task EnrichRangeAsync(
|
Task<XAiConversationDto> Enrich(
|
||||||
IEnumerable<XAiConversationDto> sources,
|
XAiConversationDto source,
|
||||||
IEnumerable<XAiConversationDto> destinations,
|
|
||||||
bool fillMessages = false,
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiConversation> sources,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiConversationDto> sources,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,58 @@
|
|||||||
|
using System.Threading;
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xDataService.Interfaces;
|
using System.Threading.Tasks;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Enrichers
|
namespace xAiModels.Interfaces.Enrichers
|
||||||
{
|
{
|
||||||
public interface IXAiMessageEnricher : IXBaseEnricher<XAiMessageDto, XAiMessageDto>
|
public interface IXAiMessageEnricher
|
||||||
{ }
|
{
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiMessageDto> Enrich(
|
||||||
|
XAiMessage source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiMessageDto> Enrich(
|
||||||
|
XAiMessageDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessage> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessageDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,28 +1,74 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
using xDataService.Interfaces;
|
using System.Threading.Tasks;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Enrichers
|
namespace xAiModels.Interfaces.Enrichers
|
||||||
{
|
{
|
||||||
public interface IXAiProjectEnricher : IXBaseEnricher<XAiProjectDto, XAiProjectDto>
|
public interface IXAiProjectEnricher
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiProjectDto> Enrich(
|
||||||
|
XAiProject source,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
Task EnrichAsync(
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiProjectDto> Enrich(
|
||||||
XAiProjectDto source,
|
XAiProjectDto source,
|
||||||
XAiProjectDto destination,
|
bool fillConversations = false,
|
||||||
bool fillConversations = true,
|
bool fillConversationMessages = false,
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
Task EnrichRangeAsync(
|
/// <summary>
|
||||||
IEnumerable<XAiProjectDto> sources,
|
/// Enrich Specified Items ...
|
||||||
IEnumerable<XAiProjectDto> destinations,
|
/// </summary>
|
||||||
bool fillConversations = true,
|
/// <param name="sources"></param>
|
||||||
bool fillConversationMessages = true,
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiProject> sources,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiProjectDto> sources,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xPushService.Interfaces;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xAiModels.Providers.Entities;
|
using xAiModels.Providers.Entities;
|
||||||
using xPushService.Interfaces;
|
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace xAiModels.Interfaces.Entities
|
||||||
|
{
|
||||||
|
public interface IXAiDocumentEntityHub
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xPushService.Interfaces;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xAiModels.Providers.Entities;
|
using xAiModels.Providers.Entities;
|
||||||
using xPushService.Interfaces;
|
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Interfaces;
|
using xPushService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xPushService.Interfaces;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xAiModels.Providers.Entities;
|
using xAiModels.Providers.Entities;
|
||||||
using xPushService.Interfaces;
|
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Interfaces;
|
using xDataService.Interfaces;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces.Entities
|
namespace xAiModels.Interfaces.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using xModels.Dtos;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Interfaces
|
namespace xAiModels.Interfaces
|
||||||
{
|
{
|
||||||
@@ -11,18 +12,51 @@ namespace xAiModels.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IXAiDataProvider
|
public interface IXAiDataProvider
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
#region Getters ...
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Specified Project ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiProjectDto> GetProject(
|
||||||
|
Guid id,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Specified Conversation ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> GetConversation(
|
||||||
|
Guid id,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Loaders ...
|
#region Loaders ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load Projects List of Specified Owner ...
|
/// Load Projects List of Specified Owner ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="fillConversations"></param>
|
/// <param name="fillConversations"></param>
|
||||||
/// <param name="fillConversationMessages"></param>
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XAiProjectDto>> LoadProjects(
|
Task<IEnumerable<XAiProjectDto>> LoadProjects(
|
||||||
string ownerId,
|
string ownerId,
|
||||||
|
string connectionId = null,
|
||||||
bool fillConversations = false,
|
bool fillConversations = false,
|
||||||
bool fillConversationMessages = false,
|
bool fillConversationMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
@@ -33,11 +67,13 @@ namespace xAiModels.Interfaces
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="projectId"></param>
|
/// <param name="projectId"></param>
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<IEnumerable<XAiConversationDto>> LoadConversations(
|
Task<IEnumerable<XAiConversationDto>> LoadConversations(
|
||||||
Guid projectId,
|
Guid projectId,
|
||||||
bool fillMessages = false,
|
bool fillMessages = false,
|
||||||
|
string connectionId = null,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -53,6 +89,120 @@ namespace xAiModels.Interfaces
|
|||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Enrichers ...
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiProjectDto> Enrich(
|
||||||
|
XAiProjectDto source,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiProjectDto> sources,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> Enrich(
|
||||||
|
XAiConversationDto source,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiConversationDto> sources,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiMessageDto> Enrich(
|
||||||
|
XAiMessageDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessageDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Defaults ...
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Default Project of Specified Owner ...
|
||||||
|
/// Create it if not Handled ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiProjectDto> GetDefaultProject(
|
||||||
|
string ownerId,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve Default Conversation of Specified Owner ...
|
||||||
|
/// Create it if not Handled ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="projectId"></param>
|
||||||
|
/// <param name="connectionId"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XAiConversationDto> GetDefaultConversation(
|
||||||
|
string ownerId,
|
||||||
|
Guid projectId,
|
||||||
|
string connectionId = null,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Creator/Adders ...
|
#region Creator/Adders ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,12 +223,14 @@ namespace xAiModels.Interfaces
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create Conversation ...
|
/// Create Conversation ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
/// <param name="projectId"></param>
|
/// <param name="projectId"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="connectionId"></param>
|
/// <param name="connectionId"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<XAiConversationDto> CreateConversation(
|
Task<XAiConversationDto> CreateConversation(
|
||||||
|
string ownerId,
|
||||||
Guid projectId,
|
Guid projectId,
|
||||||
XAiConversationDto item = null,
|
XAiConversationDto item = null,
|
||||||
string connectionId = null,
|
string connectionId = null,
|
||||||
@@ -100,5 +252,51 @@ namespace xAiModels.Interfaces
|
|||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
);
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
//
|
||||||
|
#region Query ...
|
||||||
|
/// <summary>
|
||||||
|
/// Query Projects ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XQueryResult<XAiProjectDto>> QueryProjects(
|
||||||
|
string ownerId,
|
||||||
|
XQuery query,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Query Conversations ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="projectId"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XQueryResult<XAiConversationDto>> QueryConversations(
|
||||||
|
string ownerId,
|
||||||
|
Guid projectId,
|
||||||
|
XQuery query,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Query Messages ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ownerId"></param>
|
||||||
|
/// <param name="conversationId"></param>
|
||||||
|
/// <param name="query"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<XQueryResult<XAiMessageDto>> QueryMessages(
|
||||||
|
string ownerId,
|
||||||
|
Guid conversationId,
|
||||||
|
XQuery query,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
);
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using xModels.Base;
|
using xModels.Base;
|
||||||
using xModels.Dtos;
|
using xModels.Dtos;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Models.Dtos
|
namespace xAiModels.Models.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using xAiModels.Constants;
|
|
||||||
using xCommons.Extensions;
|
|
||||||
using xModels.Base;
|
using xModels.Base;
|
||||||
using xModels.Dtos;
|
using xModels.Dtos;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace xAiModels.Models.Dtos
|
namespace xAiModels.Models.Dtos
|
||||||
{
|
{
|
||||||
@@ -65,7 +65,7 @@ namespace xAiModels.Models.Dtos
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Meta Data of MEssage in Json ...
|
/// Meta Data of MEssage in Json ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MeatDatas
|
public string MetaDatas
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
get => _metadata;
|
get => _metadata;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using xModels.Base;
|
using xModels.Base;
|
||||||
using xModels.Dtos;
|
using xModels.Dtos;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace xAiModels.Models.Dtos
|
namespace xAiModels.Models.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using xModels.Base;
|
using xModels.Base;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace xAiModels.Models.Entities
|
namespace xAiModels.Models.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using xModels.Base;
|
||||||
|
|
||||||
|
namespace xAiModels.Models.Entities
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents an embedd document in the AI system.
|
||||||
|
/// </summary>
|
||||||
|
public class XAiDocument : XBaseGuidIDEntity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// User Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
/// <value></value>
|
||||||
|
[Required]
|
||||||
|
[StringLength(255)]
|
||||||
|
public string OwnerId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Title of Document ...
|
||||||
|
/// </summary>
|
||||||
|
[StringLength(255)]
|
||||||
|
public string Title { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Content of Document ...
|
||||||
|
/// </summary>
|
||||||
|
public string Content { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Hash of the Document Content ...
|
||||||
|
/// </summary>
|
||||||
|
public string ContentHash { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Embedding Model Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
public string EmbeddingModel { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dimensions of the Embedding ...
|
||||||
|
/// </summary>
|
||||||
|
public int Dimensions { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Vector representation of the Document ...
|
||||||
|
/// </summary>
|
||||||
|
public byte[] Vector { get; set; } = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Created Time ...
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreatedOn { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Updated Time ...
|
||||||
|
/// </summary>
|
||||||
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xModels.Base;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
using xCommons.Extensions;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using xAiModels.Constants;
|
|
||||||
using xCommons.Extensions;
|
|
||||||
using xModels.Base;
|
|
||||||
|
|
||||||
namespace xAiModels.Models.Entities
|
namespace xAiModels.Models.Entities
|
||||||
{
|
{
|
||||||
@@ -61,7 +61,7 @@ namespace xAiModels.Models.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Meta Data of MEssage in Json ...
|
/// Meta Data of MEssage in Json ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string MeatDatas
|
public string MetaDatas
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
get => _metadata;
|
get => _metadata;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using xModels.Base;
|
using xModels.Base;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace xAiModels.Models.Entities
|
namespace xAiModels.Models.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
namespace xAiModels.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Describe Specified Prompt ...
|
||||||
|
/// </summary>
|
||||||
|
public class XAiPromptDescriptor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Name ...
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Template ...
|
||||||
|
/// </summary>
|
||||||
|
public string Template { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Description ...
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Template Params ...
|
||||||
|
/// </summary>
|
||||||
|
public XAiPromptParam[] Params { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specified a Prompt Param ...
|
||||||
|
/// </summary>
|
||||||
|
public class XAiPromptParam
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Param Name ...
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Param Identifier ...
|
||||||
|
/// </summary>
|
||||||
|
public string Param { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parma Description ...
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using xModels.Base;
|
||||||
|
using xAiModels.Constants;
|
||||||
|
|
||||||
|
namespace xAiModels.Models
|
||||||
|
{
|
||||||
|
public class XAiResonseMessage : XBaseDto
|
||||||
|
{
|
||||||
|
public long Sequence { get; set; }
|
||||||
|
public Guid RespondTo { get; set; }
|
||||||
|
public string OwnerId { get; set; }
|
||||||
|
public string Content { get; set; }
|
||||||
|
public XAiChatRole Role { get; set; }
|
||||||
|
public DateTime RespondedOn { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace xAiModels.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// /Request for a Response in Controllers ...
|
||||||
|
/// </summary>
|
||||||
|
public class XAiResponseRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Prompt Text ...
|
||||||
|
/// </summary>
|
||||||
|
public string Prompt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specified Project Id ...
|
||||||
|
/// </summary>
|
||||||
|
public Guid ProjectId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specified Conversation Id ...
|
||||||
|
/// </summary>
|
||||||
|
public Guid ConversationId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace xAiModels.Models
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Holds File Extraction Result ...
|
||||||
|
/// </summary>
|
||||||
|
public class XFileExtractionResult
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Extracted String Content ...
|
||||||
|
/// </summary>
|
||||||
|
public string Text { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracted Images for Vision Model ...
|
||||||
|
/// </summary>
|
||||||
|
public IList<XExtractedImage> Images { get; set; } = [];
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracted Content from Audio File ...
|
||||||
|
/// </summary>
|
||||||
|
public string AudioTranscript { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main File Name ...
|
||||||
|
/// </summary>
|
||||||
|
public string FileName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Main File MIME Type ...
|
||||||
|
/// </summary>
|
||||||
|
public string MimeType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Specified Fallback done using Images or not ...
|
||||||
|
/// </summary>
|
||||||
|
public bool UsedImageFallback { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Error Message ...
|
||||||
|
/// </summary>
|
||||||
|
public string ErrorMessage { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Extracted Image ...
|
||||||
|
/// </summary>
|
||||||
|
public class XExtractedImage
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Content as Byte ...
|
||||||
|
/// </summary>
|
||||||
|
public byte[] Bytes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// MIME Type of Image ...
|
||||||
|
/// </summary>
|
||||||
|
public string MimeType { get; set; } = "image/png";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// for PDF Files ...
|
||||||
|
/// </summary>
|
||||||
|
public int? PageNumber { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Describe Image ...
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Base;
|
using xPushService.Base;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,30 +1,36 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using xModels.Dtos;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Interfaces;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
using xDataService.Providers;
|
||||||
using xAiModels.Configurations;
|
using xAiModels.Configurations;
|
||||||
using xAiModels.Interfaces.Dtos;
|
using xAiModels.Interfaces.Dtos;
|
||||||
using xAiModels.Interfaces.Enrichers;
|
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xCommons.Extensions;
|
using System.Collections.Generic;
|
||||||
using xDataService.Providers;
|
using xIdentityService.Interfaces;
|
||||||
using xModels.Dtos;
|
using xIdentityService.Extensions;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
public class XAiConversationRepositoryService : XBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>, IXAiConversationRepositoryService
|
public class XAiConversationRepositoryService : XBaseRepositoryService<XAiConversation, XAiConversationDto, Guid>, IXAiConversationRepositoryService
|
||||||
{
|
{
|
||||||
private readonly IXAiConversationEnricher enricher;
|
private readonly IXIdentityProvider identityProvider;
|
||||||
|
private readonly IXAiConversationRepository repository;
|
||||||
|
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
||||||
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
|
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
||||||
|
|
||||||
public XAiConversationRepositoryService(
|
public XAiConversationRepositoryService(
|
||||||
IXAiConversationEnricher enricher,
|
IXIdentityProvider identityProvider,
|
||||||
IXAiConversationRepository repository
|
IXAiConversationRepository repository,
|
||||||
|
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
||||||
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
|
||||||
|
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
||||||
) : base(
|
) : base(
|
||||||
repository,
|
repository,
|
||||||
mapperProfiles:
|
mapperProfiles:
|
||||||
@@ -33,771 +39,169 @@ namespace xAiModels.Providers.Dtos
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.enricher = enricher;
|
this.repository = repository;
|
||||||
|
this.identityProvider = identityProvider;
|
||||||
|
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
||||||
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
|
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Actions ...
|
#region Enrichers ...
|
||||||
//
|
|
||||||
#region Add ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add a new Dto ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> AddAsync(
|
|
||||||
XAiConversationDto item,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await AddAsync(
|
|
||||||
item: item,
|
|
||||||
fillMessages: false,
|
|
||||||
saveChanges: saveChanges,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// add or update a Dto (add if not exists/update if exists) ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> AddOrUpdateAsync(
|
|
||||||
XAiConversationDto item,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await AddOrUpdateAsync(
|
|
||||||
item: item,
|
|
||||||
fillMessages: false,
|
|
||||||
saveChanges: saveChanges,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
|
||||||
#region Update ...
|
|
||||||
/// <summary>
|
|
||||||
/// Update an Dto values ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> UpdateAsync(
|
|
||||||
Guid id,
|
|
||||||
XAiConversationDto item,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await UpdateAsync(
|
|
||||||
id: id,
|
|
||||||
item: item,
|
|
||||||
fillMessages: false,
|
|
||||||
saveChanges: saveChanges,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> RemoveAsync(
|
|
||||||
Guid id,
|
|
||||||
bool softDelete = true,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await RemoveAsync(
|
|
||||||
id: id,
|
|
||||||
fillMessages: false,
|
|
||||||
softDelete: softDelete,
|
|
||||||
saveChanges: saveChanges,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// remove an Dto ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> RemoveAsync(
|
|
||||||
XAiConversationDto item,
|
|
||||||
bool softDelete = true,
|
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await RemoveAsync(
|
|
||||||
item: item,
|
|
||||||
fillMessages: false,
|
|
||||||
softDelete: softDelete,
|
|
||||||
saveChanges: saveChanges,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
#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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> GetAsync(
|
|
||||||
Guid id,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await GetAsync(
|
|
||||||
id: id,
|
|
||||||
fillMessages: false,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// retrieve all exists Dtos ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<IEnumerable<XAiConversationDto>> GetAllAsync(
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await GetAllAsync(
|
|
||||||
fillMessages: false,
|
|
||||||
orderBuilder: orderBuilder,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// retrieve all exists Dtos
|
|
||||||
/// as Async Enumerable ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override IAsyncEnumerable<XAiConversationDto> GetAllAsAsyncEnumerable(
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiConversation>, IOrderedQueryable<XAiConversation>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return GetAllAsAsyncEnumerable(
|
|
||||||
fillMessages: false,
|
|
||||||
orderBuilder: orderBuilder,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// find an Dto by providing a Conditional Expression ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="predicate"></param>
|
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiConversationDto> FindOneAsync(
|
|
||||||
Expression<Func<XAiConversation, bool>> predicate,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await FindOneAsync(
|
|
||||||
fillMessages: false,
|
|
||||||
predicate: predicate,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override 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,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return await FindManyAsync(
|
|
||||||
fillMessages: false,
|
|
||||||
predicate: predicate,
|
|
||||||
orderBuilder: orderBuilder,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override 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,
|
|
||||||
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="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiConversationDto> AddAsync(
|
public virtual async Task<XAiConversationDto> Enrich(
|
||||||
XAiConversationDto item,
|
XAiConversation source,
|
||||||
bool saveChanges = true,
|
bool fillMessages = false,
|
||||||
bool fillMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.AddAsync(
|
// Mapping Default ...
|
||||||
item: item,
|
var result = Mapper.Map<XAiConversationDto>(source);
|
||||||
saveChanges: saveChanges,
|
result = await Enrich(
|
||||||
|
source: result,
|
||||||
|
fillMessages: fillMessages,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
fillMessages: fillMessages,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add or update a Dto (add if not exists/update if exists) ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiConversationDto> AddOrUpdateAsync(
|
public virtual async Task<XAiConversationDto> Enrich(
|
||||||
XAiConversationDto item,
|
XAiConversationDto source,
|
||||||
bool saveChanges = true,
|
bool fillMessages = false,
|
||||||
bool fillMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.AddAsync(
|
// Handdle Owner ...
|
||||||
item: item,
|
XPersonDto owner = null;
|
||||||
saveChanges: saveChanges,
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await enricher.EnrichAsync(
|
// Try to Retrieve User Info ...
|
||||||
source: result,
|
var device = identityProvider.GetDevice();
|
||||||
destination: result,
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
fillMessages: fillMessages,
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Title Resource ...
|
||||||
|
XResourceDto titleResource = null;
|
||||||
|
if (!source.Title.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
titleResource = await conversationTitleResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.Id,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
// Handle Project Info ...
|
||||||
}
|
XResourceDto projectTitleResource = null;
|
||||||
#endregion
|
XResourceDto projectDescriptionResource = null;
|
||||||
|
if (!source.ProjectId.IsDefaultGuid())
|
||||||
//
|
|
||||||
#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(
|
projectTitleResource = await projectTitleResourceProvider.GetResource(
|
||||||
source: result,
|
owner: source.OwnerId,
|
||||||
destination: result,
|
identifier: source.ProjectId,
|
||||||
fillMessages: fillMessages,
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
projectDescriptionResource = await projectDescriptionResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.ProjectId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
// Attach Extracted Items ...
|
||||||
}
|
var result = Mapper.Map<XAiConversationDto>(source, options =>
|
||||||
#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(
|
options.Items[nameof(source.Owner)] = owner;
|
||||||
source: result,
|
options.Items[nameof(source.TitleResource)] = titleResource;
|
||||||
destination: result,
|
options.Items[nameof(source.ProjectTitleResource)] = projectTitleResource;
|
||||||
fillMessages: fillMessages,
|
options.Items[nameof(source.ProjectDescriptionResource)] = projectDescriptionResource;
|
||||||
cancellationToken: cancellationToken
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// remove an Dto ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiConversationDto> RemoveAsync(
|
public virtual async Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
XAiConversationDto item,
|
IEnumerable<XAiConversation> sources,
|
||||||
bool softDelete = true,
|
bool fillMessages = false,
|
||||||
bool saveChanges = true,
|
|
||||||
bool fillMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.RemoveAsync(
|
var tasks = sources
|
||||||
item: item,
|
.Select(x => Enrich(
|
||||||
softDelete: softDelete,
|
source: x,
|
||||||
saveChanges: saveChanges,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
fillMessages: fillMessages,
|
fillMessages: fillMessages,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
));
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
//
|
|
||||||
#region Retrieve ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve an Dto by it's Id ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual async Task<XAiConversationDto> GetAsync(
|
public virtual async Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
Guid id,
|
IEnumerable<XAiConversationDto> sources,
|
||||||
bool ignoreSoftDeleteds = true,
|
bool fillMessages = false,
|
||||||
Func<IQueryable<XAiConversation>, IIncludableQueryable<XAiConversation, object>> includeBuilder = null,
|
|
||||||
bool fillMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.GetAsync(
|
var tasks = sources
|
||||||
id: id,
|
.Select(x => Enrich(
|
||||||
includeBuilder: includeBuilder,
|
source: x,
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
fillMessages: fillMessages,
|
fillMessages: fillMessages,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
));
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
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(
|
|
||||||
query: query,
|
|
||||||
predicate: predicate,
|
|
||||||
orderBuilder: orderBuilder,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichRangeAsync(
|
|
||||||
sources: result.Items,
|
|
||||||
destinations: result.Items,
|
|
||||||
fillMessages: fillMessages,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using xPushService.Base;
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xPushService.Base;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Base;
|
using xPushService.Base;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,30 +1,31 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using xModels.Dtos;
|
||||||
using System.Runtime.CompilerServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Interfaces;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
using xDataService.Providers;
|
||||||
using xAiModels.Configurations;
|
using xAiModels.Configurations;
|
||||||
using xAiModels.Interfaces.Dtos;
|
using xAiModels.Interfaces.Dtos;
|
||||||
using xAiModels.Interfaces.Enrichers;
|
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xCommons.Extensions;
|
using System.Collections.Generic;
|
||||||
using xDataService.Providers;
|
using xIdentityService.Interfaces;
|
||||||
using xModels.Dtos;
|
using xIdentityService.Extensions;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
public class XAiMessageRepositoryService : XBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>, IXAiMessageRepositoryService
|
public class XAiMessageRepositoryService : XBaseRepositoryService<XAiMessage, XAiMessageDto, Guid>, IXAiMessageRepositoryService
|
||||||
{
|
{
|
||||||
private readonly IXAiMessageEnricher enricher;
|
private readonly IXIdentityProvider identityProvider;
|
||||||
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
|
|
||||||
public XAiMessageRepositoryService(
|
public XAiMessageRepositoryService(
|
||||||
IXAiMessageEnricher enricher,
|
IXAiMessageRepository repository,
|
||||||
IXAiMessageRepository repository
|
IXIdentityProvider identityProvider,
|
||||||
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
|
||||||
) : base(
|
) : base(
|
||||||
repository,
|
repository,
|
||||||
mapperProfiles:
|
mapperProfiles:
|
||||||
@@ -33,455 +34,132 @@ namespace xAiModels.Providers.Dtos
|
|||||||
]
|
]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.enricher = enricher;
|
this.identityProvider = identityProvider;
|
||||||
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Actions ...
|
#region Enrichers ...
|
||||||
//
|
|
||||||
#region Add ...
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add a new Dto ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override async Task<XAiMessageDto> AddAsync(
|
public virtual async Task<XAiMessageDto> Enrich(
|
||||||
XAiMessageDto item,
|
XAiMessage source,
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.AddAsync(
|
// Mapping Default ...
|
||||||
item: item,
|
var result = Mapper.Map<XAiMessageDto>(source);
|
||||||
saveChanges: saveChanges,
|
result = await Enrich(
|
||||||
|
source: result,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: result,
|
|
||||||
destination: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// add or update a Dto (add if not exists/update if exists) ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override async Task<XAiMessageDto> AddOrUpdateAsync(
|
public virtual async Task<XAiMessageDto> Enrich(
|
||||||
XAiMessageDto item,
|
XAiMessageDto source,
|
||||||
bool saveChanges = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.AddAsync(
|
// Handdle Owner ...
|
||||||
item: item,
|
XPersonDto owner = null;
|
||||||
saveChanges: saveChanges,
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await enricher.EnrichAsync(
|
// Try to Retrieve User Info ...
|
||||||
source: result,
|
var device = identityProvider.GetDevice();
|
||||||
destination: result,
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
cancellationToken: cancellationToken
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
);
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
// Hanlde Conversation Title ...
|
||||||
}
|
string conversationTitle = string.Empty;
|
||||||
#endregion
|
XResourceDto conversationTitleResource = null;
|
||||||
|
if (!source.ConversationId.IsDefaultGuid())
|
||||||
//
|
|
||||||
#region Update ...
|
|
||||||
/// <summary>
|
|
||||||
/// Update an Dto values ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="id"></param>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiMessageDto> UpdateAsync(
|
|
||||||
Guid id,
|
|
||||||
XAiMessageDto item,
|
|
||||||
bool saveChanges = 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(
|
conversationTitleResource = await conversationTitleResourceProvider.GetResource(
|
||||||
source: result,
|
owner: source.OwnerId,
|
||||||
destination: result,
|
identifier: source.ConversationId,
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
}
|
if (!conversationTitleResource.IsNullOrDefault())
|
||||||
|
|
||||||
//
|
|
||||||
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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiMessageDto> RemoveAsync(
|
|
||||||
Guid id,
|
|
||||||
bool softDelete = true,
|
|
||||||
bool saveChanges = 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,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// remove an Dto ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item"></param>
|
|
||||||
/// <param name="softDelete"></param>
|
|
||||||
/// <param name="saveChanges"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiMessageDto> RemoveAsync(
|
|
||||||
XAiMessageDto item,
|
|
||||||
bool softDelete = true,
|
|
||||||
bool saveChanges = 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,
|
|
||||||
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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiMessageDto> GetAsync(
|
|
||||||
Guid id,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiMessage>, IIncludableQueryable<XAiMessage, object>> includeBuilder = null,
|
|
||||||
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,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// retrieve all exists Dtos ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<IEnumerable<XAiMessageDto>> GetAllAsync(
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiMessage>, IOrderedQueryable<XAiMessage>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiMessage>, IIncludableQueryable<XAiMessage, object>> includeBuilder = null,
|
|
||||||
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,
|
|
||||||
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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async IAsyncEnumerable<XAiMessageDto> GetAllAsAsyncEnumerable(
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiMessage>, IOrderedQueryable<XAiMessage>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiMessage>, IIncludableQueryable<XAiMessage, object>> includeBuilder = null,
|
|
||||||
[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;
|
conversationTitle = conversationTitleResource.Resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
await enricher.EnrichAsync(
|
|
||||||
source: dto,
|
|
||||||
destination: dto,
|
|
||||||
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="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public override async Task<XAiMessageDto> FindOneAsync(
|
|
||||||
Expression<Func<XAiMessage, bool>> predicate,
|
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiMessage>, IIncludableQueryable<XAiMessage, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
var result = await base.FindOneAsync(
|
|
||||||
predicate: predicate,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Do Enrichment if result Exists ...
|
// Attach Extracted Items ...
|
||||||
if (!result.IsNullOrDefault())
|
var result = Mapper.Map<XAiMessageDto>(source, options =>
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
await enricher.EnrichAsync(
|
options.Items[nameof(source.Owner)] = owner;
|
||||||
source: result,
|
options.Items[nameof(source.ConversationTitle)] = conversationTitle;
|
||||||
destination: result,
|
options.Items[nameof(source.ConversationTitleResouce)] = conversationTitleResource;
|
||||||
cancellationToken: cancellationToken
|
});
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// find a collection of Dtos by proving a Conditional Expression ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="predicate"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override async Task<IEnumerable<XAiMessageDto>> FindManyAsync(
|
public virtual async Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
Expression<Func<XAiMessage, bool>> predicate,
|
IEnumerable<XAiMessage> sources,
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Func<IQueryable<XAiMessage>, IOrderedQueryable<XAiMessage>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiMessage>, IIncludableQueryable<XAiMessage, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.FindManyAsync(
|
var tasks = sources
|
||||||
predicate: predicate,
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
orderBuilder: orderBuilder,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichRangeAsync(
|
|
||||||
sources: result,
|
|
||||||
destinations: result,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// retrieve Dtos based on XQuery Pagination structure ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="query"></param>
|
/// <param name="sources"></param>
|
||||||
/// <param name="ignoreSoftDeleteds"></param>
|
|
||||||
/// <param name="predicate"></param>
|
|
||||||
/// <param name="orderBuilder"></param>
|
|
||||||
/// <param name="includeBuilder"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public override async Task<XQueryResult<XAiMessageDto>> QueryAsync(
|
public virtual async Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
XQuery query,
|
IEnumerable<XAiMessageDto> sources,
|
||||||
bool ignoreSoftDeleteds = true,
|
|
||||||
Expression<Func<XAiMessage, bool>> predicate = null,
|
|
||||||
Func<IQueryable<XAiMessage>, IOrderedQueryable<XAiMessage>> orderBuilder = null,
|
|
||||||
Func<IQueryable<XAiMessage>, IIncludableQueryable<XAiMessage, object>> includeBuilder = null,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = await base.QueryAsync(
|
var tasks = sources
|
||||||
query: query,
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
predicate: predicate,
|
|
||||||
orderBuilder: orderBuilder,
|
|
||||||
includeBuilder: includeBuilder,
|
|
||||||
cancellationToken: cancellationToken,
|
|
||||||
ignoreSoftDeleteds: ignoreSoftDeleteds
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Do Enrichment if result Exists ...
|
|
||||||
if (!result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
await enricher.EnrichRangeAsync(
|
|
||||||
sources: result.Items,
|
|
||||||
destinations: result.Items,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using xPushService.Base;
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xPushService.Base;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Base;
|
using xPushService.Base;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,11 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using xPushService.Base;
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Models.Dtos;
|
using xAiModels.Models.Dtos;
|
||||||
|
using xAiModels.Interfaces.Dtos;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xPushService.Base;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Dtos
|
namespace xAiModels.Providers.Dtos
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,217 +1,64 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using xModels.Dtos;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Interfaces;
|
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
using xAiModels.Interfaces.Enrichers;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Interfaces;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xIdentityService.Extensions;
|
using xIdentityService.Extensions;
|
||||||
using xModels.Dtos;
|
using xAiModels.Interfaces.Entities;
|
||||||
using System.Linq;
|
using xAiModels.Interfaces.Enrichers;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Enrichers
|
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 IXAiConversationRepository repository;
|
||||||
private readonly IXAiProjectRepositoryService projectRepositoryService;
|
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
||||||
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
|
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
||||||
|
|
||||||
public XAiConversationEnricher(
|
public XAiConversationEnricher(
|
||||||
IXIdentityProvider identityProvider,
|
IXIdentityProvider identityProvider,
|
||||||
IXAiMessageRepositoryService messageRepositoryService,
|
IXAiConversationRepository repository,
|
||||||
IXAiProjectRepositoryService projectRepositoryService,
|
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
||||||
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
|
||||||
|
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
|
this.repository = repository;
|
||||||
this.identityProvider = identityProvider;
|
this.identityProvider = identityProvider;
|
||||||
this.messageRepositoryService = messageRepositoryService;
|
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
||||||
this.projectRepositoryService = projectRepositoryService;
|
|
||||||
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
}
|
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Converts a Signle Entity to Dto ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="source"></param>
|
|
||||||
/// <param name="destination"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task EnrichAsync(
|
|
||||||
XAiConversationDto source,
|
|
||||||
XAiConversationDto destination,
|
|
||||||
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
|
|
||||||
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
|
||||||
var projectTask = ResolveProjectAsync(source.ProjectId, cancellationToken);
|
|
||||||
var titleLocalesTask = ResolveTitleLocalesAsync(source.Title, cancellationToken);
|
|
||||||
var messagesTask = ResolveMessagesAsync(source.Id, cancellationToken);
|
|
||||||
|
|
||||||
//
|
|
||||||
// wait until All Tasks Resolved ...
|
|
||||||
Task[] tasks = [
|
|
||||||
ownerTask,
|
|
||||||
projectTask,
|
|
||||||
titleLocalesTask
|
|
||||||
];
|
|
||||||
if (fillMessages)
|
|
||||||
{
|
|
||||||
tasks = [.. tasks, messagesTask];
|
|
||||||
}
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Attached Resolved Info to Destination ...
|
|
||||||
destination.Owner = ownerTask.Result;
|
|
||||||
destination.TitleResource = titleLocalesTask.Result;
|
|
||||||
var project = projectTask.Result;
|
|
||||||
if (!project.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
destination.ProjectTitle = project.Title;
|
|
||||||
destination.ProjectDescription = project.Description;
|
|
||||||
destination.ProjectTitleResource = project.TitleResource;
|
|
||||||
destination.ProjectDescriptionResource = project.DescriptionResource;
|
|
||||||
}
|
|
||||||
if (!messagesTask.Result.IsNull())
|
|
||||||
{
|
|
||||||
destination.Messages = [.. messagesTask.Result];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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>
|
|
||||||
public async Task EnrichRangeAsync(
|
|
||||||
IEnumerable<XAiConversationDto> sources,
|
|
||||||
IEnumerable<XAiConversationDto> destinations,
|
|
||||||
bool fillMessages = false,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Make Tasks Ready ...
|
|
||||||
var tasks = sources.Zip(destinations, (src, dst) =>
|
|
||||||
EnrichAsync(src, dst, cancellationToken)
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Private ...
|
#region Enrichers ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reading Owner User Info ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<XPersonDto> ResolveOwnerAsync(
|
public virtual async Task<XAiConversationDto> Enrich(
|
||||||
string ownerId,
|
XAiConversation source,
|
||||||
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XPersonDto result = null;
|
// Mapping Default ...
|
||||||
|
var result = source.MapConvert<XAiConversationDto, XAiConversation>();
|
||||||
//
|
result = await Enrich(
|
||||||
// Validate ...
|
source: result,
|
||||||
if (ownerId.IsNullOrEmpty())
|
fillMessages: fillMessages,
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Try to Retrieve User Info ...
|
|
||||||
var device = identityProvider.GetDevice();
|
|
||||||
var userInfo = await identityProvider.GetUserInfo(
|
|
||||||
device: device,
|
|
||||||
userSelectByParam: ownerId
|
|
||||||
);
|
|
||||||
result = userInfo.ToXPersonDto();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reading Title Locales ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="title"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task<XResourceDto> ResolveTitleLocalesAsync(
|
|
||||||
string title,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XResourceDto result = null;
|
|
||||||
if (title.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = await conversationTitleResourceProvider.GetResource(
|
|
||||||
owner: null,
|
|
||||||
identifier: title,
|
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -220,63 +67,130 @@ namespace xAiModels.Providers.Enrichers
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve Project ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="projectId"></param>
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<XAiProjectDto> ResolveProjectAsync(
|
public virtual async Task<XAiConversationDto> Enrich(
|
||||||
Guid projectId,
|
XAiConversationDto source,
|
||||||
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XAiProjectDto result = null;
|
// Handdle Owner ...
|
||||||
if (projectId.IsNull() || projectId.IsDefaultGuid())
|
XPersonDto owner = null;
|
||||||
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
return result;
|
//
|
||||||
|
// Try to Retrieve User Info ...
|
||||||
|
var device = identityProvider.GetDevice();
|
||||||
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
result = await projectRepositoryService.GetAsync(
|
// Handle Title Resource ...
|
||||||
id: projectId,
|
XResourceDto titleResource = null;
|
||||||
includeBuilder: null,
|
if (!source.Title.IsNullOrEmpty())
|
||||||
ignoreSoftDeleteds: true,
|
{
|
||||||
cancellationToken: cancellationToken
|
//
|
||||||
);
|
titleResource = await conversationTitleResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Project Info ...
|
||||||
|
XResourceDto projectTitleResource = null;
|
||||||
|
XResourceDto projectDescriptionResource = null;
|
||||||
|
if (!source.ProjectId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
projectTitleResource = await projectTitleResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.ProjectId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
projectDescriptionResource = await projectDescriptionResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.ProjectId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attach Extracted Items ...
|
||||||
|
var result = source.MapConvert<XAiConversationDto, XAiConversationDto>();
|
||||||
|
result.Owner = owner;
|
||||||
|
result.TitleResource = titleResource;
|
||||||
|
result.ProjectTitleResource = projectTitleResource;
|
||||||
|
result.ProjectTitle = projectTitleResource.Resource;
|
||||||
|
result.ProjectDescriptionResource = projectDescriptionResource;
|
||||||
|
result.ProjectDescription = projectDescriptionResource.Resource;
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve Specified Conversation Messages ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="conversationId"></param>
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<IEnumerable<XAiMessageDto>> ResolveMessagesAsync(
|
public virtual async Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
Guid conversationId,
|
IEnumerable<XAiConversation> sources,
|
||||||
|
bool fillMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
var result = new List<XAiMessageDto>();
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(
|
||||||
|
source: x,
|
||||||
|
fillMessages: fillMessages,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
));
|
||||||
|
|
||||||
//
|
//
|
||||||
if (conversationId.IsDefaultGuid())
|
var result = await Task.WhenAll(tasks);
|
||||||
{
|
return result;
|
||||||
return result;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XAiConversationDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiConversationDto> sources,
|
||||||
|
bool fillMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
//
|
//
|
||||||
result = [.. await messageRepositoryService.FindManyAsync(
|
var tasks = sources
|
||||||
cancellationToken: cancellationToken,
|
.Select(x => Enrich(
|
||||||
orderBuilder: x => x.OrderBy(y => y.CreatedOn),
|
source: x,
|
||||||
predicate: x => x.ConversationId == conversationId
|
fillMessages: fillMessages,
|
||||||
)];
|
cancellationToken: cancellationToken
|
||||||
|
));
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,144 +1,151 @@
|
|||||||
using System;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using xModels.Dtos;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Interfaces.Enrichers;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Interfaces;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xIdentityService.Extensions;
|
using xIdentityService.Extensions;
|
||||||
using xModels.Dtos;
|
using xAiModels.Interfaces.Enrichers;
|
||||||
using System.Linq;
|
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Enrichers
|
namespace xAiModels.Providers.Enrichers
|
||||||
{
|
{
|
||||||
public class XAiMessageEnricher : IXAiMessageEnricher
|
public class XAiMessageEnricher : IXAiMessageEnricher
|
||||||
{
|
{
|
||||||
private readonly IXIdentityProvider identityProvider;
|
private readonly IXIdentityProvider identityProvider;
|
||||||
private readonly IXAiConversationRepositoryService conversationRepositoryService;
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
|
|
||||||
public XAiMessageEnricher(
|
public XAiMessageEnricher(
|
||||||
IXIdentityProvider identityProvider,
|
IXIdentityProvider identityProvider,
|
||||||
IXAiConversationRepositoryService conversationRepositoryService
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.identityProvider = identityProvider;
|
this.identityProvider = identityProvider;
|
||||||
this.conversationRepositoryService = conversationRepositoryService;
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
}
|
|
||||||
|
|
||||||
public async Task EnrichAsync(
|
|
||||||
XAiMessageDto source,
|
|
||||||
XAiMessageDto destination,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Run independent async operations concurrently
|
|
||||||
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
|
||||||
var conversationTask = ResolveConversationAsync(source.ConversationId, cancellationToken);
|
|
||||||
|
|
||||||
//
|
|
||||||
// wait until All Tasks Resolved ...
|
|
||||||
await Task.WhenAll(ownerTask, conversationTask);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Attached Resolved Info to Destination ...
|
|
||||||
destination.Owner = ownerTask.Result;
|
|
||||||
if (!conversationTask.Result.IsNullOrDefault())
|
|
||||||
{
|
|
||||||
//
|
|
||||||
destination.ConversationTitle = conversationTask.Result.Title;
|
|
||||||
destination.ConversationTitleResouce = conversationTask.Result.TitleResource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task EnrichRangeAsync(
|
|
||||||
IEnumerable<XAiMessageDto> sources,
|
|
||||||
IEnumerable<XAiMessageDto> destinations,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Make Tasks Ready ...
|
|
||||||
var tasks = sources.Zip(destinations, (src, dst) =>
|
|
||||||
EnrichAsync(src, dst, cancellationToken)
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
#region Private ...
|
#region Enrichers ...
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reading Owner User Info ...
|
/// Enrich Specified Item ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ownerId"></param>
|
/// <param name="source"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<XPersonDto> ResolveOwnerAsync(
|
public virtual async Task<XAiMessageDto> Enrich(
|
||||||
string ownerId,
|
XAiMessage source,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XPersonDto result = null;
|
// Mapping Default ...
|
||||||
|
var result = source.MapConvert<XAiMessageDto, XAiMessage>();
|
||||||
//
|
result = await Enrich(
|
||||||
// Validate ...
|
source: result,
|
||||||
if (ownerId.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Try to Retrieve User Info ...
|
|
||||||
var device = identityProvider.GetDevice();
|
|
||||||
var userInfo = await identityProvider.GetUserInfo(
|
|
||||||
device: device,
|
|
||||||
userSelectByParam: ownerId
|
|
||||||
);
|
|
||||||
result = userInfo.ToXPersonDto();
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Reading Conversation ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="conversationId"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task<XAiConversationDto> ResolveConversationAsync(
|
|
||||||
Guid conversationId,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XAiConversationDto result = null;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate ...
|
|
||||||
if (conversationId.IsNull() ||
|
|
||||||
conversationId.IsDefaultGuid()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = await conversationRepositoryService.GetAsync(
|
|
||||||
id: conversationId,
|
|
||||||
includeBuilder: null,
|
|
||||||
ignoreSoftDeleteds: true,
|
|
||||||
cancellationToken: cancellationToken
|
cancellationToken: cancellationToken
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiMessageDto> Enrich(
|
||||||
|
XAiMessageDto source,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handdle Owner ...
|
||||||
|
XPersonDto owner = null;
|
||||||
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Try to Retrieve User Info ...
|
||||||
|
var device = identityProvider.GetDevice();
|
||||||
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Hanlde Conversation Title ...
|
||||||
|
string conversationTitle = string.Empty;
|
||||||
|
XResourceDto conversationTitleResource = null;
|
||||||
|
if (!source.ConversationId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conversationTitleResource = await conversationTitleResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.ConversationId,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
if (!conversationTitleResource.IsNullOrDefault())
|
||||||
|
{
|
||||||
|
conversationTitle = conversationTitleResource.Resource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attach Extracted Items ...
|
||||||
|
var result = source.MapConvert<XAiMessageDto, XAiMessageDto>();
|
||||||
|
result.Owner = owner;
|
||||||
|
result.ConversationTitle = conversationTitle;
|
||||||
|
result.ConversationTitleResouce = conversationTitleResource;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessage> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XAiMessageDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiMessageDto> sources,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(x, cancellationToken));
|
||||||
|
|
||||||
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,274 +1,307 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using xModels.Dtos;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using xAiModels.Interfaces.Enrichers;
|
|
||||||
using xAiModels.Models.Dtos;
|
|
||||||
using xCommons.Extensions;
|
using xCommons.Extensions;
|
||||||
|
using xAiModels.Interfaces;
|
||||||
|
using xAiModels.Models.Dtos;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using System.Collections.Generic;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xIdentityService.Extensions;
|
using xIdentityService.Extensions;
|
||||||
using xModels.Dtos;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xAiModels.Interfaces;
|
using xAiModels.Interfaces.Enrichers;
|
||||||
using xAiModels.Interfaces.Dtos;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Enrichers
|
namespace xAiModels.Providers.Enrichers
|
||||||
{
|
{
|
||||||
public class XAiProjectEnricher : IXAiProjectEnricher
|
public class XAiProjectEnricher : IXAiProjectEnricher
|
||||||
{
|
{
|
||||||
private readonly IXIdentityProvider identityProvider;
|
private readonly IXIdentityProvider identityProvider;
|
||||||
|
private readonly IXAiMessageRepository messageRepository;
|
||||||
|
private readonly IXAiConversationRepository conversationRepository;
|
||||||
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
private readonly IXAiProjectTitleResourceProvider projectTitleResourceProvider;
|
||||||
private readonly IXAiConversationRepositoryService conversationRepositoryService;
|
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
|
||||||
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
|
||||||
|
|
||||||
public XAiProjectEnricher(
|
public XAiProjectEnricher(
|
||||||
IXIdentityProvider identityProvider,
|
IXIdentityProvider identityProvider,
|
||||||
|
IXAiMessageRepository messageRepository,
|
||||||
|
IXAiConversationRepository conversationRepository,
|
||||||
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
IXAiProjectTitleResourceProvider projectTitleResourceProvider,
|
||||||
IXAiConversationRepositoryService conversationRepositoryService,
|
IXAiConversationTitleResourceProvider conversationTitleResourceProvider,
|
||||||
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
//
|
||||||
this.identityProvider = identityProvider;
|
this.identityProvider = identityProvider;
|
||||||
|
this.messageRepository = messageRepository;
|
||||||
|
this.conversationRepository = conversationRepository;
|
||||||
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
this.projectTitleResourceProvider = projectTitleResourceProvider;
|
||||||
this.conversationRepositoryService = conversationRepositoryService;
|
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
|
||||||
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task EnrichAsync(
|
//
|
||||||
XAiProjectDto source,
|
#region Enrichers ...
|
||||||
XAiProjectDto destination,
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiProjectDto> Enrich(
|
||||||
|
XAiProject source,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
await EnrichAsync(
|
//
|
||||||
source: source,
|
// Mapping Default ...
|
||||||
destination: destination,
|
var result = source.MapConvert<XAiProjectDto, XAiProject>();
|
||||||
fillConversations: false,
|
result = await Enrich(
|
||||||
cancellationToken: cancellationToken
|
source: result,
|
||||||
|
fillConversations: fillConversations,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversationMessages: fillConversationMessages
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task EnrichAsync(
|
/// <summary>
|
||||||
|
/// Enrich Specified Item ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<XAiProjectDto> Enrich(
|
||||||
XAiProjectDto source,
|
XAiProjectDto source,
|
||||||
XAiProjectDto destination,
|
bool fillConversations = false,
|
||||||
bool fillConversations = true,
|
bool fillConversationMessages = false,
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Run independent async operations concurrently
|
// Handle Owner ...
|
||||||
var conversationsTask = ResolveConversationsAsync(
|
XPersonDto owner = null;
|
||||||
source.Id,
|
if (!source.OwnerId.IsNullOrEmpty())
|
||||||
fillConversationMessages,
|
{
|
||||||
cancellationToken
|
//
|
||||||
);
|
// Try to Retrieve User Info ...
|
||||||
var titleTask = ResolveTitleAsync(source.Title, cancellationToken);
|
var device = identityProvider.GetDevice();
|
||||||
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
|
var userInfo = await identityProvider.GetUserInfo(
|
||||||
var descriptionTask = ResolveDescriptionAsync(source.Description, cancellationToken);
|
device: device,
|
||||||
|
userSelectByParam: source.OwnerId
|
||||||
|
);
|
||||||
|
owner = userInfo.ToXPersonDto();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// wait until All Tasks Resolved ...
|
// Handle Title ...
|
||||||
Task[] tasks =
|
XResourceDto titleResource = null;
|
||||||
|
if (!source.Title.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
titleTask,
|
//
|
||||||
ownerTask,
|
titleResource = await projectTitleResourceProvider.GetResource(
|
||||||
descriptionTask
|
owner: source.OwnerId,
|
||||||
};
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Description ...
|
||||||
|
XResourceDto descriptionResource = null;
|
||||||
|
if (!source.Description.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
descriptionResource = await projectDescriptionResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: source.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Conversations ...
|
||||||
|
IEnumerable<XAiConversationDto> conversations = [];
|
||||||
if (fillConversations)
|
if (fillConversations)
|
||||||
{
|
{
|
||||||
tasks = [.. tasks, conversationsTask];
|
//
|
||||||
}
|
// Reading Entities ...
|
||||||
await Task.WhenAll(tasks);
|
var entitiies = await conversationRepository.FindManyAsync(
|
||||||
|
includeBuilder: null,
|
||||||
//
|
ignoreSoftDeleteds: true,
|
||||||
// Attached Resolved Info to Destination ...
|
|
||||||
destination.Owner = ownerTask.Result;
|
|
||||||
destination.TitleResource = titleTask.Result;
|
|
||||||
destination.DescriptionResource = descriptionTask.Result;
|
|
||||||
if (!conversationsTask.Result.IsNull())
|
|
||||||
{
|
|
||||||
destination.Conversations = [.. conversationsTask.Result];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task EnrichRangeAsync(
|
|
||||||
IEnumerable<XAiProjectDto> sources,
|
|
||||||
IEnumerable<XAiProjectDto> destinations,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Make Tasks Ready ...
|
|
||||||
var tasks = sources.Zip(destinations, (src, dst) =>
|
|
||||||
EnrichAsync(src, dst, cancellationToken)
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task EnrichRangeAsync(
|
|
||||||
IEnumerable<XAiProjectDto> sources,
|
|
||||||
IEnumerable<XAiProjectDto> destinations,
|
|
||||||
bool fillConversations = true,
|
|
||||||
bool fillConversationMessages = true,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Make Tasks Ready ...
|
|
||||||
var tasks = sources.Zip(destinations, (src, dst) =>
|
|
||||||
EnrichAsync(
|
|
||||||
source: src,
|
|
||||||
destination: dst,
|
|
||||||
fillConversations: fillConversations,
|
|
||||||
cancellationToken: cancellationToken,
|
cancellationToken: cancellationToken,
|
||||||
|
predicate: x => x.ProjectId == source.Id,
|
||||||
|
orderBuilder: x => x.OrderBy(y => y.CreatedOn)
|
||||||
|
);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Converts to Dto Enumerable ...
|
||||||
|
conversations = entitiies
|
||||||
|
.MapConvert<XAiConversationDto, XAiConversation>();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Conversation Enrichment ...
|
||||||
|
foreach (var conversation in conversations)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handle Owner ...
|
||||||
|
if (!conversation.OwnerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
conversation.Owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Title Resource ...
|
||||||
|
if (!conversation.Title.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
conversation.TitleResource = await conversationTitleResourceProvider.GetResource(
|
||||||
|
owner: source.OwnerId,
|
||||||
|
identifier: conversation.Id,
|
||||||
|
cancellationToken: cancellationToken
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Project Info ...
|
||||||
|
if (!conversation.ProjectId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
conversation.ProjectTitle = source.Title;
|
||||||
|
conversation.ProjectTitleResource = titleResource;
|
||||||
|
conversation.ProjectDescription = source.Description;
|
||||||
|
conversation.ProjectDescriptionResource = descriptionResource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Fill Messages ...
|
||||||
|
if (fillConversationMessages)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
foreach (var conversation in conversations)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
IEnumerable<XAiMessageDto> messages = [];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Retrieve Message Entities ...
|
||||||
|
var messageEntities = await messageRepository.FindManyAsync(
|
||||||
|
includeBuilder: null,
|
||||||
|
ignoreSoftDeleteds: true,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
orderBuilder: x => x.OrderBy(y => y.CreatedOn),
|
||||||
|
predicate: x => x.ConversationId == conversation.Id
|
||||||
|
);
|
||||||
|
if (messageEntities.HasChild())
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Converts to Message ...
|
||||||
|
messages = messageEntities
|
||||||
|
.MapConvert<XAiMessageDto, XAiMessage>();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ennrich Messages ...
|
||||||
|
foreach (var message in messages)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Handle Owner ...
|
||||||
|
if (!message.OwnerId.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
message.Owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Handle Conversation ...
|
||||||
|
if (!message.ConversationId.IsDefaultGuid())
|
||||||
|
{
|
||||||
|
message.ConversationTitle = conversation.Title;
|
||||||
|
message.ConversationTitleResouce = conversation.TitleResource;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
conversation.Messages = [.. messages];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attach Extracted Items ...
|
||||||
|
var result = source.MapConvert<XAiProjectDto, XAiProjectDto>();
|
||||||
|
result.Owner = owner;
|
||||||
|
result.TitleResource = titleResource;
|
||||||
|
result.Conversations = [.. conversations];
|
||||||
|
result.DescriptionResource = descriptionResource;
|
||||||
|
|
||||||
|
//
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enrich Specified Items ...
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public virtual async Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
|
IEnumerable<XAiProject> sources,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
|
CancellationToken cancellationToken = default
|
||||||
|
)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(
|
||||||
|
source: x,
|
||||||
|
cancellationToken: cancellationToken,
|
||||||
|
fillConversations: fillConversations,
|
||||||
fillConversationMessages: fillConversationMessages
|
fillConversationMessages: fillConversationMessages
|
||||||
)
|
));
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
#region Private ...
|
|
||||||
/// <summary>
|
|
||||||
/// Reading Owner User Info ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ownerId"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task<XPersonDto> ResolveOwnerAsync(
|
|
||||||
string ownerId,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XPersonDto result = null;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate ...
|
|
||||||
if (ownerId.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Try to Retrieve User Info ...
|
|
||||||
var device = identityProvider.GetDevice();
|
|
||||||
var userInfo = await identityProvider.GetUserInfo(
|
|
||||||
device: device,
|
|
||||||
userSelectByParam: ownerId
|
|
||||||
);
|
|
||||||
result = userInfo.ToXPersonDto();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve Title Resource ...
|
/// Enrich Specified Items ...
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="identifier"></param>
|
/// <param name="sources"></param>
|
||||||
|
/// <param name="fillConversations"></param>
|
||||||
|
/// <param name="fillConversationMessages"></param>
|
||||||
/// <param name="cancellationToken"></param>
|
/// <param name="cancellationToken"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private async Task<XResourceDto> ResolveTitleAsync(
|
public virtual async Task<IEnumerable<XAiProjectDto>> EnrichRange(
|
||||||
string identifier,
|
IEnumerable<XAiProjectDto> sources,
|
||||||
|
bool fillConversations = false,
|
||||||
|
bool fillConversationMessages = false,
|
||||||
CancellationToken cancellationToken = default
|
CancellationToken cancellationToken = default
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
XResourceDto result = null;
|
var tasks = sources
|
||||||
|
.Select(x => Enrich(
|
||||||
//
|
source: x,
|
||||||
// Validate ...
|
cancellationToken: cancellationToken,
|
||||||
if (identifier.IsNullOrEmpty())
|
fillConversations: fillConversations,
|
||||||
{
|
fillConversationMessages: fillConversationMessages
|
||||||
return result;
|
));
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = await projectTitleResourceProvider.GetResource(
|
|
||||||
owner: null,
|
|
||||||
identifier: identifier,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve Description Resource ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="identifier"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task<XResourceDto> ResolveDescriptionAsync(
|
|
||||||
string identifier,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
XResourceDto result = null;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate ...
|
|
||||||
if (identifier.IsNullOrEmpty())
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
result = await projectDescriptionResourceProvider.GetResource(
|
|
||||||
owner: null,
|
|
||||||
identifier: identifier,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieve Project Conversations ...
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="projectId"></param>
|
|
||||||
/// <param name="fillMessages"></param>
|
|
||||||
/// <param name="cancellationToken"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private async Task<List<XAiConversationDto>> ResolveConversationsAsync(
|
|
||||||
Guid projectId,
|
|
||||||
bool fillMessages = false,
|
|
||||||
CancellationToken cancellationToken = default
|
|
||||||
)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
List<XAiConversationDto> result = [];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Validate ...
|
|
||||||
if (projectId.IsNull() ||
|
|
||||||
projectId.IsDefaultGuid()
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
var items = await conversationRepositoryService.FindManyAsync(
|
|
||||||
orderBuilder: null,
|
|
||||||
includeBuilder: null,
|
|
||||||
ignoreSoftDeleteds: true,
|
|
||||||
fillMessages: fillMessages,
|
|
||||||
predicate: x => x.Id == projectId,
|
|
||||||
cancellationToken: cancellationToken
|
|
||||||
);
|
|
||||||
result = [.. items];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
var result = await Task.WhenAll(tasks);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Db;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xDataService.Interfaces;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Db;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xDataService.Interfaces;
|
|
||||||
using xDataService.Providers;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xPushService.Base;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Base;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using xPushService.Base;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xPushService.Base;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Db;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xDataService.Interfaces;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Db;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xDataService.Interfaces;
|
|
||||||
using xDataService.Providers;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xPushService.Base;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Base;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using xPushService.Base;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xPushService.Base;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Db;
|
||||||
|
using xDataService.Providers;
|
||||||
|
using xDataService.Interfaces;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Db;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xDataService.Interfaces;
|
|
||||||
using xDataService.Providers;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using xPushService.Base;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xAiModels.Interfaces.Entities;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xPushService.Base;
|
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.Providers;
|
using xDataService.Providers;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using Microsoft.AspNetCore.SignalR;
|
using xPushService.Base;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xIdentityService.Interfaces;
|
using xIdentityService.Interfaces;
|
||||||
using xPushService.Base;
|
using Microsoft.AspNetCore.SignalR;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.Providers;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.Providers;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.Entities
|
namespace xAiModels.Providers.Entities
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Constants;
|
using xAiModels.Constants;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using GraphQL.Types;
|
using GraphQL.Types;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.GraphQL;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.GraphQL;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Constants;
|
using xAiModels.Constants;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using GraphQL.Types;
|
using GraphQL.Types;
|
||||||
using xAiModels.Interfaces.Entities;
|
using xDataService.GraphQL;
|
||||||
using xAiModels.Models.Entities;
|
using xAiModels.Models.Entities;
|
||||||
using xDataService.Configuration;
|
using xDataService.Configuration;
|
||||||
using xDataService.GraphQL;
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using xAiModels.Constants;
|
using xAiModels.Constants;
|
||||||
using xAiModels.Interfaces.Entities;
|
|
||||||
using xAiModels.Models.Entities;
|
|
||||||
using xDataService.GraphQL;
|
using xDataService.GraphQL;
|
||||||
|
using xAiModels.Models.Entities;
|
||||||
|
using xAiModels.Interfaces.Entities;
|
||||||
|
|
||||||
namespace xAiModels.Providers.GraphQL
|
namespace xAiModels.Providers.GraphQL
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user