Cleanup xAiService for Reconstruction ...

This commit is contained in:
2026-08-15 17:23:24 +03:30
parent e33479f9b6
commit 4283c9688e
16 changed files with 88 additions and 652 deletions
View File
-25
View File
@@ -1,25 +0,0 @@
using xAiService.Configurations;
using xCommons.Extensions;
namespace xAiService.Extensions
{
public static class ModelExtensions
{
/// <summary>
/// Validate XAiServiceConfiguration ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static bool IsValid(this XAIServiceConfiguration source)
{
//
bool result =
!source.IsNull() &&
!source.Url.IsNullOrEmpty() &&
source.Url.IsValidUrl();
//
return result;
}
}
}
-60
View File
@@ -1,60 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using xAiService.Models.Dtos;
using xCommons.Extensions;
namespace xAiService.Extensions
{
public static class PromptExtensions
{
/// <summary>
/// Get Template Params Filled Prompt ...
/// </summary>
/// <param name="source"></param>
/// <param name="params"></param>
/// <returns></returns>
public static string GetMessage(
this XPromptDto source,
IDictionary<string, string> @params = null
)
{
//
var result = string.Empty;
//
if (!source.IsNullOrDefault() &&
!source.Prompt.IsNullOrEmpty()
)
{
result = source.Prompt;
}
//
// Check Params Conditions ...
if (!source.Params.IsNullOrDefault() &&
source.Params.HasChild() &&
!@params.IsNullOrDefault() &&
@params.HasChild()
)
{
//
// Select Params ...
var existsParams = source.Params
.Where(p => @params.Any(pr => pr.Key == p.Name))
.Distinct()
.ToList();
//
// Replace Selected Params ...
existsParams
.ForEach(pk =>
{
result = result.Replace(pk.Param, @params[pk.Name]);
});
}
//
return result;
}
}
}