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: Cancel chat file uploads; fix: Assistant uploads #4433

Merged
merged 12 commits into from
Oct 16, 2024

Conversation

danny-avila
Copy link
Owner

Summary

This PR mainly implements ability to cancel file upload requests and closes #4295

Previously, file upload requests could hang indefinitely without allowing any other chat operation until refresh or the upload errored/completed. Now you can "cancel" file upload requests; however, cancelling the upload process server-side proved to be non-trivial. As a result, a message is issued explaining the fact that the upload may still go through, and will need to be manually deleted as desired.

To truly cancel the upload server-side, some message queue system to abort/programmatically cancel the file upload via another endpoint, as express.js will not recognize the request was cancelled via req.on('close')

  • Consolidated file upload logic and rendering into a single parent component called FileFormWrapper, refactoring the AttachFile component to better handle file uploads and UI rendering.
  • Moved file-related mutations to a dedicated file for better organization and improved typing.
  • Improved typing for file-related functions and components.
  • Refactored the useFileHandling hook to include an abortUpload function and better handle file upload states.
  • Updated the ChatForm component to use the new FileFormWrapper and simplified its structure.

Other Changes

  • Added Azure OpenAI to the paramEndpoints set for better endpoint handling.
  • Added localization for file upload errors, excluding variable strings.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules

@danny-avila danny-avila merged commit 65888c2 into main Oct 16, 2024
4 checks passed
@danny-avila danny-avila deleted the feat/abort-file-uploads branch October 16, 2024 15:24
owengo pushed a commit to openwengo/LibreChat that referenced this pull request Oct 25, 2024
…a#4433)

* refactor: move file mutations to dedicated file, improve typing

* refactor(ChatForm): utilize FileFormWrapper to consolidate file upload logic/rendering to single parent

* refactor: better TSX heirarchies between AttachFile and FileFormWrapper

* refactor: `abortUpload` WIP

* fix: file debugging and file upload issues

* refactor: reject promise outright if axios intercepted error does not include response property

* chore: bump data-provider version to 0.7.428

* refactor: Add return type to localize function in Translation.ts

* refactor: allow message file attachment upload request cancellations, and add localizations for file upload errors

* refactor: include Azure OpenAI in paramEndpoints set

* fix: assistant form uploads and better typing

* refactor: consolidate logic
danny-avila added a commit that referenced this pull request Oct 27, 2024
* refactor: move file mutations to dedicated file, improve typing

* refactor(ChatForm): utilize FileFormWrapper to consolidate file upload logic/rendering to single parent

* refactor: better TSX heirarchies between AttachFile and FileFormWrapper

* refactor: `abortUpload` WIP

* fix: file debugging and file upload issues

* refactor: reject promise outright if axios intercepted error does not include response property

* chore: bump data-provider version to 0.7.428

* refactor: Add return type to localize function in Translation.ts

* refactor: allow message file attachment upload request cancellations, and add localizations for file upload errors

* refactor: include Azure OpenAI in paramEndpoints set

* fix: assistant form uploads and better typing

* refactor: consolidate logic
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.

[Bug]: Attaching files to assistants does not work
1 participant