-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: introduce auto-suggest for Metatags #608
base: main
Are you sure you want to change the base?
Conversation
This PR will trigger a minor release when merged. |
import { ImsClient } from '@adobe/spacecat-shared-ims-client'; | ||
import { getSignedUrl } from '@aws-sdk/s3-request-presigner'; | ||
import { GetObjectCommand } from '@aws-sdk/client-s3'; | ||
import axios from 'axios'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must not use axios, but tracingFetch
from spacecat-shared-http-utils
, which wraps adobe-fetch
and performs x-ray tracing.
const { Configuration } = dataAccess; | ||
const configuration = await Configuration.findLatest(); | ||
if (!configuration.isHandlerEnabledForSite('meta-tags-auto-suggest', site)) { | ||
log.warn('Metatags auto-suggest is disabled for site'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be info
log.error('Metatags Auto-suggest failed: Missing Genvar endpoint or firefall ims orgId'); | ||
throw new Error('Metatags Auto-suggest failed: Missing Genvar endpoint or firefall ims orgId'); | ||
} | ||
const genvarEndpoint = `${context.env.GENVAR_ENDPOINT}/web/aem-genai-variations-appbuilder/metatags`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as GenVar will find re-use across the product, i suggest adding this to spacecat-shared
as a generic client, either as part of the gpt client or a new package.
for (const tagName of ['title', 'description', 'h1']) { | ||
const tagIssueData = tags[tagName]; | ||
if (tagIssueData?.aiSuggestion && tagIssueData.aiRationale) { | ||
// eslint-disable-next-line no-param-reassign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not re-assign params, use a spread copy instead
@@ -59,6 +61,8 @@ export async function auditMetaTagsRunner(baseURL, context, site) { | |||
} | |||
seoChecks.finalChecks(); | |||
const detectedTags = seoChecks.getDetectedTags(); | |||
const healthyTags = seoChecks.getFewHealthyTags(); | |||
await metatagsAutoSuggest(context, site, { detectedTags, extractedTags, healthyTags }, baseURL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be moved to the audit builder setup below as a post processor item
const EXPIRY_IN_DAYS = 7 * 24 * 60 * 60; | ||
const MAX_POLL_RETRIES = 20; | ||
|
||
async function getPresignedUrl(s3Client, log, scrapedData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you provide an example what is exactly shared, accessed by whom/what and whether 7 days expiry is necessary?
Meta tags: auto-suggest using GenVar: https://jira.corp.adobe.com/browse/SITES-26415