-
Notifications
You must be signed in to change notification settings - Fork 8
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
Small code refactor for outputting text #93
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov ReportAttention: Patch coverage is
|
e784d6a
to
c0dab25
Compare
/packit build |
r0x0d
added a commit
that referenced
this pull request
Jan 8, 2025
* Refactor the CLI to be separate commands (#61) * Refactor the CLI to be separate commands This refactor aims to make the commands more organized and easier to work it. The idea behind this is that we can add new commands and separate the logic for all of them in their own individual modules. Currently, this is a rewrite of what we had in __main__.py, so we have a `query`, `history` and `record` command. In the future, we may have more or less. * Fix specfile build * Group test parameters with parametrize * Add an experimental rendering module for client (#62) This rendering module aim to make the output of information easy and less complicated by enforcing a single class that we can plug new "decorators" to be used. Currently, this rendering class has support for: colors, emoji, text wrap, font styles and a basic spinner to wait for responses. * Update dependency coverage to v7.6.9 (#60) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * [RSPEED-279] Add Command Line Assistant Daemon (#58) * Refactor config module This patch introduces a small refactor to the config module to split it and handle the different schemas in a different module. The idea behind this is to keep the modules unclogged and simple. * Refactor CLI to have separate commands This patch will introduce a refactor/split of our CLI module. The intention here is to make sure that each (sub)command will be treated independently and have their own logic. Currently, it is being divided into two categories: * history * query The history subcommand will handle everything that is related to the user history of conversation. The query subcommand will handle anything that is related to user queries. This is also the default subcommand. * [RSPEED-299] Initial setup for clad (#40) * Initial setup for clad This patch introduces an initial setup for clad (Command Line Assistant Daemon). * Fix unit-tests workflow * Update CONTRIBUTING.md * Drop python3-gobject-base from specfile * Remove version lock from pyproject.toml * Refactor the build specfile (#56) In this patch, we refactored how we did the build for the CLA project. This was needed, because of a couple of reasons: - We were not including the submodules under `command_line_assistant` source package - The binaries we were shipping were not working properly with root -- Any time that we tried to execute the binary through `$ c`, it tried to load from `lib64` instead of `lib` To achieve those modifications, we created a new folder called `bin`, where it has `c` and `clad`. We also modified the pyproject.toml to include the submodules using the Find Directive. * Add authentication with identity certificate (#59) This was not tested yet, but the code is all here. * Add the python3-colorama dependency in specfile (#64) * Change DBUS service name (#63) * Improve rendering libary (#65) * Enable copr builds in develop (#67) * Update specfile to include config from release dir (#68) * Update specfile to include config from release dir * Use a SystemMessageBus and a config for dbus * Split the query and history dbus implementations (#66) This will allow us to interact separatedly in dbus for the query and history commands. Having their own implementation, context and etc... This will allow for more control over the next iterations * Switch to system bus instead of session bus (#69) * Add schema for input/output queries and history (#70) * The connect_signals was triggered the API request twice (#73) The connect_signals method in our QueryContext was triggering the API requests twice (as expected), but this is not the behavior we want. This patch removes this functionality. * Add local history management and improve the command (#74) Now we can save/view and query (basic) the history locally. The history module allows for modularity to switch between LocalHistory and a future implementation of a RemoteHistory that will be stored in the servers. We also improved the `history` command to show in the terminal the conversation history by having the following modes: - All history - First history - Last history More modes will be implemented in the future, but for now, this is enough. * Query against rlsrag (#75) * Update query to use RLSAPI instead of RCS * Update query code to rlsrag backend * Improve error handling (#76) * Update query to use RLSAPI instead of RCS * Update query code to rlsrag backend * Improve error handling for history and query Now we can communicate errors from the backend side to the client with exceptions going through dbus. * Update systemd release units to be d-bus activable (#72) * Update dependency coverage to v7.6.10 (#77) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Add 100% docstring coverage (#78) * Add 100% docstring coverage Updated the doc to contain 100% docstring coverage. Added a new pre-commit hook to check for doc coverage * Fix unit tests * Add sphinx docs (#79) * Add readthedocs build support (#80) * Fix readthedocs yaml config (#81) * Fix build path (#82) * Fix query read from stdin (#83) With all the CLI refactors, the query reading from stdin was broken. This patch aims to fix this and allow queries to be passed or appended from stdin. * Fix makefile systemd comment (#84) * Remove colorama dependency and use only unicodes (#85) * Small modifications to CONTRIBUTING.md (#86) * Apply NO_COLOR to colored output (#88) This patch updates the ColorDecorator to not add coloring output if NO_COLOR environment is set. * [RSPEED-334] Generate manpages for CLA and CLAD (#91) * Generate manpages for CLA and CLAD * Add manpages to data/release/man * [RSPEED-403] Prevent binary stdin (#92) * Generate manpages for CLA and CLAD * Add manpages to data/release/man * Prevent binary files from being sent to the server * Add audit logging capability to CLAD (#90) Now sysadmins can configure the audit logging capabilities for CLAD. The configuration is all set and configurable via the config.toml settings. By default, all query and responses will be logged to the audit file. The new settings for the logging configuration contains the following: - Enable/disable query audit logging - Enable/disable response audit logging - The user who made the request - A timestamp indicating when the request happened - Ability for the sysadmin to enable/disable query/response for a certian user * [RSPEED-388] Add exception handling for SSL certificates (#87) * Add exception handling for SSL certificates Adding two exception handling for the SSLAdapter class. One for the certificate not being valid, and the second one for the certificate missing on the system. Without that, the user would receive a nasty error in the client and a not that helpful error in the journald logs. * Add unit tests * Normalize the folder name to command-line-assistant (#96) There were a couple of instances where we used the name command_line_assistant instead of command-line-assistant * Small code refactor for outputting text (#93) * Update legal message (#94) * Remove record command (#95) * [pre-commit.ci] pre-commit autoupdate (#97) updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.4 → v0.8.6](astral-sh/ruff-pre-commit@v0.8.4...v0.8.6) - [github.com/gitleaks/gitleaks: v8.22.0 → v8.22.1](gitleaks/gitleaks@v8.22.0...v8.22.1) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Allow only deterministic tests to be run. (#89) Ref: https://issues.redhat.com/browse/RSPEED-391 Reason: We cannot access certain secrets for the eval_answers test suite until the https://issues.redhat.com/browse/RSPEED-390 is resolved. * Fix config.toml for release and devel path (#98) * [RSPEED-408] Add audit logging to stdout (#99) * Fix config.toml for release and devel path * Add audit logging to sys.stdout * Include a filter option for history management (#101) The --filter accepts a keyword to filter the user history based on that keyword. --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Martin "kokesak" Litwora <mlitwora@redhat.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira Issues:
Checklist
[RSPEED-]
is part of the PR title