diff --git a/Documents/Codes/Seeding.txt b/Documents/Codes/Seeding.txt new file mode 100644 index 0000000..ed8a75d --- /dev/null +++ b/Documents/Codes/Seeding.txt @@ -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(); + // var aiProjectProvider = scope.ServiceProvider.GetService(); + // var aiConversationProvider = scope.ServiceProvider.GetService(); + // var configuration = scope.ServiceProvider.GetService(); + // 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 ..."); + // } + // } diff --git a/Modules/xAiModels b/Modules/xAiModels index 62aa8d5..9668f26 160000 --- a/Modules/xAiModels +++ b/Modules/xAiModels @@ -1 +1 @@ -Subproject commit 62aa8d51e6ed3723992698aeb07d620be5eaed7f +Subproject commit 9668f26ffead9a845ce4cd028c150cbc828b83b8 diff --git a/xAiApi b/xAiApi index c61f8ae..937e30d 160000 --- a/xAiApi +++ b/xAiApi @@ -1 +1 @@ -Subproject commit c61f8aec983d39682126aa337b6f4e7d78be4893 +Subproject commit 937e30dd9d4521df2f365746de6d217783c4f109