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

files accept hint #984

Merged
merged 3 commits into from
Jan 7, 2025
Merged

files accept hint #984

merged 3 commits into from
Jan 7, 2025

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Jan 7, 2025


Summary of Key Changes 🚀

  • File Extensions Filter:

    • Added accept property to the script options, allowing filtering of file extensions based on provided comma-separated values. This feature enhances flexibility and control over accepted file types.
  • Enhanced Schema Properties:

    • Introduced a method for converting accept strings to an object mapping MIME types to their associated file extensions. This simplifies schema handling by associating files with appropriate MIME types dynamically.
  • Improved User Interface Features:

    • Refactored label rendering to use the underscore function, transforming field names into more readable formats, enhancing readability and user experience in UI components.
  • Updated File Drop Zone Logic:

    • Modified the file drop zone to integrate seamlessly with the new accept functionality, adjusting the logic to handle multiple files based on their MIME types, which improves usability when accepting specific file types.
  • API Stability:

    • Ensured that the public API remains resilient and user-friendly by adding necessary type definitions updates in "packages/core/src/prompt_template.d.ts" and "packages/core/src/prompt_type.ts".

AI-generated content by pr-describe may be incorrect

@@ -32,5 +32,5 @@ export function lookupMime(filename: string) {
if (/\.astro$/i.test(filename)) return "text/x-astro"

// Default to lookup from 'mime-types' or return empty string
return mimeTypesLookup(filename) || ""
return mime.getType(filename) || ""
Copy link

Choose a reason for hiding this comment

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

Consider using a more specific MIME type lookup function to avoid potential issues with file extensions.

AI-generated content by pr-review-commit mime_type_lookup may be incorrect

Copy link

github-actions bot commented Jan 7, 2025

LGTM 🚀

AI-generated content by pr-review may be incorrect

@pelikhan pelikhan merged commit 7988727 into main Jan 7, 2025
13 checks passed
@pelikhan pelikhan deleted the filesaccept branch January 7, 2025 17:47
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.

1 participant