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

feat: introduce auto-suggest for Metatags #608

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open

feat: introduce auto-suggest for Metatags #608

wants to merge 36 commits into from

Conversation

dipratap
Copy link
Contributor

Meta tags: auto-suggest using GenVar: https://jira.corp.adobe.com/browse/SITES-26415

@dipratap dipratap changed the title feat: introduce auto-suggest for Metatags feat: introduce auto-suggest for Metatags (draft) Jan 27, 2025
Copy link

This PR will trigger a minor release when merged.

@dipratap dipratap changed the title feat: introduce auto-suggest for Metatags (draft) feat: introduce auto-suggest for Metatags Jan 28, 2025
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';
Copy link
Member

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');
Copy link
Member

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`;
Copy link
Member

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
Copy link
Member

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);
Copy link
Member

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) {
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants