-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/check api #16
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
Conversation
WalkthroughThe changes introduce a new command-line flag to check the availability of a specific OpenAI model, replacing a generic API check. The OpenAI client now has a method to verify if a model is accessible. Commit signoff handling was moved into the Git commit method. Documentation and metadata were updated, and some dependencies were disabled in the configuration. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Main
participant OpenAI
User->>CLI: Run with --check flag
CLI->>Main: Parse args (check=true)
Main->>OpenAI: check_model(model_name)
OpenAI->>OpenAI: Fetch available models from API
OpenAI-->>Main: Return Ok or Error (model found or not)
Main-->>User: Output result (success or error)
Possibly related PRs
Suggested labels
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
84697fd
to
a4de018
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
README.md (1)
17-17
: Clarify the environment variable reference.The change makes the documentation less specific about which environment variable controls auto sign-off. Consider either keeping the specific variable name or adding a reference to the Configuration section where environment variables are detailed.
-- Auto sign-off commit messages, if specified environment is set to `true` +- Auto sign-off commit messages, if `GIT_AUTO_SIGNOFF` environment variable is set to `true`
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lock
is excluded by!**/*.lock
📒 Files selected for processing (5)
Cargo.toml
(2 hunks)README.md
(1 hunks)src/cli.rs
(1 hunks)src/main.rs
(2 hunks)src/openai.rs
(2 hunks)
🔇 Additional comments (7)
src/cli.rs (1)
42-48
: LGTM! Well-implemented command-line flag.The new
check
field is properly configured with appropriate clap attributes and clear help text. The default value and optional nature are suitable for this feature.Cargo.toml (3)
3-3
: Version bump looks appropriate.The patch version increment is suitable for the new
--check
feature addition.
8-8
: Good addition of "grok" keyword.Adding "grok" to the keywords list is helpful for discoverability if the tool supports Grok models.
30-34
: Remove unused commented dependenciesNo occurrences of
serde
,serde_json
,strum
, orstrum_macros
were found in the codebase—there are nouse serde
/serde_json
imports, no#[derive(Serialize, Deserialize, …)]
attributes, and nostrum
-related code. Feel free to delete these commented lines from Cargo.toml.src/main.rs (1)
88-99
: Well-implemented model validation logic.The model checking implementation is clean and properly integrated:
- Appropriate use of the
cli.check
flag- Good error handling with descriptive error messages
- Proper logging for both success and failure cases
- Early return on validation failure prevents unnecessary processing
src/openai.rs (2)
15-15
: Import organization looks good.The addition of the
crate::cli
import is appropriate and well-placed.
91-108
: Excellent improvement to model validation.The new
check_model
method is a significant improvement over the previous generic check:
- Validates both API connectivity and specific model availability
- Provides helpful debug logging of available models
- Clear error messages for troubleshooting
- Proper async error handling
This makes the validation more precise and user-friendly.
- Add signoff option to CLI arguments in `cli.rs` - Implement author name and email retrieval in `git.rs` - Append signoff to commit message in `main.rs` if enabled - Add tests for author name and email functions in `git.rs` Signed-off-by: mingcheng <[email protected]>
- Implement detection of GIT_AUTO_SIGNOFF environment variable - Enable signoff if environment variable is set to true or 1 - Update logic to combine CLI signoff option with environment variable check Signed-off-by: mingcheng <[email protected]>
- Add `AIGITCOMMIT_SIGNOFF` environment variable to README - Mention auto sign-off feature when variable is set to true Signed-off-by: mingcheng <[email protected]>
- Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <[email protected]>
- Replace static string formatting with variable interpolation in log messages - Apply consistent formatting for trace logs across `git.rs` and `openai.rs` Signed-off-by: mingcheng <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Update `AIGITCOMMIT_SIGNOFF` to `GIT_AUTO_SIGNOFF` in README for consistency - Reflect the correct variable used in the code for auto signoff feature Signed-off-by: mingcheng <[email protected]>
- Adjust last modified timestamps in `main.rs` and `openai.rs` for accuracy - Resolve merge conflict timestamp in `main.rs` to reflect latest update Signed-off-by: mingcheng <[email protected]>
- Bump version from 1.3.2 to 1.3.3 in Cargo.toml - Add "grok" to keywords list in package metadata
- Introduce --check flag in CLI to verify API key and model - Implement check_model function to list and validate available models - Integrate check logic in main.rs with error handling - Comment out unused dependencies in Cargo.toml - Update package categories in Cargo.toml
- Update error message formatting in main.rs to use direct variable interpolation - Simplify debug and error messages in openai.rs with consistent string formatting - Remove redundant string concatenation for cleaner code readability Signed-off-by: mingcheng <[email protected]>
a4de018
to
4de240a
Compare
- Add support for signed-off-by line in commit messages with configurable option - Refactor commit function to accept signoff parameter in git.rs - Retrieve author name and email from repository config for signoff - Remove redundant signoff logic from main.rs and centralize in git.rs - Update commit call in main.rs to pass signoff requirement Signed-off-by: mingcheng <[email protected]>
Summary by CodeRabbit