Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installed AI Assistant. applicable on Metadata and Teaser summarization #933

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 60 additions & 7 deletions src/Foundation/Features/CatalogContent/Product/GenericProduct.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Epicweb.Optimizely.AIAssistant;
using EPiServer.Commerce.Catalog.DataAnnotations;
using EPiServer.SpecializedProperties;
using Foundation.Infrastructure.Commerce.Models.EditorDescriptors;
Expand All @@ -12,6 +13,64 @@ namespace Foundation.Features.CatalogContent.Product
[ImageUrl("/icons/cms/pages/CMS-icon-page-23.png")]
public class GenericProduct : ProductContent, IProductRecommendations, IFoundationContent/*, IDashboardItem*/
{

#region SEO

//override and hide, use own implementation
[ScaffoldColumn(false)]
public override SeoInformation SeoInformation { get; set; }

[CultureSpecific]
[UIHint(AIHint.Input)]
[Display(Name = "SEO title", GroupName = Infrastructure.TabNames.MetaData, Order = 20)]
public virtual string SEOTitle {
get {
var metaTitle = this.GetPropertyValue(p => p.SEOTitle);
// Use explicitly set meta title, otherwise fall back to SeoInformation or page name
return metaTitle ?? this.SeoInformation?.Title ?? this.DisplayName;
}
set
{
SeoInformation.Title = value;
this.SetPropertyValue(p => p.SEOTitle, value);
}
}

[CultureSpecific]
[UIHint(AIHint.Textarea)]
[Display(Name = "SEO description", GroupName = Infrastructure.TabNames.MetaData, Order = 25)]
public virtual string SEODescription {
get {
string meta = this.GetPropertyValue(p => p.SEODescription);
// Use explicitly set meta title, otherwise fall back to SeoInformation
return meta ?? SeoInformation?.Description;
}
set
{
SeoInformation.Description = value;
this.SetPropertyValue(p => p.SEODescription, value);
}
}

[CultureSpecific]
[UIHint(AIHint.Textarea)]
[Display(Name = "SEO keywords", GroupName = Infrastructure.TabNames.MetaData, Order = 30)]
public virtual string SEOKeywords
{
get
{
string meta = this.GetPropertyValue(p => p.SEOKeywords);
// Use explicitly set meta title, otherwise fall back to SeoInformation
return meta ?? SeoInformation?.Keywords;
}
set {
SeoInformation.Keywords = value;
this.SetPropertyValue(p => p.SEOKeywords, value);
}
}

#endregion

#region Content
[Searchable]
[CultureSpecific]
Expand Down Expand Up @@ -187,11 +246,5 @@ public override void SetDefaultValues(ContentType contentType)
Boost = 1;
Bury = false;
}

//public void SetItem(ItemModel itemModel)
//{
// itemModel.Description = Description?.ToHtmlString();
// itemModel.Image = CommerceMediaCollection.FirstOrDefault()?.AssetLink;
//}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Epicweb.Optimizely.AIAssistant;
using EPiServer.Find;

namespace Foundation.Features.Locations.LocationItemPage
Expand All @@ -10,7 +11,7 @@ namespace Foundation.Features.Locations.LocationItemPage
public class LocationItemPage : FoundationPageData
{
[StringLength(5000)]
[UIHint(UIHint.Textarea)]
[UIHint(AIHint.Textarea)]
[Display(Name = "Intro text", GroupName = SystemTabNames.Content, Order = 10)]
public virtual string MainIntro { get; set; }

Expand Down
8 changes: 5 additions & 3 deletions src/Foundation/Features/Shared/FoundationPageData.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//using EPiServer.Labs.ContentManager.Cards;
//using EPiServer.Labs.ContentManager.Dashboard;
using Epicweb.Optimizely.AIAssistant;
using EPiServer.SpecializedProperties;
using Foundation.Features.Blocks.ButtonBlock;
using Geta.Optimizely.Categories;
Expand Down Expand Up @@ -36,6 +37,7 @@ public abstract class FoundationPageData : PageData, ICategorizableContent, IFou
#region Metadata

[CultureSpecific]
[UIHint(AIHint.Input)]
[Display(Name = "Title", GroupName = TabNames.MetaData, Order = 100)]
public virtual string MetaTitle
{
Expand All @@ -51,12 +53,12 @@ public virtual string MetaTitle
}

[CultureSpecific]
[UIHint(UIHint.Textarea)]
[UIHint(AIHint.Textarea)]
[Display(GroupName = TabNames.MetaData, Order = 200)]
public virtual string Keywords { get; set; }

[CultureSpecific]
[UIHint(UIHint.Textarea)]
[UIHint(AIHint.Textarea)]
[Display(Name = "Page description", GroupName = TabNames.MetaData, Order = 300)]
public virtual string PageDescription { get; set; }

Expand Down Expand Up @@ -124,7 +126,7 @@ public virtual string MetaTitle
public virtual ContentReference TeaserVideo { get; set; }

[CultureSpecific]
[UIHint(UIHint.Textarea)]
[UIHint(AIHint.Textarea)]
[Display(Name = "Text", GroupName = TabNames.Teaser, Order = 300)]
public virtual string TeaserText
{
Expand Down
3 changes: 2 additions & 1 deletion src/Foundation/Foundation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
<PackageReference Include="Geta.Optimizely.Categories" Version="1.0.0" />
<PackageReference Include="Geta.Optimizely.Categories.Find" Version="1.0.0" />
<PackageReference Include="Optimizely.Labs.MarketingAutomationIntegration.ODP" Version="1.0.2" />
<PackageReference Include="Epicweb.Optimizely.AIAssistant" Version="0.0.0.12" />

<!-- Optimizely Forms & Marketing Automation Connectors -->
<!-- Optimizely Forms & Marketing Automation Connectors -->
<PackageReference Include="EPiServer.Forms" Version="5.5.1" />
<PackageReference Include="EPiServer.Forms.Samples" Version="4.1.0" />
<PackageReference Include="EPiServer.Marketing.Automation.Forms" Version="3.1.2" />
Expand Down
16 changes: 9 additions & 7 deletions src/Foundation/Infrastructure/Helpers/HtmlHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,21 +413,23 @@ public static HtmlString RenderMetaDataForCommerce(this IHtmlHelper helper, ICon
return new HtmlString("");
}

var output = new StringBuilder(string.Empty);
var output = new StringBuilder(string.Empty);
var product = entryContentBase as GenericProduct;

if (!string.IsNullOrWhiteSpace(entryContentBase.SeoInformation.Title))
if (!string.IsNullOrWhiteSpace(product?.SEOTitle))
{
output.AppendLine(string.Format(_metaFormat, "title", entryContentBase.SeoInformation.Title));
output.AppendLine(string.Format(_metaFormat, "title", product.SEOTitle));
}

if (!string.IsNullOrWhiteSpace(entryContentBase.SeoInformation.Keywords))
if (!string.IsNullOrWhiteSpace(product?.SEOKeywords))
{
output.AppendLine(string.Format(_metaFormat, "keyword", entryContentBase.SeoInformation.Keywords));
output.AppendLine(string.Format(_metaFormat, "keyword", product.SEOKeywords));
}

if (!string.IsNullOrWhiteSpace(entryContentBase.SeoInformation.Description))

if (!string.IsNullOrWhiteSpace(product?.SEODescription))
{
output.AppendLine(string.Format(_metaFormat, "description", entryContentBase.SeoInformation.Description));
output.AppendLine(string.Format(_metaFormat, "description", product.SEODescription));
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions src/Foundation/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Advanced.CMS.AdvancedReviews;
using Advanced.CMS.GroupingHeader;
using Epicweb.Optimizely.AIAssistant;
using EPiServer.Authorization;
using EPiServer.Cms.TinyMce.SpellChecker;
using EPiServer.ContentApi.Cms;
Expand Down Expand Up @@ -243,6 +244,9 @@ public void ConfigureServices(IServiceCollection services)
// Add GroupingHeader
// https://github.com/advanced-cms/grouping-header/
services.AddGroupingHeader();

// Add AI Assistant on SEO
services.AddAIAssistant();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
Expand Down