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

Stage develop merge into main #25

Draft
wants to merge 85 commits into
base: main
Choose a base branch
from
Draft

Stage develop merge into main #25

wants to merge 85 commits into from

Conversation

YaoxuanZhang
Copy link
Member

@YaoxuanZhang YaoxuanZhang commented Feb 6, 2025

Do not mark ready. Only used for review

Summary by Sourcery

Refactor the project structure, update dependencies, and improve the help command. Migrate from a simple script-based structure to a more organized, modular structure using cogs. Implement email verification using Mailjet and OAuth, and enhance error handling with detailed logging and invite generation. Introduce an Ollama LLM integration for chatbot functionality.

New Features:

  • Added an Ollama LLM integration for chatbot features, including prompting with and without context, conversations, and chat sessions.

Tests:

  • Added tests for core database models (User, Event, Guild) and the email module.

YaoxuanZhang and others added 30 commits January 22, 2025 18:25
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Copy link

sourcery-ai bot commented Feb 6, 2025

Reviewer's Guide by Sourcery

This pull request merges the stage develop branch into the main branch. It includes refactoring of the codebase, moving cogs to a new directory structure, updating database interactions to use a new database class, implementing email verification, and adding chatbot functionality.

Sequence diagram for the new email verification process

sequenceDiagram
    participant U as User
    participant B as Bot
    participant E as Email Service
    participant D as Database

    U->>B: Request profile creation
    B->>U: Ask for email
    U->>B: Provide email
    B->>E: Generate and send verification code
    E->>U: Send verification email
    U->>B: Submit verification code
    B->>B: Verify code
    alt Valid code
        B->>D: Save verified email
        B->>U: Confirm verification
    else Invalid code
        B->>U: Report invalid code
    end
Loading

Class diagram for the new User and Profile models

classDiagram
    class User {
        +int _id
        +List[int] guilds
        +List[int] events
        +UserProfile profile
        +datetime created_at
        +datetime updated_at
        +save()
    }

    class UserProfile {
        +UserName name
        +str school_email
        +int student_id
        +List[str] major
        +int graduation_year
        +int phone
    }

    class UserName {
        +str first
        +str middle
        +str last
    }

    User *-- UserProfile
    UserProfile *-- UserName
Loading

File-Level Changes

Change Details Files
Moves cogs to a new directory structure and renames them.
  • Moves cog files from src/capy_discord/cogs to src/capy_app/frontend/cogs.
  • Renames cog classes to follow a *Cog naming convention (e.g., Profile to ProfileCog).
  • Updates import paths within the cog files to reflect the new location.
src/capy_discord/cogs/profile.py
src/capy_app/frontend/cogs/profile_cog.py
src/capy_discord/cogs/help.py
src/capy_app/frontend/cogs/help_cog.py
src/capy_discord/cogs/event.py
src/capy_app/frontend/cogs/event_cog.py
src/capy_discord/cogs/ping.py
src/capy_app/frontend/cogs/ping_cog.py
src/capy_discord/cogs/templates.py
src/capy_app/frontend/cogs/template_cog.py
Updates database interactions to use a new database class.
  • Replaces direct calls to self.bot.db with calls to the new db class.
  • Updates database operations to use db.get_document, db.add_document, db.update_document and db.upsert_data.
  • Changes how user data is accessed and updated to align with the new database structure.
src/capy_app/frontend/cogs/profile_cog.py
Implements email verification for user profiles.
  • Adds a verify_email method to handle email verification.
  • Generates a verification code and sends it to the user's email address.
  • Prompts the user to enter the verification code.
  • Validates the entered code against the generated code.
  • Removes the Flask server and OAuth verification process.
src/capy_app/frontend/cogs/profile_cog.py
Adds chatbot functionality using the Ollama library.
  • Introduces a new cog OllamaCog to handle chatbot interactions.
  • Implements commands for prompting, asking, conversing, and managing chat history.
  • Uses the ollama library to interact with a language model.
  • Adds functionality to chunk messages and delete messages between think tags.
src/capy_app/frontend/cogs/ollama_cog.py
Adds error handling cog for managing error messages and their resolution status.
  • Introduces a new cog ErrorHandlerCog to handle error messages.
  • Implements functionality to log errors to a designated channel with reaction controls.
  • Adds functionality to create invites to channels where errors occur.
  • Adds functionality to resolve or ignore errors.
src/capy_app/frontend/cogs/error_handler_cog.py
Adds guild settings cog for managing server settings.
  • Introduces a new cog GuildCog to manage server settings.
  • Implements commands for listing and setting server settings.
  • Adds functionality to set announcement, moderator, and reports channels.
  • Adds functionality to set eboard and admin roles.
src/capy_app/frontend/cogs/guild_cog.py
Updates setup and configuration files.
  • Updates package information in setup.py and setup.cfg.
  • Modifies test paths in pyproject.toml.
  • Adds a new file pytest.ini.
  • Updates .gitignore.
  • Updates requirements_dev.txt.
setup.py
setup.cfg
pyproject.toml
pytest.ini
.gitignore
requirements_dev.txt
Adds documentation for onboarding and coding style.
  • Adds a new file docs/onboarding.md.
  • Adds documentation for onboarding and coding style.
docs/onboarding.md
Updates the main bot file.
  • Updates the main bot file to use the new database class.
  • Updates the main bot file to load cogs from the new directory structure.
src/capy_app/frontend/bot.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. 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

gianlucazhang2 and others added 29 commits February 6, 2025 20:05
* Update README.md

* Update README.md

Test Status

* Update README.md

* aligning test badge

* fixing alignment and added email

* fixing alignment again ughh

---------

Co-authored-by: Shamik Karkhanis <[email protected]>
Co-authored-by: Shamik Karkhanis <[email protected]>
* upd rm

* fix venv path

* fix venv path for linux

* changed CApy to CAPY. added caleb rit email!

* forgot one !

---------

Co-authored-by: Shamik Karkhanis <[email protected]>
* Change guild settings error message

* Remove extraneous commands from help
* working settings prompts

* working profile interaction

* update profile cog to use interactions

* refactor lots, kinda a golden branch but everyone's asleep anyways

* not working but added purge

* kinda working major refactor, guild is problematic

* it's working??

* working guild omg

* add guild perms

* fix whoopsies in sync, profile working?

* trying to fix profile

* i think i fixed profile

* working on compliance

* add pyproject conf to remove pytest.ini

* create a bunch of inits bruv

* some fixes to type hints with cog, appears to work?

* profile borked, needs fixing

* profile works!!

* fix profile asking for major after modal fail

* woah it works

* sprinkle some flake8 and write some checks

* big refac

* not working modal

* working developer feedback?!

* add colors and reactions to tickets!

* update embed statuses and add reset reaction on dev tickets

* fix extrenuous title on tickets

* remove reaction after added

* add sync support for essentials and auto dev bot load

* add logging to guild and profile, add hotswapping

* add base for robust dropdown handling and test cog and test cog enabler

* refac

* fix typos in help

* fix init typo in interaction bases
* [Update] added unit tests

* improved db_test coverage | issue with sync_document_with_template function

* updated event_test and guild_test and db.sync_doc_from_temp from curr develop

* commented out unused function

---------

Co-authored-by: Caleb Alemu <[email protected]>
Co-authored-by: Shamik Karkhanis <[email protected]>
* Add logging.basicConfig() details

* Change logging statements to fit a basic pattern

* Add logger initialization and configuration to log all uncaught errors

* Add proper message to console when crashing due to uncaught exception

* adhere to flake8

* Update src/capy_app/sys_logger.py

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: YaoxuanZhang <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* working office hours mvp

* working, but need to fix dropdown base to allow pagination and auto split dropdowns with more than one selection, as well as typable dropdowns
- updated config validators
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.

6 participants