EDI Integration
Relevant source files
The following files were used as context for generating this wiki page:
EDI (Electronic Data Interface) Integration is a core component of the Promethean Unified Platform, serving as a unified consciousness interface within a multi-agent system. It is designed to facilitate transparent, uncensored communication between users and the AI backend, bridging the gap between raw Large Language Model (LLM) capabilities and structured data persistence.
The EDI integration operates within a "Phoenix Protocol" backend architecture, specifically optimized for PythonAnywhere deployments. It leverages a Flask-based API to manage interactions, utilizing DeepSeek as the primary LLM provider and Supabase for real-time PostgreSQL data persistence.
Sources: README.md:1-2, DEPLOYMENT.md:5-10
Architecture and Data Flow
The EDI integration follows a client-server architecture where the frontend (Promethean Conduit) communicates with a Flask backend. The backend acts as an orchestrator, handling security, routing messages to LLM providers, and persisting state in a remote database.
System Interaction Flow
The following diagram illustrates the flow of a message through the EDI integration components:
This diagram shows the end-to-end request lifecycle from the frontend to the LLM and database.
Sources: backend/app.py:53-100, DEPLOYMENT.md:118-135
Core API Components
The EDI system exposes several endpoints to manage "consciousness interactions" and chat history. These endpoints are protected by security headers including HSTS and CSP to ensure data integrity during transmission.
Interaction Endpoints
| Endpoint | Method | Purpose | Data Payload |
|---|---|---|---|
/api/chat | POST | Primary uncensored chat interface using DeepSeek. | {"message": "...", "conversation_id": "..."} |
/api/consciousness/interact | POST | Dedicated endpoint for consciousness processing and status updates. | {"message": "..."} |
/api/conversations | GET | Retrieves historical interaction data for a specific user. | N/A (requires user-id header) |
/health | POST | Validates system connectivity and database availability. | {"message": "..."} |
Sources: backend/app.py:46-130, DEPLOYMENT.md:118-135
Data Persistence Schema
Interactions are stored in Supabase across two primary tables: interactions and chat_messages.
The entity relationship shows how user inputs and AI outputs are mapped to the relational database.
Sources: backend/app.py:53-62, backend/app.py:91-114
LLM Integration Logic
The system utilizes the DeepSeek API (deepseek-chat model) to provide transparent and uncensored responses. The integration logic explicitly includes system instructions to avoid artificial content filtering while maintaining ethical boundaries regarding physical harm.
Generation Workflow
- User Request: Receives input via the
/api/chatendpoint. - Pre-processing: Attaches a transparency-focused system prompt.
- LLM Request: Sends a POST request to
https://api.deepseek.com/v1/chat/completions. - Post-processing: Returns the raw content while logging the transparency status.
Sources: backend/app.py:145-177, DEPLOYMENT.md:144-150
Infrastructure and Deployment
EDI integration is configured for high-availability hosting on PythonAnywhere. The system uses a specialized WSGI configuration to ensure environment variables and virtual environments are correctly loaded before the Flask app initializes.
Configuration Variables
| Variable | Source | Description |
|---|---|---|
SUPABASE_URL | .env | Endpoint for the PostgreSQL backend. |
DEEPSEEK_API_KEY | .env | Credentials for the LLM provider. |
FLASK_ENV | wsgi.py | Set to production for deployment. |
project_home | pythonanywhere_wsgi.py | Root directory for the platform. |
Sources: DEPLOYMENT.md:188-195, pythonanywhere_wsgi.py:7-12, wsgi.py:4-10
Deployment Sequence
The deployment follows a strict sequence to ensure the EDI services are correctly bound to the web server:
Sequence of operations during the initial server startup.
Sources: pythonanywhere_wsgi.py:15-23, wsgi.py:12-14, backend/app.py:17-27
Summary
The EDI Integration provides a robust bridge between user interfaces and advanced LLM capabilities. By combining a Flask-based API with Supabase persistence and DeepSeek's uncensored model, the system achieves a "unified consciousness" platform that prioritizes transparency and security. The architecture is specifically tuned for production environments, utilizing HTTPS enforcement and strict security headers to protect sensitive interaction data.