Some checks failed
Deploy to Production / deploy (push) Failing after 0s
- Replace cyan/violet design tokens with warm dark slate + orange (#E89B3C) palette - Add Space Grotesk display font; new utilities: .outline-display, .orange-band, .corner-card, .persona-orb - New brand components: Logo (hexagonal SVG), Header (pill nav + glass blur), Footer (4-col), PublicLayout, AppLayout, UserDropdown - Rewrite Index.tsx as full sales funnel: Hero → Stats → Orange band → How it works → Pricing (API) → FAQ → Final CTA - Rewrite Dashboard.tsx with real API data: credits balance, MTD spend, personas count, focus groups count, active tasks, recent transactions - Rewrite auth pages (Login, Register, VerifyEmail, NotFound, Billing) with two-column orange-panel layout - Replace hardcoded mock numbers in Dashboard with billingApi / personasApi / focusGroupsApi / usageApi calls - Delete legacy components: Navigation.tsx, Hero.tsx, FeatureCard.tsx - Add nested layout routing in App.tsx: PublicLayout for guests, AppLayout for protected routes - Color sweep inner pages: replace all purple-500/600 with primary token - Purge all semblance / Oliver / optical-dev references; rename semblance_app_documentation.md → cohorta_app_documentation.md; update backend scripts to cohorta_db Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
3.6 KiB
Executable file
3.6 KiB
Executable file
Cohorta Backend
This is the Python backend for the Cohorta project. It provides API endpoints for authentication, personas, and focus groups.
Setup
- Make sure you have Python 3.8+ installed
- Create a virtual environment:
cd backend python -m venv venv - Activate the virtual environment:
- On macOS/Linux:
source venv/bin/activate - On Windows:
venv\Scripts\activate
- On macOS/Linux:
- Install dependencies:
pip install -r requirements.txt
Running the Backend
python run.py
The server will start on http://localhost:5000
API Endpoints
Authentication
POST /api/auth/login- Login with username and passwordPOST /api/auth/register- Register a new userGET /api/auth/me- Get current user profile
Personas
GET /api/personas- Get personas for current userGET /api/personas/all- Get all personasGET /api/personas/:id- Get persona by IDPOST /api/personas- Create a new personaPUT /api/personas/:id- Update a personaDELETE /api/personas/:id- Delete a personaPOST /api/personas/batch- Create multiple personas
Focus Groups
GET /api/focus-groups- Get focus groups for current userGET /api/focus-groups/all- Get all focus groupsGET /api/focus-groups/:id- Get focus group by IDPOST /api/focus-groups- Create a new focus groupPUT /api/focus-groups/:id- Update a focus groupDELETE /api/focus-groups/:id- Delete a focus groupPOST /api/focus-groups/:id/participants- Add participant to focus groupDELETE /api/focus-groups/:id/participants/:personaId- Remove participant from focus groupGET /api/focus-groups/:id/messages- Get messages for a focus groupPOST /api/focus-groups/:id/messages- Add a message to a focus group
AI Personas
POST /api/ai-personas/generate- Generate a synthetic persona using AIPOST /api/ai-personas/generate-and-save- Generate and save a synthetic personaPOST /api/ai-personas/batch-generate- Generate multiple synthetic personasPOST /api/ai-personas/batch-generate-and-save- Generate and save multiple synthetic personas
Focus Group AI
POST /api/focus-group-ai/generate-response- Generate an AI response from a persona in a focus group discussion
AI Response Generation Example
Request Body:
{
"focus_group_id": "focus_group_id",
"persona_id": "persona_id",
"current_topic": "What do you think about this product?",
"temperature": 0.7 // Optional, controls randomness (0.0 to 1.0)
}
Response:
{
"message": "Response generated successfully",
"response": "I find the product quite interesting. As someone who values efficiency, I appreciate the intuitive interface and how it streamlines my workflow. However, I'm concerned about the price point, which seems high compared to similar options on the market.",
"message_id": "message_id"
}
How AI Response Generation Works
The system generates realistic persona responses by:
- Using the persona's demographic details, personality traits, goals, and frustrations
- Including the full discussion guide text
- Taking up to 50 most recent conversation messages for context
- Processing the current topic/question
- Generating a response in the persona's authentic voice
The current_topic parameter can be any text: a moderator question, a specific prompt, or a summary of discussion points. The AI will respond as if the persona is directly addressing this topic.
Default User
A default user with the following credentials is automatically created:
- Username: user
- Password: pass
- Role: admin