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

YSP-672: AI: Add media payloads and pipelines #15

Draft
wants to merge 40 commits into
base: main
Choose a base branch
from

Conversation

dblanken-yale
Copy link
Contributor

YSP-672: AI: Add media payloads and pipelines

Description of work

  • Add media embedding options

Functional testing steps:

  • Step 1
  • Step 2
  • Step 3
  • ...

While we allow new pages to be indexed by default, it did not make sense
to always opt-out on media that is uploaded.  This adds the feature that
when they're inserting a new media that has ai metatags enabled, it will
default the media item to be disabled by default.
Since documents have a different field than images on how they store
their associated files, we need a way to retrieve it no matter what.
Instead of placaing the URL inside documentContent, which doesn't quite
make sense, place it in the documentUrl.  This allows citations to link
directly to the PDF, and the edit page it was referencing before really
is useless to the users since they won't have access to visit that link
anwyay.
If config is nullable we throw an exception anyway, and with new
versions of PHP, defaulted paramter arguments must be at the end of the
function signature.  Instead of moving this, just default it to NULL.
Still work in progress, but would give the ability to "opt-in" or out of
AI inclusion hopefully in many different content types.
@dblanken-yale dblanken-yale force-pushed the YSP-672-ai-add-media-payloads-and-pipelines branch from 6cca667 to 4e88876 Compare October 8, 2024 12:56
@dblanken-yale dblanken-yale force-pushed the YSP-672-ai-add-media-payloads-and-pipelines branch from ed8a80a to 2791996 Compare October 8, 2024 13:04
protected function isSupportedMediaType(EntityInterface $entity) {
$config = $this->configFactory->get('ai_engine_embedding.settings');
$allowed_media_types = $config->get('included_media_types');
return in_array($entity->bundle(), $allowed_media_types);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing that this will throw an error on sites that already have this module enabled but did not resave the form. Can not check in_array on NULL.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch; I've added ?? [] for $allowed_media_types now.

@@ -18,6 +20,13 @@ class AiEngineEmbeddingSettings extends ConfigFormBase {
*/
const CONFIG_NAME = 'ai_engine_embedding.settings';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a part of your current work, but I'm just now realizing that we should have a config/install for this settings file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah that makes sense. I can add that as part of this.

@dblanken-yale
Copy link
Contributor Author

dblanken-yale commented Oct 11, 2024

@nJim When dealing with an "optional" dependency of a module, is it custom to check for the config the optional module uses or is there another easier way this is done? I wanted to try to combine the metadata enabling with the metatags selection, but I didn't want to couple them since it's possible to run without it.

Right now one is in embedding and one is in metadata; I was thinking it's more appropriate in metadata only.

@dblanken-yale dblanken-yale force-pushed the YSP-672-ai-add-media-payloads-and-pipelines branch 2 times, most recently from 58ca446 to 81ef396 Compare October 15, 2024 15:56
@dblanken-yale dblanken-yale force-pushed the YSP-672-ai-add-media-payloads-and-pipelines branch from 81ef396 to 90ef0c2 Compare October 15, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants