Local Development Setup
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The local development setup for the Promethean Unified Platform provides a sandbox environment to develop and test the unified consciousness platform, which merges various AI modules (Athena, EDI, EVI2_0, and EVI3_0) using a Phoenix Protocol backend. The system is built on a Flask framework, integrating DeepSeek LLM for transparent AI chat interactions and Supabase for real-time PostgreSQL database management.
Setting up the local environment requires configuring a Python 3.10+ environment, installing specific dependencies, and establishing connections to external API providers. This setup mirrors the production architecture to ensure consistency across development and deployment phases.
Sources: README.md:1-2, DEPLOYMENT.md:5-13, backend/app.py:11-13
Environment Prerequisites
The platform relies on several core components that must be installed or configured before running the application locally.
Python Environment
A virtual environment is recommended to manage the specific versions of libraries required by the platform, such as Flask 3.0.0 and Supabase 2.0.3.
Sources: requirements.txt:1-4, DEPLOYMENT.md:43-47
Required Dependencies
The following core libraries are required for the platform's operation:
| Library | Version | Purpose |
|---|---|---|
| Flask | 3.0.0 | Web framework for the backend API |
| Flask-CORS | 4.0.0 | Handling Cross-Origin Resource Sharing |
| python-dotenv | 1.0.0 | Loading environment variables from .env files |
| supabase | 2.0.3 | Database client for PostgreSQL and real-time features |
| requests | 2.31.0 | Making HTTP requests to the DeepSeek API |
Sources: requirements.txt:1-9
Configuration and Environment Variables
The application uses a .env file to manage sensitive credentials and environment-specific settings. This file must be created in the root directory.
# Supabase Configuration
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key_here
# DeepSeek LLM Configuration
DEEPSEEK_API_KEY=YOUR_DEEPSEEK_API_KEY_HERE
# Flask Configuration
FLASK_ENV=development
FLASK_DEBUG=True
# Server Configuration
SERVER_PORT=5000
SERVER_HOST=0.0.0.0
Sources: DEPLOYMENT.md:51-66, backend/app.py:15-18
System Architecture and Data Flow
The local development environment facilitates a flow where the frontend communicates with the Flask backend, which in turn orchestrates data between the DeepSeek AI model and the Supabase database.
Interaction Flow Diagram
The following diagram illustrates how a user message travels through the system during a local session.
This diagram shows the synchronous flow of data from the frontend to the external API and database providers.
Sources: backend/app.py:80-120, static/index.html:260-285
Database Schema Overview
The system interacts with two primary tables in Supabase to track interactions and chat history.
| Table | Column | Type | Description |
|---|---|---|---|
| interactions | user_id | string | Identifier for the user (defaults to anonymous) |
| interactions | message | text | The raw message sent by the user |
| chat_messages | conversation_id | string | Grouping ID for a specific chat thread |
| chat_messages | role | string | Either 'user' or 'assistant' |
| chat_messages | content | text | The content of the message |
Sources: backend/app.py:44-55, backend/app.py:92-110
Local API Endpoints
During development, the backend exposes several endpoints to facilitate testing and frontend integration.
Chat Integration
- Endpoint:
POST /api/chat - Description: The primary endpoint for AI interaction. It processes user input, saves it to the database, and fetches a response from the DeepSeek model.
- Payload:
{ "message": "string", "conversation_id": "string" }
Consciousness Interact
- Endpoint:
POST /api/consciousness/interact - Description: A specialized endpoint for processing "consciousness" messages, focusing on status updates and interaction logging.
Sources: backend/app.py:65-78, backend/app.py:80-120
Frontend Development
The frontend is a single-page application (SPA) located in the static/ directory. It uses standard HTML5, CSS3, and Vanilla JavaScript to provide a chat interface.
UI Components
- Chat Container: Displays the message history using a
flex-direction: columnlayout. - Input Area: Contains the text input and send button, with event listeners for both click and "Enter" key presses.
- Typing Indicator: A visual feedback element shown while waiting for the AI response.
Sources: static/index.html:15-150, static/index.html:288-305
Local Execution
To run the application locally, execute the Flask application from the root directory:
# Ensure virtual environment is active
export FLASK_APP=backend/app.py
export FLASK_ENV=development
flask run
Sources: backend/app.py:177-178, wsgi.py:7-11
Conclusion
The local development setup for the Promethean Unified Platform provides an integrated environment for testing the transparency and consciousness-focused AI features. By mirroring the production configuration using Flask, Supabase, and DeepSeek, developers can ensure that interactions and ethical guardrails are functioning correctly before deployment.