Make projectId Nullable in Data Provider and Remove Api Configuration

- IXAiDataProvider.GetDefaultConversation: projectId changed from Guid to Guid?;
- XAiDataProvider.GetDefaultConversation / HasDefaultConversation /
  CreateDefaultConversation: adapt to Guid? (use !projectId.HasValue instead of
  projectId.IsNull(); resolve project via projectId.Value);
- XAiDataProvider: conversation lookup predicate fixed to
  x.ProjectId == project.Id (was x.ProjectId == projectId);
- XEmbeddingExtensions: add ToEmbedding(this ReadOnlyMemory<float>) to persist
  embeddings as JSON;
- XAiDataProvider: use item.Embedding.ToEmbedding() instead of ToJSON() when
  upserting vectors;
- XAiModelsExtensions: rename GetDafualtProject -> GetDafaultProject (typo fix);
- Remove Configurations/XAiApiConfiguration.cs and
  Extensions/XAiApiConfigurationExtensions.cs (Api configuration does not belong
  to the models module).
BREAKING: XAiApiConfiguration / XAiApiConfigurationExtensions removed from
          xAiModels; GetDafualtProject renamed to GetDafaultProject.
This commit is contained in:
2026-11-02 16:37:27 +03:30
parent c4b7e86174
commit 9e7710e345
6 changed files with 41 additions and 89 deletions
+23 -1
View File
@@ -1,3 +1,4 @@
using System;
using xCommons.Extensions;
namespace xAiModels.Extensions
@@ -13,7 +14,8 @@ namespace xAiModels.Extensions
{
//
// Validate ...
if (source.IsNullOrEmpty()) {
if (source.IsNullOrEmpty())
{
return [];
}
@@ -28,5 +30,25 @@ 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;
}
}
}