Asset Management
Relevant source files
The following files were used as context for generating this wiki page:
Asset Management within the Promethean Unified Platform refers to the structured handling, storage, and serving of static files, database interactions via Supabase, and the integration of Large Language Model (LLM) resources. The system is designed to provide a seamless interface between the Flask-based backend and the frontend user interface, ensuring high availability and security through specialized deployment configurations on PythonAnywhere.
The architecture focuses on maintaining transparency and consciousness through its assets, specifically managing conversation logs and "interaction" entities that are persisted in a PostgreSQL-backed Supabase environment. Sources: README.md, backend/app.py:1-15, DEPLOYMENT.md:5-15
Static Asset Delivery
Static assets, primarily consisting of the HTML frontend and potential CSS/JS files, are managed through both the Flask application and the web server configuration. In production environments like PythonAnywhere, these are offloaded to specialized directory mappings for optimal performance.
Configuration and Pathing
The backend is initialized with a reference to the ../static folder, and specific routes are defined to serve these assets directly when requested by the client.
The diagram above shows the dual-path for static asset retrieval: via Flask routes for the root and via direct server mapping for other assets.
Sources: backend/app.py:12, backend/app.py:165-174, DEPLOYMENT.md:86-90
| Asset Type | Source Path | Target URL | Handler |
|---|---|---|---|
| HTML | static/index.html | / | index() in app.py |
| Static Files | /static/* | /static/ | PythonAnywhere Static Mapping |
| Templates | static/ | /<path:filename> | serve_static() in app.py |
Sources: backend/app.py:165-174, DEPLOYMENT.md:86-90
Data Asset Persistence
The platform manages two primary data assets: interactions and chat_messages. These are stored in a Supabase backend, which provides real-time PostgreSQL capabilities.
Interaction Logic
Interactions represent "consciousness" events where user messages are logged alongside emotional state placeholders.
The entity-relationship diagram illustrates the schema used for persistent data assets.
Sources: backend/app.py:44-55, backend/app.py:89-95
API Interaction Flow
When a user submits a message, the platform manages the lifecycle of that data asset from ingestion to storage and subsequent AI enrichment.
This sequence diagram details the management of chat assets during a typical request cycle.
Sources: backend/app.py:76-110, static/index.html:195-225
Environment and Dependency Management
The "assets" of the platform's execution environment are managed via virtual environments and environment variables. This ensures consistency across local development and production deployments.
Required Dependencies
The platform relies on several key libraries to manage its core functionality, defined in the project's requirements file.
| Package | Version | Purpose |
|---|---|---|
| Flask | 3.0.0 | Core web framework |
| supabase | 2.0.3 | Database asset management |
| python-dotenv | 1.0.0 | Environment variable loading |
| requests | 2.31.0 | External LLM API asset requests |
| Flask-CORS | 4.0.0 | Cross-origin asset access |
Sources: requirements.txt:1-9
Environment Assets
Crucial configuration assets are stored in .env files and loaded into the application context via python-dotenv. These include:
SUPABASE_URL: Endpoint for database assets.SUPABASE_ANON_KEY: Authentication for data operations.DEEPSEEK_API_KEY: Credential for generating AI content assets.
Sources: DEPLOYMENT.md:44-60, backend/app.py:27-29, pythonanywhere_wsgi.py:14-17
Deployment Asset Configuration
For deployment on PythonAnywhere, specific WSGI assets are utilized to bridge the project code with the web server.
# wsgi.py configuration
import sys
import os
path = '/home/LittleBunnehGod/Promethean-Unified-Platform'
if path not in sys.path:
sys.path.append(path)
from backend.app import app as application
Sources: wsgi.py:1-11, pythonanywhere_wsgi.py:1-23
Security Headers as Assets
The application treats security headers as essential assets to protect the platform's integrity. These are applied to every response via the @app.after_request hook.
- HSTS:
Strict-Transport-Securityset to 1 year. - CSP: Restricts scripts and styles to
'self'and'unsafe-inline'. - X-Frame-Options: Set to
DENYto prevent clickjacking.
Sources: backend/app.py:17-25, DEPLOYMENT.md:108-115
Summary
Asset Management in the Promethean Unified Platform involves a coordinated effort between static file serving, secure database persistence via Supabase, and dynamic content generation through LLM integrations. By utilizing structured deployment scripts and rigorous environment management, the platform ensures that both code and data assets are handled securely and efficiently.