Conversation
FEAT: Make the authentication with the passsage [Refs: #2]
FEAT: Create languages IA API The-Fabricators#7
FEAT: Create math IA API The-Fabricators#6
FEAT: Create Natural Sciences API The-Fabricators#11
FEAT: Create human sciences IA API The-Fabricators#13
Create textwriting IA API The-Fabricators#15
FEAT: Create chat to read images The-Fabricators#24
…Message FEAT: Create Bias
FEAT: Utils and rabbitmq
FIX: fixxing user receiver id to email
There was a problem hiding this comment.
Pull Request Overview
This PR sets up a complete Django-based backend system for a chatbot platform that integrates with multiple AI services including Google Gemini, OpenAI GPT, and Cohere. The system includes user authentication, specialized AI modules for different academic subjects, and a bias detection/classification system.
Key changes:
- Complete project structure with Django configuration, models, views, and API endpoints
- Multi-AI integration with specialized modules for different academic subjects (languages, mathematics, natural sciences, human sciences, text writing)
- Cohere-based text classification system with training capabilities
- User authentication system using Passage identity
Reviewed Changes
Copilot reviewed 102 out of 146 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Project dependencies and PDM configuration |
| manage.py | Standard Django management script |
| config/ | Django settings, URLs, and WSGI/ASGI configuration |
| core/authUser/ | Custom user authentication system with Passage integration |
| core/geminiIA/ | Google Gemini AI integration modules for different subjects |
| core/chatgptIA/ | OpenAI GPT integration for generic AI responses |
| core/cohereIA/ | Cohere AI classification system with training capabilities |
| core/chat/ | Chat management system with conversation history |
| core/bias/ | Message classification and routing system |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import os | ||
| import google.generativeai as genai | ||
|
|
||
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") |
There was a problem hiding this comment.
API key is hardcoded in the source code. This should be moved to environment variables for security. Use os.getenv('GEMINI_API_KEY') instead of hardcoding the key.
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") | |
| genai.configure(api_key=os.getenv('GEMINI_API_KEY')) |
| import os | ||
| import google.generativeai as genai | ||
|
|
||
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") |
There was a problem hiding this comment.
API key is hardcoded in the source code. This should be moved to environment variables for security. Use os.getenv('GEMINI_API_KEY') instead of hardcoding the key.
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") | |
| genai.configure(api_key=os.getenv('GEMINI_API_KEY')) |
| import os | ||
| import google.generativeai as genai | ||
|
|
||
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") |
There was a problem hiding this comment.
API key is hardcoded in the source code. This should be moved to environment variables for security. Use os.getenv('GEMINI_API_KEY') instead of hardcoding the key.
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") | |
| genai.configure(api_key=os.getenv('GEMINI_API_KEY')) |
| import os | ||
| import google.generativeai as genai | ||
|
|
||
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") |
There was a problem hiding this comment.
API key is hardcoded in the source code. This should be moved to environment variables for security. Use os.getenv('GEMINI_API_KEY') instead of hardcoding the key.
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") | |
| genai.configure(api_key=os.getenv('GEMINI_API_KEY')) |
| import os | ||
| import google.generativeai as genai | ||
|
|
||
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") |
There was a problem hiding this comment.
API key is hardcoded in the source code. This should be moved to environment variables for security. Use os.getenv('GEMINI_API_KEY') instead of hardcoding the key.
| genai.configure(api_key="AIzaSyAnxlo6QW7qp8PaosOdU-4ECehA9gHMnMA") | |
| genai.configure(api_key=os.getenv('GEMINI_API_KEY')) |
| "google-generativeai>=0.8.3", | ||
| "django-filter>=24.3", | ||
| "pillow>=11.0.0", | ||
| "openai==0.28", |
There was a problem hiding this comment.
Using an outdated version of OpenAI library (0.28) which may contain security vulnerabilities. Consider updating to a more recent version and verify compatibility.
| "openai==0.28", | |
| "openai>=1.14.3", |
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
[nitpick] Remove unnecessary empty lines at the end of the file to improve code cleanliness.
|
|
||
| # Realiza a classificação | ||
| response = co.classify( | ||
| model="6c419c46-f7b4-4dc4-986e-7519a8cc002d-ft", |
There was a problem hiding this comment.
The model ID is hardcoded. This should use the dynamic model ID from current_model.currentModel that was retrieved earlier in the method for consistency and flexibility.
| model="6c419c46-f7b4-4dc4-986e-7519a8cc002d-ft", | |
| model=model_id, |
| class TextWritingAISerializer(ModelSerializer): | ||
| class Meta: | ||
| model = TextWritingAI | ||
| fields: list[str] = ['id', 'user', 'answer', 'response', 'cover'] No newline at end of file |
There was a problem hiding this comment.
Type annotation on fields is unnecessary in Django serializer Meta classes. The Django framework expects fields to be a list, so the type annotation should be removed: fields = ['id', 'user', 'answer', 'response', 'cover']
| fields: list[str] = ['id', 'user', 'answer', 'response', 'cover'] | |
| fields = ['id', 'user', 'answer', 'response', 'cover'] |
Fix typo in docstring for main function
Update manage.py
234