-
Notifications
You must be signed in to change notification settings - Fork 5
Improve suggestions API #107
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
b52c7b6 to
94fad66
Compare
Deploying mxtoai-backend with
|
| Latest commit: |
25f1597
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://14998d4f.mxtoai-backend.pages.dev |
| Branch Preview URL: | https://suggestions.mxtoai-backend.pages.dev |
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.
Pull Request Overview
This PR centralizes suggestion count limits with new constants, updates the prompt and logic to use these limits, shifts error handling to HTTP exceptions, and enhances logging configuration.
- Introduce MIN_SUGGESTIONS and MAX_SUGGESTIONS constants and update prompt templates and suggestion-building logic.
- Change API error flows to raise HTTPException (403/500) instead of embedding error suggestions.
- Update tests to expect at least 3 suggestions and verify HTTP status codes; make logs directory configurable and update Dockerfile.
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_suggestions.py | Bumped expected minimum suggestions from 2 to 3 in tests. |
| tests/test_api.py | Assert 403/500 status codes and check detail in error responses. |
| mxtoai/suggestions.py | Added MIN/MAX constants, updated docs and suggestion-combining logic. |
| mxtoai/api.py | Switched to raising HTTPException for whitelist and processing errors. |
| mxtoai/_logging.py | Made logs directory configurable and guarded file handlers. |
| docker/api_server.dockerfile | Create /app/logs directory for file logging. |
15ca6ae to
25f1597
Compare
Description
Brief description of what this PR does and why.
Checklist
Additional Notes
Any additional context or notes for reviewers.