last works on Models ...

This commit is contained in:
2026-08-08 18:07:28 +03:30
parent 8e1566310c
commit 831c7004a8
14 changed files with 1584 additions and 31 deletions
@@ -147,6 +147,7 @@ namespace xAiModels.Providers.Enrichers
//
result = await conversationTitleResourceProvider.GetResource(
owner: null,
identifier: title,
cancellationToken: cancellationToken
);
@@ -37,6 +37,7 @@ namespace xAiModels.Providers.Enrichers
// 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);
+74 -4
View File
@@ -34,22 +34,90 @@ namespace xAiModels.Providers.Enrichers
this.projectDescriptionResourceProvider = projectDescriptionResourceProvider;
}
public Task EnrichAsync(
public async Task EnrichAsync(
XAiProjectDto source,
XAiProjectDto destination,
CancellationToken cancellationToken = default
)
{
throw new NotImplementedException();
await EnrichAsync(
source: source,
destination: destination,
fillConversations: false,
cancellationToken: cancellationToken
);
}
public Task EnrichRangeAsync(
public async Task EnrichAsync(
XAiProjectDto source,
XAiProjectDto destination,
bool fillConversations = true,
CancellationToken cancellationToken = default
)
{
//
// Run independent async operations concurrently
var titleTask = ResolveTitleAsync(source.Title, cancellationToken);
var ownerTask = ResolveOwnerAsync(source.OwnerId, cancellationToken);
var conversationsTask = ResolveConversationsAsync(source.Id, cancellationToken);
var descriptionTask = ResolveDescriptionAsync(source.Description, cancellationToken);
//
// wait until All Tasks Resolved ...
Task[] tasks =
{
titleTask,
ownerTask,
descriptionTask
};
if (fillConversations)
{
tasks = [.. tasks, conversationsTask];
}
await Task.WhenAll(tasks);
//
// 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
)
{
throw new NotImplementedException();
//
// 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,
CancellationToken cancellationToken = default
)
{
//
// Make Tasks Ready ...
var tasks = sources.Zip(destinations, (src, dst) =>
EnrichAsync(src, dst, fillConversations, cancellationToken)
);
//
await Task.WhenAll(tasks);
}
//
@@ -111,6 +179,7 @@ namespace xAiModels.Providers.Enrichers
//
result = await projectTitleResourceProvider.GetResource(
owner: null,
identifier: identifier,
cancellationToken: cancellationToken
);
@@ -142,6 +211,7 @@ namespace xAiModels.Providers.Enrichers
//
result = await projectDescriptionResourceProvider.GetResource(
owner: null,
identifier: identifier,
cancellationToken: cancellationToken
);