Changed UI and Add Docs (Documentation) support#84
Changed UI and Add Docs (Documentation) support#84safiya2610 wants to merge 39 commits intoKathiraveluLab:devfrom
Conversation
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
- Add admin router with user management endpoints - Create admin service for role-based access control - Add admin dashboard and user gallery templates - Implement admin authentication checks - Add unauthorized access template - Fix JWT configuration and improve token validation - Update gallery to show metadata JSON properly - Add admin navigation and styling - Update tests for new admin functionality
Summary of ChangesHello @safiya2610, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a major architectural and feature upgrade to the application. It establishes a containerized development and deployment workflow using Docker, enhances user authentication with Google OAuth and JWT, and provides a powerful admin dashboard for managing users and content. Key additions include a dynamic documentation system, advanced image processing with fuzzy emotion detection, and robust security measures like rate limiting and security headers. The user interface has also been significantly improved for a more engaging and secure experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant number of features, effectively setting up a full-stack FastAPI application with a database, authentication, Docker support, and a new UI. The overall structure is good, with a clear separation of concerns into services and routers. However, there are several critical issues that need to be addressed, including runtime errors due to missing imports and incorrect template syntax, security risks from broad exception handling, and inconsistencies in dependency management and application configuration. I've provided specific comments and suggestions to resolve these issues and improve the robustness and maintainability of the new codebase.
| RUN pip install --no-cache-dir --retries 10 --timeout 300 pip-tools && \ | ||
| pip-compile base.in --output-file requirements.txt && \ | ||
| pip install --no-cache-dir --retries 10 --timeout 300 -r requirements.txt |
There was a problem hiding this comment.
The current method of installing dependencies by compiling base.in inside the Docker container is not ideal. It includes pip-tools in the final image, increasing its size, and may lead to non-reproducible builds. A better practice is to use the requirements/lock.txt file, which is already present in the repository, to ensure builds are deterministic and to keep the production image lean. This can be achieved with a multi-stage build or by directly using the lock file.
COPY requirements/lock.txt requirements.txt
RUN pip install --no-cache-dir --retries 10 --timeout 300 -r requirements.txt
| COPY . . | ||
|
|
||
| # Change ownership to non-root user | ||
| RUN chown -R app:app /app || true |
| print(f"DEBUG: Search query: {q}, Current user: {current_user_email}, Matching users: {matching_users}") | ||
|
|
||
| user_emails = [user[0] for user in matching_users] | ||
| if not user_emails: | ||
| images = [] | ||
| print("DEBUG: No matching users found") | ||
| else: | ||
| placeholders = ','.join('?' * len(user_emails)) | ||
| query = f""" | ||
| SELECT filename, metadata, narrative, user_name | ||
| FROM images | ||
| WHERE user_name IN ({placeholders}) AND visibility = 'public' | ||
| ORDER BY upload_date DESC | ||
| """ | ||
| cur.execute(query, user_emails) | ||
|
|
||
| images = [ | ||
| (fn, json.loads(meta) if meta else {}, narrative, user_name) | ||
| for fn, meta, narrative, user_name in cur.fetchall() | ||
| ] | ||
| print(f"DEBUG: Found {len(images)} public images from users: {user_emails}") |
| - ./cleaned_data.json:/app/cleaned_data.json | ||
| restart: unless-stopped | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:8000/docs"] |
There was a problem hiding this comment.
The health check in docker-compose.yml uses the /docs endpoint, while the Dockerfile defines a HEALTHCHECK using the /health endpoint. It's better to be consistent and use the dedicated, lightweight /health endpoint in both places for more reliable health checks.
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]| assert res.status_code in (302, 303) | ||
|
|
||
|
|
||
| #my code |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
mdxabu
left a comment
There was a problem hiding this comment.
@safiya2610, Please don't use any external copyrighted images like home4.jpg. and use some icon packs for the logout and login!
|
@mdxabu surely I will make changes. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Removed unnecessary closing img tag in cards.html.
|
@mdxabu I’ve made the requested changes. Removed the external copyrighted image and replaced the login/logout with icon pack icons. |
|
@safiya2610, I reviewed some of your code and added my review. |
Screen Recording:
sc.mp4
How to run