ClinicianFOCUS / FreeScribe

A medical scribe capable of creating SOAP notes running Whisper and Kobold based on conversation with a patient
GNU General Public License v3.0
0 stars 0 forks source link

Add pre/post-processing options and settings bug fix #28

Closed ItsSimko closed 2 days ago

ItsSimko commented 3 days ago

Issue: #27

Summary by Sourcery

Refactor the FreeScribe client to enhance the user interface and settings management. Introduce a CustomTextBox widget for improved text handling and add placeholder text functionality. Enhance the settings window with a two-column layout and dynamic model selection. Update the CI workflow to handle alpha releases and improve release notes.

New Features:

Enhancements:

CI:

Documentation:

Summary by Sourcery

Refactor the FreeScribe client to enhance the user interface and settings management. Introduce a CustomTextBox widget for improved text handling and add placeholder text functionality. Enhance the settings window with a two-column layout and dynamic model selection. Update the CI workflow to handle alpha releases and improve release notes.

New Features:

Enhancements:

CI:

sourcery-ai[bot] commented 3 days ago

Reviewer's Guide by Sourcery

This PR enhances the FreeScribe client by introducing pre/post-processing capabilities for text handling and improving the settings UI layout. The changes focus on refactoring the settings window to use a two-column layout and adding new processing options for text manipulation. The implementation includes error handling improvements and model selection enhancements.

Sequence diagram for text processing with pre/post-processing

sequenceDiagram
    actor User
    participant Client
    participant AI

    User->>Client: Enter text
    Client->>AI: Send pre-processing request
    AI-->>Client: Return list of facts
    Client->>AI: Send note generation request
    AI-->>Client: Return generated note
    alt Post-processing enabled
        Client->>AI: Send post-processing request
        AI-->>Client: Return post-processed note
    end
    Client->>User: Display final note

Class diagram for CustomTextBox and SettingsWindowUI changes

classDiagram
    class CustomTextBox {
        +String placeholderText
        +void insertText(String text)
        +void copyText()
    }
    note for CustomTextBox "CustomTextBox widget with placeholder and copy functionality"

    class SettingsWindowUI {
        +void create_editable_settings_col(Frame left_frame, Frame right_frame, int left_row, int right_row, Set settings_set)
        +void create_advanced_settings()
        +void save_settings(boolean close_window)
    }
    note for SettingsWindowUI "Enhanced settings window with two-column layout and dynamic model selection"

    SettingsWindowUI --> CustomTextBox : uses

File-Level Changes

Change Details Files
Refactored settings window layout to use an evenly distributed two-column design
  • Implemented calculation of midpoint to split settings evenly between columns
  • Separated settings processing into distinct left and right column loops
  • Maintained consistent row handling for each column independently
src/FreeScribe.client/UI/SettingsWindowUI.py
Added pre/post-processing functionality for text handling
  • Added UI elements for pre/post-processing settings
  • Implemented text processing workflow with optional pre and post processing steps
  • Added configuration options to enable/disable processing steps
  • Created default templates for pre and post processing instructions
src/FreeScribe.client/UI/SettingsWindow.py
src/FreeScribe.client/client.py
Enhanced error handling and model selection in the client
  • Added validation check for model selection before saving
  • Improved error message specificity in exception handling
  • Modified model dropdown to preserve selected model across updates
  • Refactored API response handling to return text instead of updating GUI directly
src/FreeScribe.client/client.py
src/FreeScribe.client/UI/SettingsWindowUI.py

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. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a 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. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) 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 - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
sweep-ai[bot] commented 3 days ago

Hey @ItsSimko, here is an example of how you can ask me to improve this pull request:

@sweep Add unit tests for the `send_text_to_chatgpt` function to verify error handling for different types of exceptions (ConnectionError, Timeout, RequestException) and ensure correct error messages are displayed.

:book: For more information on how to use Sweep, please read our documentation.