How thegravityfalls-11/legal_aid_advisor works
Purpose and Runtime
AI Legal Agent is a Python/Django legal-assistance application combining a browser UI, legal-chat capability, lawyer/booking and knowledge pages, and a separate document-summarization service. The main operational entry point is chatbot_project/manage.py; Django process configuration is in chatbot_project/chatbot_project/settings.py, with ASGI/WSGI deployment entry points at chatbot_project/chatbot_project/asgi.py and chatbot_project/chatbot_project/wsgi.py.
HTTP Routing and Application Composition
The Django project routes requests through chatbot_project/chatbot_project/urls.py into two apps:
• chatbot_project/chatbot/urls.py: chatbot-specific endpoints backed by chatbot_project/chatbot/views.py.
• chatbot_project/frontend/urls.py: page-oriented UI endpoints backed by chatbot_project/frontend/views.py.
This separates conversational/API behavior from the broader legal portal interface, though both run within one Django deployment.
Legal Portal Frontend
The frontend Django app serves the primary user journeys: dashboard, chat, lawyer directory, booking, case/court, knowledge, and authentication-oriented pages. Server-rendered page contracts live under chatbot_project/frontend/templates/, including chat.html, booking.html, and knowledge.html. Browser behavior and styling are separately delivered from chatbot_project/frontend/static/js/ and chatbot_project/frontend/static/css/.
Control flow is browser → Django frontend URL/view → HTML template → page JavaScript interactions and any associated backend calls.
Chatbot Boundary
The chatbot app is the backend boundary for legal question processing, represented by chatbot_project/chatbot/views.py and exposed by chatbot_project/chatbot/urls.py. The README identifies Groq as the cloud LLM provider and Phidata as the agent framework; credentials, model invocation, and response behavior should be expected at this boundary rather than in page templates. The associated rendered/static chatbot assets include chatbot_project/staticfiles/chatbot/chat.js and chatbot_project/staticfiles/chatbot/chat.css.
Document Summarization Subsystem
A distinct Legal Summarizer package is nested alongside the Django apps, with its own application entry point at chatbot_project/Legal_summarizer/Legal_summarizer/app3.py and dependency manifest at chatbot_project/Legal_summarizer/Legal_summarizer/requirements.txt. It provides static UI files at chatbot_project/Legal_summarizer/Legal_summarizer/static/index.html and accepts persisted uploads under chatbot_project/Legal_summarizer/Legal_summarizer/uploads/.
This is an architectural boundary: document upload, summarization, and follow-up Q&A may run independently from Django, requiring an explicit integration or separate process/deployment.
Persistence and Administration
Django models are defined per domain app in chatbot_project/chatbot/models.py and chatbot_project/frontend/models.py; the documented default database is SQLite. Django’s standard administration capability is represented by chatbot_project/chatbot/admin.py and chatbot_project/frontend/admin.py, supporting management of persisted application data through the Django admin runtime.
Delivery and External Dependencies
The project requires Python 3.10 and Python package installation from the repository-level requirements.txt; the summarizer may need its own requirements installation. Runtime infrastructure consists of a Django server, SQLite storage, filesystem-backed uploaded documents, and external Groq LLM access mediated through Phidata. chatbot_project/staticfiles/ is collected/static output, including Django admin assets, rather than the primary source location for feature UI assets.
Main entry points: app3.py Summarizer service · models.py Domain models · urls.py Project routes · views.py Portal views
Components 20
Django Legal Portal
Single deployment serving portal pages and legal chat.
- Django entry point
chatbot_project/manage.py - Django configuration
chatbot_project/chatbot_project/settings.py - Project routes
chatbot_project/chatbot_project/urls.py - Portal routes
chatbot_project/frontend/urls.py - Portal views · Handles dashboard, lawyer, booking, case, knowledge, and auth pages.
chatbot_project/frontend/views.py - Portal templates
- Portal JS and CSS
- Chatbot routes
chatbot_project/chatbot/urls.py - Legal chat boundary · Owns legal-question processing and LLM response behavior.
chatbot_project/chatbot/views.py - Domain models
chatbot_project/frontend/models.py - Django admin · Manages persisted chatbot and portal data.
chatbot_project/chatbot/admin.py - ASGI entry point
chatbot_project/chatbot_project/asgi.py - WSGI entry point
chatbot_project/chatbot_project/wsgi.py
Legal Summarizer
Separately runnable document summarization package.
- Summarizer service · Independently runs document upload, summarization, and follow-up Q&A.
chatbot_project/Legal_summarizer/Legal_summarizer/app3.py - Summarizer UI
chatbot_project/Legal_summarizer/Legal_summarizer/static/index.html - Uploaded documents
Other components
- Browser
- Phidata agent
- Groq
- SQLite · Default persisted application-data store.
Connections 20
- Django entry point → Django configuration: loads
- ASGI entry point → Django configuration: loads
- WSGI entry point → Django configuration: loads
- Browser → Project routes: HTTP requests
- Project routes → Portal routes: portal paths
- Project routes → Chatbot routes: chat paths
- Portal routes → Portal views: dispatches
- Portal views → Portal templates: renders
- Portal templates → Portal JS and CSS: loads
- Chatbot routes → Legal chat boundary: dispatches
- Legal chat boundary → Phidata agent: invokes
- Phidata agent → Groq: model calls
- Portal views → Domain models: uses
- Legal chat boundary → Domain models: uses
- Domain models → SQLite: persists
- Django admin → Domain models: administers
- Browser → Summarizer service: document requests · Separate service boundary.
- Summarizer service → Summarizer UI: serves
- Summarizer service → Uploaded documents: stores uploads
- Summarizer service → Groq: may use LLM