last ...
This commit is contained in:
@@ -0,0 +1,104 @@
|
|||||||
|
//
|
||||||
|
// Create an Scope for Services Acces ...
|
||||||
|
// Handle Seeding Category/SubCategory Resources ...
|
||||||
|
// TODO: Enable Seeding if Required ...
|
||||||
|
// using (var scope = app.ApplicationServices.CreateScope())
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // Retrieve Configuratuions ...
|
||||||
|
// var aiMessageProvider = scope.ServiceProvider.GetService<IXAiMessageServiceProvider>();
|
||||||
|
// var aiProjectProvider = scope.ServiceProvider.GetService<IXAiProjectServiceProvider>();
|
||||||
|
// var aiConversationProvider = scope.ServiceProvider.GetService<IXAiConversationServiceProvider>();
|
||||||
|
// var configuration = scope.ServiceProvider.GetService<XAiDataServiceServiceConfiguration>();
|
||||||
|
// if (!configuration.IsNullOrDefault() &&
|
||||||
|
// !categoryProvider.IsNullOrDefault() &&
|
||||||
|
// !subaiConversationDescriptor.IsNullOrDefault()
|
||||||
|
// )
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // Logging ...
|
||||||
|
// Log("Start Seeding ...");
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Count Data in Category ...
|
||||||
|
// var hasCategory = (categoryProvider.Count().GetAwaiter().GetResult()) > 0;
|
||||||
|
// var hasSubCategory = (subCategoryProvider.Count().GetAwaiter().GetResult()) > 0;
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Seed Category Resources ...
|
||||||
|
// var canSeed =
|
||||||
|
// !hasCategory &&
|
||||||
|
// configuration.Categories.HasChild();
|
||||||
|
// if (canSeed)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // Loop through Provided items ...
|
||||||
|
// foreach (var cat in configuration.Categories)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Log($"Start Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} ...");
|
||||||
|
|
||||||
|
// //
|
||||||
|
// categoryProvider.Refresh(
|
||||||
|
// resource: cat,
|
||||||
|
// userInfo: null,
|
||||||
|
// connectionId: null,
|
||||||
|
// cancellationToken: default
|
||||||
|
// )
|
||||||
|
// .GetAwaiter()
|
||||||
|
// .GetResult();
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Log($"Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} Finished Successfully ...");
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// Log($"Seeding Category: {cat.Titles.Locales.ToArray()[0].Value} Failed due: {ex.Message} ...");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// // Seed SubCategory Resources ...
|
||||||
|
// canSeed =
|
||||||
|
// !hasSubCategory &&
|
||||||
|
// configuration.SubCategories.HasChild();
|
||||||
|
// if (canSeed)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// // Loop through Provided items ...
|
||||||
|
// foreach (var subcat in configuration.SubCategories)
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// try
|
||||||
|
// {
|
||||||
|
// //
|
||||||
|
// Log($"Start Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} ...");
|
||||||
|
|
||||||
|
// //
|
||||||
|
// subCategoryProvider.Refresh(
|
||||||
|
// userInfo: null,
|
||||||
|
// resource: subcat,
|
||||||
|
// connectionId: null,
|
||||||
|
// cancellationToken: default
|
||||||
|
// )
|
||||||
|
// .GetAwaiter()
|
||||||
|
// .GetResult();
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Log($"Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} Finished Successfully ...");
|
||||||
|
// }
|
||||||
|
// catch (Exception ex)
|
||||||
|
// {
|
||||||
|
// Log($"Seeding SubCategory: {subcat.Titles.Locales.ToArray()[0].Value} Failed due: {ex.Message} ...");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// //
|
||||||
|
// Log("Finish Seeding ...");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
+1
-1
Submodule Modules/xAiModels updated: 62aa8d51e6...9668f26ffe
+1
-1
Submodule xAiApi updated: c61f8aec98...937e30dd9d
Reference in New Issue
Block a user