-
Notifications
You must be signed in to change notification settings - Fork 0
Initial project setup - TrendResponse MVP #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # MIT License | ||
|
|
||
| Copyright (c) 2025 Tim Dickey | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,226 @@ | ||||||||||||||||||||||
| # TrendResponse Setup Guide | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| This guide walks you through setting up the TrendResponse project from scratch. | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Prerequisites | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 1. **Python 3.11 or higher** | ||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| python --version # Should be 3.11+ | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 2. **GitHub Personal Access Token** | ||||||||||||||||||||||
| - Go to https://github.com/settings/tokens | ||||||||||||||||||||||
| - Click "Generate new token (classic)" | ||||||||||||||||||||||
| - Select scopes: `repo`, `read:org` | ||||||||||||||||||||||
| - Copy the token (starts with `ghp_`) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 3. **LinkedIn Developer Account** (for LinkedIn integration) | ||||||||||||||||||||||
| - Go to https://www.linkedin.com/developers/ | ||||||||||||||||||||||
| - Create a new app | ||||||||||||||||||||||
| - Note your Client ID and Client Secret | ||||||||||||||||||||||
| - Add redirect URI: `http://localhost:8000/auth/linkedin/callback` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Quick Start | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### 1. Clone and Setup | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Clone repository | ||||||||||||||||||||||
| git clone https://github.com/tim-dickey/trendresponse.git | ||||||||||||||||||||||
| cd trendresponse | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Create virtual environment | ||||||||||||||||||||||
| python -m venv venv | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Activate virtual environment | ||||||||||||||||||||||
| # On Windows: | ||||||||||||||||||||||
| venv\Scripts\activate | ||||||||||||||||||||||
| # On macOS/Linux: | ||||||||||||||||||||||
| source venv/bin/activate | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Install dependencies | ||||||||||||||||||||||
| pip install -r requirements.txt | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### 2. Configure Environment | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Copy example environment file | ||||||||||||||||||||||
| cp .env.example .env | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Edit .env with your credentials | ||||||||||||||||||||||
| # Required: | ||||||||||||||||||||||
| # - GITHUB_TOKEN: Your GitHub PAT | ||||||||||||||||||||||
| # - LINKEDIN_CLIENT_ID: From LinkedIn Developer Portal | ||||||||||||||||||||||
| # - LINKEDIN_CLIENT_SECRET: From LinkedIn Developer Portal | ||||||||||||||||||||||
| # - SECRET_KEY: Generate with: python -c "import secrets; print(secrets.token_hex(32))" | ||||||||||||||||||||||
|
||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### 3. Run the Application | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Start the server | ||||||||||||||||||||||
| uvicorn src.main:app --reload --host 0.0.0.0 --port 8000 | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Access API docs at: http://localhost:8000/docs | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Docker Setup (Recommended) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### 1. Using Docker Compose | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Create .env file (same as above) | ||||||||||||||||||||||
| cp .env.example .env | ||||||||||||||||||||||
| # Edit .env with your credentials | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Start all services (API, PostgreSQL, Redis) | ||||||||||||||||||||||
| docker-compose up -d | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # View logs | ||||||||||||||||||||||
| docker-compose logs -f api | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Stop services | ||||||||||||||||||||||
| docker-compose down | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### 2. Docker Only | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Build image | ||||||||||||||||||||||
| docker build -t trendresponse:latest . | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Run container | ||||||||||||||||||||||
| docker run -d \ | ||||||||||||||||||||||
| -p 8000:8000 \ | ||||||||||||||||||||||
| -e GITHUB_TOKEN=your_token \ | ||||||||||||||||||||||
| -e LINKEDIN_CLIENT_ID=your_client_id \ | ||||||||||||||||||||||
| -e LINKEDIN_CLIENT_SECRET=your_secret \ | ||||||||||||||||||||||
| -e SECRET_KEY=your_secret_key \ | ||||||||||||||||||||||
| trendresponse:latest | ||||||||||||||||||||||
|
Comment on lines
+94
to
+101
|
||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Testing AI Suggestions | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| Once the server is running, you can test the AI suggestion feature: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # First, you need an auth token (temporary workaround for MVP) | ||||||||||||||||||||||
| # The full OAuth flow is still being implemented | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Test comment validation | ||||||||||||||||||||||
| curl -X POST "http://localhost:8000/comments/validate" \ | ||||||||||||||||||||||
| -H "Content-Type: application/json" \ | ||||||||||||||||||||||
| -d '{"content": "This is a test comment with exactly ten words here"}' | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Expected response: | ||||||||||||||||||||||
| # {"valid": true, "word_count": 10, "message": "Comment is valid"} | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## Development Workflow | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### Running Tests | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Run all tests | ||||||||||||||||||||||
| pytest | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Run with coverage | ||||||||||||||||||||||
| pytest --cov=src --cov-report=html | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Run specific test file | ||||||||||||||||||||||
| pytest tests/test_suggestions.py -v | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Run and show print statements | ||||||||||||||||||||||
| pytest -s tests/ | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ### Code Quality | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ```bash | ||||||||||||||||||||||
| # Format code | ||||||||||||||||||||||
| black src/ tests/ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Sort imports | ||||||||||||||||||||||
| isort src/ tests/ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Lint | ||||||||||||||||||||||
| ruff check src/ tests/ | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| # Run all quality checks | ||||||||||||||||||||||
| black src/ tests/ && isort src/ tests/ && ruff check src/ tests/ | ||||||||||||||||||||||
| ``` | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| ## GitHub Models Setup | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| The application uses **GitHub Models** (free tier) for AI-powered suggestions: | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| 1. **GitHub Token Requirements:** | ||||||||||||||||||||||
| - Your GitHub PAT needs `repo` scope | ||||||||||||||||||||||
|
||||||||||||||||||||||
| - Your GitHub PAT needs `repo` scope | |
| - Your GitHub PAT needs `repo`, `read:org` scopes |
Copilot
AI
Dec 20, 2025
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.
The rate limit specification "15 requests/minute, 150 requests/hour" should be verified against GitHub Models' actual rate limits. Incorrect rate limit information could lead to unexpected API failures or users being overly cautious about their usage. Please confirm these values match the current GitHub Models free tier limits.
| - Free tier includes: 15 requests/minute, 150 requests/hour | |
| - Free tier includes limited requests; refer to the GitHub Models documentation or your GitHub usage dashboard for current rate limits |
Copilot
AI
Dec 20, 2025
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.
The URL "https://models.github.ai/inference/chat/completions" may not be accurate. Based on GitHub's documentation, the endpoint for GitHub Models might use a different domain or path. Please verify this endpoint URL is correct, as an incorrect endpoint will cause all AI suggestion requests to fail.
| curl https://models.github.ai/inference/chat/completions \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -d '{ | |
| "model": "openai/gpt-4.1-mini", | |
| curl https://models.inference.ai/v1/chat/completions \ | |
| -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| -H "X-Model: openai/gpt-4.1-mini" \ | |
| -d '{ |
Copilot
AI
Dec 20, 2025
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.
The example command shows posting to a LinkedIn callback endpoint, but the description says this is a stub/placeholder. This could be confusing for users testing the setup. Consider adding a comment in the documentation clarifying that this endpoint doesn't perform actual authentication yet and explaining what the expected behavior is in the MVP.
| - Test the OAuth flow at `/auth/linkedin/callback` | |
| - Test the stub LinkedIn callback at `/auth/linkedin/callback` | |
| - Note: In the current MVP this endpoint is a placeholder and does **not** perform real LinkedIn authentication. It should return a simple stub response or log that the callback was hit so you can verify routing and configuration. |
Copilot
AI
Dec 20, 2025
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.
The referenced file path "scripts/seed_data.py" is described as "(to be created)", which indicates this file doesn't exist yet. Consider either creating this script as part of the initial setup or removing this reference until the script is actually implemented to avoid confusion for users following the setup guide.
| - See `scripts/seed_data.py` (to be created) | |
| - Optionally create a script (for example, `scripts/seed_data.py`) to automate seeding |
Copilot
AI
Dec 20, 2025
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.
The referenced deployment guides "docs/deployment/" are mentioned but likely don't exist yet in this initial setup. Consider either creating placeholder documentation files or removing this reference until the deployment guides are actually available to prevent users from looking for non-existent documentation.
| - See deployment guides in `docs/deployment/` | |
| - Deployment guides will be added to the documentation in a future update |
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.
The LICENSE file uses a comment symbol "#" on line 1 for "MIT License", but standard MIT License text doesn't use comment symbols. The first line should simply be "MIT License" without the hash symbol. This is a minor formatting deviation from the standard MIT License format.