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

Asset mime types #4799

Merged
merged 8 commits into from
Mar 12, 2025
Merged

Asset mime types #4799

merged 8 commits into from
Mar 12, 2025

Conversation

Leksyk
Copy link
Contributor

@Leksyk Leksyk commented Mar 12, 2025

Wiring asset's mimeType to TemplatePart #4605

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

@Leksyk Leksyk requested a review from dglazkov March 12, 2025 19:13
Copy link

changeset-bot bot commented Mar 12, 2025

⚠️ No Changeset found

Latest commit: 3807b96

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Collaborator

@dglazkov dglazkov left a comment

Choose a reason for hiding this comment

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

This is great!

@@ -46,7 +47,7 @@ const PARSING_REGEX = /{(?<json>{(?:.*?)})}/gim;

function isTemplatePart(o: unknown): o is TemplatePart {
if (!o || typeof o !== "object") return false;
return "type" in o && "path" in o && "title" in o;
return "type" in o && "path" in o && "title" in o;``
Copy link
Collaborator

Choose a reason for hiding this comment

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

spurious quotes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, reverted

for (const element of data) {
for (const part of element.parts) {
if ("inlineData" in part && part.inlineData.mimeType)
mimeTypes.add(part.inlineData.mimeType);
Copy link
Collaborator

Choose a reason for hiding this comment

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

can probably exit early here, since we're only taking the first one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought we could be doing something smarter in the future, but you are right, replacing with simple return first.

@Leksyk Leksyk merged commit 9501fb9 into breadboard-ai:main Mar 12, 2025
2 checks passed
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