Skip to content

opt. & feat. & fix#256

Merged
lollipopkit merged 2 commits intomainfrom
lollipopkit/issue254
Mar 25, 2025
Merged

opt. & feat. & fix#256
lollipopkit merged 2 commits intomainfrom
lollipopkit/issue254

Conversation

@lollipopkit
Copy link
Copy Markdown
Owner

  • fix: file base64 calc
  • opt.: chat histories carried
  • feat: file select
  • fix: webdav
  • opt.: ApiFile
  • opt.: del files after deleting chat
  • opt.: trash view
  • rm: flutter distributor

Fixes #254

- fix: file base64 calc
- opt.: chat histories carried
- feat: file select
- fix: webdav
- opt.: `ApiFile`
- opt.: del files after deleting chat
- opt.: trash view
- rm: flutter distributor

Fixes #254
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Mar 25, 2025

Reviewer's Guide by Sourcery

This pull request introduces file selection functionality, improves chat item hover behavior, removes flutter distributor, optimizes ApiFile and chat histories, fixes webdav client initialization, and improves trash view.

Updated class diagram for ChatContent

classDiagram
  class ChatContent {
    ChatContentType type
    String raw
    String id
    +ChatContent.text(String raw)
    +ChatContent.image(String raw)
    +ChatContent.file(String raw)
    +ChatContent.fromJson(Map~String, dynamic~ json)
    +Map~String, dynamic~ toJson()
  }
  ChatContent -- ChatContentType : type
  class ChatContentType {
    <<enumeration>>
    text
    audio
    image
    file
  }
  note for ChatContent "Added file support to ChatContent"
Loading

File-Level Changes

Change Details Files
Introduced file selection functionality, allowing users to pick and send various file types in chats.
  • Added file_picker dependency to pubspec.yaml.
  • Modified _onTapFilePick to use FilePicker for selecting files.
  • Updated _buildFileBtn to use MingCute.file_upload_fill icon.
  • Added ChatContentType.file enum value.
  • Implemented _buildFile to display file cards in chat view.
  • Modified ChatHistoryItemX to include file content in OpenAI messages.
  • Updated contentToApi to handle file content conversion to base64.
  • Modified removeHistory in TrashStore to delete files when chat history is removed.
  • Updated _onCreateText to handle file uploads.
  • Added ApiFile to manage file data.
lib/view/page/home/chat.dart
lib/view/page/home/ctrl.dart
lib/view/page/home/bottom/bottom.dart
lib/data/model/chat/history/history.ext.dart
lib/view/page/home/req.dart
lib/core/ext/file.dart
lib/data/store/trash.dart
pubspec.yaml
lib/data/model/chat/history/history.dart
lib/data/model/chat/history/view.dart
lib/data/model/chat/history/history.g.dart
lib/view/page/home/home.dart
lib/view/page/home/var.dart
Improved chat item hover behavior by using Positioned.fill and Hover widgets.
  • Wrapped the content widget with a Stack and Positioned.fill.
  • Used Hover widget to manage hover state and animation.
lib/view/page/home/chat.dart
Removed flutter distributor.
  • Removed flutter_distributor from pubspec.yaml.
pubspec.yaml
Optimized ApiFile and chat histories.
  • Replaced ImagePicker with FilePicker for broader file type support.
  • Modified _historyCarried to use await for ChatHistoryItem.single to ensure proper asynchronous handling.
  • Removed the asStr parameter from toApi and toOpenAI methods in ChatHistoryItemX extension.
lib/view/page/home/ctrl.dart
lib/data/model/chat/history/history.ext.dart
lib/view/page/home/req.dart
Fixed webdav client initialization.
  • Changed WebdavClient constructor to WebdavClient.basicAuth to include authentication details.
lib/view/page/backup/impl/webdav.dart
Improved trash view.
  • Added maxLines and TextOverflow.ellipsis to the trash sheet item title to handle long titles.
lib/view/page/home/trash.dart

Assessment against linked issues

Issue Objective Addressed Explanation
#254 Implement file upload functionality in the application.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @lollipopkit - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider using a more descriptive name than _filePicked to better reflect its purpose.
  • It looks like you're converting local files to base64 strings; consider the performance implications for large files.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lollipopkit lollipopkit merged commit c6f1a65 into main Mar 25, 2025
1 check passed
@lollipopkit lollipopkit deleted the lollipopkit/issue254 branch March 25, 2025 08:38
@lollipopkit lollipopkit changed the title opt.& feat. & fix opt. & feat. & fix Mar 25, 2025
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