- Update submodule pointers: xAiApi, Modules/xAiModels;

- Replace stale generated contexts: remove
  Documents/GeneratedContext/xDashboard-xAi{Api,Models,Service}-20261031_*.txt
  and add the 20261102_1545xx set;
- Add Documents/Codes/XAiApiConfiguration.cs,
  Documents/Codes/XAiApiConfigurationExtensions.cs,
  Documents/Codes/XAIServiceBase.cs and
  Documents/Codes/IXAiEmbeddingServiceControllerBase.cs as backups;
- Add Documents/Docs/X121KIEA/X121XKIEA_Analytics-140412.html/.pdf and
  X121XKIEA_Analytics.pdf;
- Add Documents/Docs/Developer/Fix N08 Issue.html and
  xAiApi-14050807-Overview-6/7/7.1/7.2/8/9.html;
- Add Documents/Docs/ChangeLogs/1405-08-11-v01.html and this file.
This commit is contained in:
2026-11-02 16:38:13 +03:30
parent 58a34dfad1
commit 6b1672536f
22 changed files with 47786 additions and 12878 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,35 +1,4 @@
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\XAiApiConfiguration.cs
using xAiModels.Models;
using xAiModels.Constants;
namespace xAiModels.Configurations
{
public class XAiApiConfiguration
{
/// <summary>
/// Model Providers ...
/// </summary>
public XAiModelDescriptor[] Models { get; set; } = [];
/// <summary>
/// Each User must Has a Default Project, this is Title Resource Identifier ...
/// </summary>
public string DefaultProjectTitleResource { get; set; } = XAiModelsConstants.DefaultXAiProjectTitleResourceID;
/// <summary>
/// Each User must Has a Default Project, this is Description Resource Identifier ...
/// </summary>
public string DefaultProjectDescriptionResource { get; set; } = XAiModelsConstants.DefaultXAiProjectDescriptionResourceID;
/// <summary>
/// Each User must Has a Default Conversation, this is Title Resource Identifier ... ...
/// </summary>
public string DefaultConversationTitleResource { get; set; } = XAiModelsConstants.DefaultXAiConversationTitleResourceID;
}
}
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Configurations\XAiModelMappersProfile.cs
using AutoMapper;
@@ -1164,51 +1133,6 @@ namespace xAiModels.Extensions
}
}
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\XAiApiConfigurationExtensions.cs
using System.Linq;
using xAiModels.Models;
using xCommons.Extensions;
using xAiModels.Configurations;
namespace xAiModels.Extensions
{
public static class XAiApiConfigurationExtensions
{
/// <summary>
/// Validate Api Configuration ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this XAiApiConfiguration source)
{
return
!source.IsNullOrDefault() &&
source.Models.HasChild();
}
/// <summary>
/// Retrieve Default Model Descriptor ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static XAiModelDescriptor GetDefaultModel(this XAiApiConfiguration source)
{
//
XAiModelDescriptor result = null;
//
if (source.IsValid())
{
result = source.Models.First();
}
//
return result;
}
}
}
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\XAiModelsExtensions.cs
using System;
@@ -1552,7 +1476,7 @@ namespace xAiModels.Extensions
/// <param name="source"></param>
/// <param name="ownerId"></param>
/// <returns></returns>
public static Guid GetDafualtProject(
public static Guid GetDafaultProject(
this IEnumerable<XAiProjectDto> source,
string ownerId
)
@@ -1712,8 +1636,8 @@ namespace xAiModels.Extensions
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Extensions\XEmbeddingExtensions.cs
using System;
using xCommons.Extensions;
using System.Collections.Generic;
namespace xAiModels.Extensions
{
@@ -1728,7 +1652,8 @@ namespace xAiModels.Extensions
{
//
// Validate ...
if (source.IsNullOrEmpty()) {
if (source.IsNullOrEmpty())
{
return [];
}
@@ -1743,6 +1668,26 @@ namespace xAiModels.Extensions
//
return result;
}
/// <summary>
/// Converts ReadOnly Memory to Embedding Representation ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static string ToEmbedding(this ReadOnlyMemory<float> source)
{
//
var result = string.Empty;
//
if (!source.IsNull() && !source.IsEmpty)
{
result = source.ToArray().ToJSON();
}
//
return result;
}
}
}
@@ -3120,7 +3065,7 @@ namespace xAiModels.Interfaces
/// <returns></returns>
Task<XAiConversationDto> GetDefaultConversation(
string ownerId,
Guid projectId,
Guid? projectId,
string connectionId = null,
CancellationToken cancellationToken = default
);
@@ -4393,6 +4338,7 @@ namespace xAiModels.Models
### FILE: C:\Users\hkhazaeeasl\Documents\Projets\XProjects\xSaherelmWorkspace\Modules\xAiModels\Models\XAiResponseRequest.cs
using System;
using xAiModels.Constants;
namespace xAiModels.Models
{
@@ -4406,6 +4352,21 @@ namespace xAiModels.Models
/// </summary>
public string Prompt { get; set; }
/// <summary>
/// Knowledge Type ...
/// </summary>
public string Type { get; set; } = XAiModelsConstants.XAiDefaultKnowledgeType;
/// <summary>
/// Provided TopK in Vector Searchs ...
/// </summary>
public int? TopK { get; set; }
/// <summary>
/// Min Score for Vector Searchs ...
/// </summary>
public float? MinScore { get; set; }
/// <summary>
/// Specified Project Id ...
/// </summary>
@@ -6084,7 +6045,7 @@ namespace xAiModels.Providers
/// <returns></returns>
public async Task<XAiConversationDto> GetDefaultConversation(
string ownerId,
Guid projectId,
Guid? projectId,
string connectionId = null,
CancellationToken cancellationToken = default
)
@@ -6099,8 +6060,8 @@ namespace xAiModels.Providers
//
// Prepare Project ...
XAiProjectDto project = null;
if (projectId.IsNull() ||
projectId.IsDefaultGuid()
if (!projectId.HasValue ||
projectId.Value.IsDefaultGuid()
)
{
//
@@ -6114,7 +6075,7 @@ namespace xAiModels.Providers
{
//
project = await projectRepositoryService.GetAsync(
id: projectId,
id: projectId.Value,
includeBuilder: null,
ignoreSoftDeleteds: true,
cancellationToken: cancellationToken
@@ -6145,20 +6106,19 @@ namespace xAiModels.Providers
}
//
// Detect Conversation Resource ...
// Check Default Owner Exists or not ...
var resource = await stringProvider.FindOne(
cancellationToken: cancellationToken,
predicate: x =>
x.ResourceTitle
.ToNormalString()
.Contains(ownerId.ToNormalString()) &&
.Contains(ownerId.ToString().ToNormalString()) &&
x.ResourceTitle
.ToNormalString()
.Contains(XAiModelsConstants.XAiProjectTitleIdentifier
.ToNormalString()) &&
.Contains(XAiModelsConstants.XAiConversationTitleIdentifier.ToNormalString()) &&
x.TranslatedValue
.ToNormalString()
.Contains(XAiDataProviderConstants.XDefaultAiProjectSuffix)
.Contains(XAiDataProviderConstants.XDefaultAiConversationSuffix.ToNormalString())
);
if (resource.IsNullOrDefault())
{
@@ -6166,20 +6126,12 @@ namespace xAiModels.Providers
}
//
// Find Default Conversation ...
var result = await conversationRepositoryService.FindOneAsync(
cancellationToken: cancellationToken,
predicate: x => x.Title
.Equals(
resource.ResourceTitle,
StringComparison.InvariantCultureIgnoreCase
) &&
x.ProjectId == project.Id
predicate: x =>
x.ProjectId == project.Id &&
x.Title == resource.ResourceTitle
);
if (result.IsNullOrDefault())
{
XException.NotFound.Throw();
}
//
return result;
@@ -6471,6 +6423,13 @@ namespace xAiModels.Providers
XException.InvalidArgs.Throw();
}
//
// Normalize ...
if (type.IsNullOrEmpty())
{
type = XAiModelsConstants.XAiDefaultKnowledgeType;
}
//
// Converts Question Vector to Vector Array ...
var queryVector = queryEmbedding.ToArray();
@@ -6610,7 +6569,7 @@ namespace xAiModels.Providers
{
//
exists.Text = item.Text;
exists.Embedding = item.Embedding.ToJSON();
exists.Embedding = item.Embedding.ToEmbedding();
exists.Type = item.Type.IsNullOrEmpty() ? exists.Type : item.Type;
exists.Metadata = item.Metadata.IsNullOrDefault() ? exists.Metadata : item.Metadata.ToJSON();
toUpdate.Add(exists);
@@ -6624,7 +6583,7 @@ namespace xAiModels.Providers
Type = item.Type,
Identifier = item.Identifier,
Metadata = item.Metadata.ToJSON(),
Embedding = item.Embedding.ToJSON(),
Embedding = item.Embedding.ToEmbedding(),
Id = item.Id.IsDefaultGuid() ? Guid.NewGuid() : item.Id,
});
}
@@ -7134,7 +7093,7 @@ namespace xAiModels.Providers
/// <returns></returns>
private async Task<bool> HasDefaultConversation(
string ownerId,
Guid projectId,
Guid? projectId,
string connectionId = null,
CancellationToken cancellationToken = default
)
@@ -7150,8 +7109,8 @@ namespace xAiModels.Providers
//
// Prepare Project ...
XAiProjectDto project = null;
if (projectId.IsNull() ||
projectId.IsDefaultGuid()
if (!projectId.HasValue ||
projectId.Value.IsDefaultGuid()
)
{
//
@@ -7165,7 +7124,7 @@ namespace xAiModels.Providers
{
//
project = await projectRepositoryService.GetAsync(
id: projectId,
id: projectId.Value,
includeBuilder: null,
ignoreSoftDeleteds: true,
cancellationToken: cancellationToken
@@ -7201,7 +7160,7 @@ namespace xAiModels.Providers
var defaultConversation = await conversationRepositoryService.FindOneAsync(
cancellationToken: cancellationToken,
predicate: x =>
x.ProjectId == projectId &&
x.ProjectId == project.Id &&
x.Title == resource.ResourceTitle
);
result = !defaultConversation.IsNullOrDefault();
@@ -7220,7 +7179,7 @@ namespace xAiModels.Providers
/// <returns></returns>
private async Task CreateDefaultConversation(
string ownerId,
Guid projectId,
Guid? projectId,
string connectionId = null,
CancellationToken cancellationToken = default
)
@@ -7239,8 +7198,8 @@ namespace xAiModels.Providers
//
// Prepare Project ...
XAiProjectDto project = null;
if (projectId.IsNull() ||
projectId.IsDefaultGuid()
if (!projectId.HasValue ||
projectId.Value.IsDefaultGuid()
)
{
//
@@ -7254,7 +7213,7 @@ namespace xAiModels.Providers
{
//
project = await projectRepositoryService.GetAsync(
id: projectId,
id: projectId.Value,
includeBuilder: null,
ignoreSoftDeleteds: true,
cancellationToken: cancellationToken
@@ -8751,14 +8710,17 @@ namespace xAiModels.Providers.Enrichers
{
public class XAiMessageEnricher : IXAiMessageEnricher
{
private readonly IXPersonService personService;
private readonly IXIdentityProvider identityProvider;
private readonly IXAiConversationTitleResourceProvider conversationTitleResourceProvider;
public XAiMessageEnricher(
IXPersonService personService,
IXIdentityProvider identityProvider,
IXAiConversationTitleResourceProvider conversationTitleResourceProvider
)
{
this.personService = personService;
this.identityProvider = identityProvider;
this.conversationTitleResourceProvider = conversationTitleResourceProvider;
}
@@ -8804,14 +8766,7 @@ namespace xAiModels.Providers.Enrichers
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();
owner = await personService.GetPerson(source.OwnerId);
}
//
@@ -8898,7 +8853,6 @@ using System.Threading.Tasks;
using xAiModels.Models.Entities;
using System.Collections.Generic;
using xIdentityService.Interfaces;
using xIdentityService.Extensions;
using xAiModels.Interfaces.Entities;
using xAiModels.Interfaces.Enrichers;
@@ -8906,6 +8860,7 @@ namespace xAiModels.Providers.Enrichers
{
public class XAiProjectEnricher : IXAiProjectEnricher
{
private readonly IXPersonService personService;
private readonly IXIdentityProvider identityProvider;
private readonly IXAiMessageRepository messageRepository;
private readonly IXAiConversationRepository conversationRepository;
@@ -8914,6 +8869,7 @@ namespace xAiModels.Providers.Enrichers
private readonly IXAiProjectDescriptionResourceProvider projectDescriptionResourceProvider;
public XAiProjectEnricher(
IXPersonService personService,
IXIdentityProvider identityProvider,
IXAiMessageRepository messageRepository,
IXAiConversationRepository conversationRepository,
@@ -8923,6 +8879,7 @@ namespace xAiModels.Providers.Enrichers
)
{
//
this.personService = personService;
this.identityProvider = identityProvider;
this.messageRepository = messageRepository;
this.conversationRepository = conversationRepository;
@@ -8982,14 +8939,7 @@ namespace xAiModels.Providers.Enrichers
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();
owner = await personService.GetPerson(source.OwnerId);
}
//