Spaces:
Sleeping
Sleeping
Aman-Khokhar-313 commited on
Commit ·
b563b2f
0
Parent(s):
Secure API Key, Update Create Share Link UI, Fix report generation bug
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- .gitattributes +8 -0
- .gitignore +59 -0
- README.md +250 -0
- SRS.md +1199 -0
- backend/agent_behavior.py +222 -0
- backend/ai_service.py +308 -0
- backend/app.py +1347 -0
- backend/config.py +24 -0
- backend/migrate_anchoring.py +32 -0
- backend/models.py +213 -0
- backend/scoring_service.py +219 -0
- backend/test_anchoring.py +68 -0
- frontend/3d-assets/blendDataBlink.json +3323 -0
- frontend/3d-assets/converter_original.js +94 -0
- frontend/3d-assets/idle.fbx +3 -0
- frontend/3d-assets/images/background.jpg +3 -0
- frontend/3d-assets/images/background1.jpg +3 -0
- frontend/3d-assets/images/bg5.jpg +3 -0
- frontend/3d-assets/images/body.webp +3 -0
- frontend/3d-assets/images/body_normal.webp +3 -0
- frontend/3d-assets/images/body_roughness.webp +3 -0
- frontend/3d-assets/images/body_specular.webp +3 -0
- frontend/3d-assets/images/eyes.webp +3 -0
- frontend/3d-assets/images/h_alpha.webp +3 -0
- frontend/3d-assets/images/h_color.webp +3 -0
- frontend/3d-assets/images/h_normal.webp +3 -0
- frontend/3d-assets/images/h_roughness.webp +3 -0
- frontend/3d-assets/images/photo_studio_loft_hall_1k.hdr +3 -0
- frontend/3d-assets/images/teeth_diffuse.webp +3 -0
- frontend/3d-assets/images/teeth_normal.webp +3 -0
- frontend/3d-assets/images/tshirt_diffuse.webp +3 -0
- frontend/3d-assets/images/tshirt_normal.webp +3 -0
- frontend/3d-assets/images/tshirt_roughness.webp +3 -0
- frontend/3d-assets/model.glb +3 -0
- frontend/3d-assets/rpm-model.glb +3 -0
- frontend/css/styles.css +4557 -0
- frontend/image/favicon.PNG +3 -0
- frontend/index.html +158 -0
- frontend/js/api.js +70 -0
- frontend/js/app.js +170 -0
- frontend/js/components/avatar3d.js +1228 -0
- frontend/js/components/lipsync-engine.js +444 -0
- frontend/js/components/modal.js +66 -0
- frontend/js/components/notifications.js +253 -0
- frontend/js/components/onboarding.js +213 -0
- frontend/js/components/sidebar.js +109 -0
- frontend/js/components/three-converter.js +64 -0
- frontend/js/components/toast.js +89 -0
- frontend/js/pages/agent-detail.js +838 -0
- frontend/js/pages/agent-wizard.js +813 -0
.gitattributes
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.glb filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.fbx filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.hdr filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.PNG filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OS-Specific
|
| 2 |
+
.DS_Store
|
| 3 |
+
Thumbs.db
|
| 4 |
+
|
| 5 |
+
# Python
|
| 6 |
+
__pycache__/
|
| 7 |
+
*.py[cod]
|
| 8 |
+
*$py.class
|
| 9 |
+
*.so
|
| 10 |
+
.Python
|
| 11 |
+
env/
|
| 12 |
+
build/
|
| 13 |
+
develop-eggs/
|
| 14 |
+
dist/
|
| 15 |
+
downloads/
|
| 16 |
+
eggs/
|
| 17 |
+
.eggs/
|
| 18 |
+
lib/
|
| 19 |
+
lib64/
|
| 20 |
+
parts/
|
| 21 |
+
sdist/
|
| 22 |
+
var/
|
| 23 |
+
wheels/
|
| 24 |
+
share/python-wheels/
|
| 25 |
+
*.egg-info/
|
| 26 |
+
.installed.cfg
|
| 27 |
+
*.egg
|
| 28 |
+
MANIFEST
|
| 29 |
+
|
| 30 |
+
# Environment Variables
|
| 31 |
+
.env
|
| 32 |
+
.venv
|
| 33 |
+
env/
|
| 34 |
+
venv/
|
| 35 |
+
ENV/
|
| 36 |
+
env.bak/
|
| 37 |
+
venv.bak/
|
| 38 |
+
|
| 39 |
+
# SQLite Database
|
| 40 |
+
*.db
|
| 41 |
+
backend/instance/
|
| 42 |
+
|
| 43 |
+
# Flask session data
|
| 44 |
+
flask_session/
|
| 45 |
+
|
| 46 |
+
# IDE Additions
|
| 47 |
+
.idea/
|
| 48 |
+
.vscode/
|
| 49 |
+
|
| 50 |
+
# Node
|
| 51 |
+
node_modules/
|
| 52 |
+
npm-debug.log*
|
| 53 |
+
yarn-debug.log*
|
| 54 |
+
yarn-error.log*
|
| 55 |
+
|
| 56 |
+
# Uploads and temporary files
|
| 57 |
+
frontend/image/uploads/
|
| 58 |
+
frontend/3d-assets/audio/
|
| 59 |
+
!frontend/3d-assets/audio/.gitkeep
|
README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PersonaFlow — Dynamic AI Conversation Agent Platform
|
| 2 |
+
|
| 3 |
+
> **AI Quick-Reference README** — This file exists so an AI assistant can rapidly understand the full project without scanning every file.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 🗂️ Project Overview
|
| 8 |
+
|
| 9 |
+
**PersonaFlow** is a full-stack web application that lets users:
|
| 10 |
+
- Create custom AI conversation agents with unique names, roles, personalities, and rules.
|
| 11 |
+
- Chat (text) or Video Call (3D avatar with lip-sync) with their agents.
|
| 12 |
+
- Share agents publicly via tokenized share links.
|
| 13 |
+
- Generate performance reports with scoring, summaries, feedback, and transcripts.
|
| 14 |
+
- Chat with an AI assistant about each agent's report data (Report Chat).
|
| 15 |
+
- Practice public speaking via an "Anchoring" agent that reads teleprompter-style scripts.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
## 🛠️ Tech Stack
|
| 20 |
+
|
| 21 |
+
| Layer | Technology |
|
| 22 |
+
|------------|---------------------------------------------------------|
|
| 23 |
+
| Backend | Python · Flask 3.0 · Flask-SQLAlchemy · Flask-CORS |
|
| 24 |
+
| Database | SQLite (`backend/instance/personaflow.db`) |
|
| 25 |
+
| AI Engine | Google Gemini API (default: `gemini-2.5-flash`) |
|
| 26 |
+
| TTS | Kokoro TTS (local neural TTS, no API key required) |
|
| 27 |
+
| STT | OpenAI Whisper (speech recognition via Google SR API) |
|
| 28 |
+
| Frontend | Vanilla HTML · CSS · JavaScript (SPA via hash router) |
|
| 29 |
+
| 3D Avatar | Three.js (GLTF/FBX models + custom lip-sync engine) |
|
| 30 |
+
| Fonts/Icons| Google Fonts (Inter) · Font Awesome 6.4 |
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## 📁 Project Structure
|
| 35 |
+
|
| 36 |
+
```
|
| 37 |
+
personaflow/
|
| 38 |
+
├── requirements.txt # Python deps
|
| 39 |
+
├── README.md # This file
|
| 40 |
+
│
|
| 41 |
+
├── backend/
|
| 42 |
+
│ ├── app.py # Main Flask app — all API routes
|
| 43 |
+
│ ├── models.py # SQLAlchemy DB models
|
| 44 |
+
│ ├── ai_service.py # AI API calls (Gemini format) — delegates prompt building to agent_behavior.py
|
| 45 |
+
│ ├── agent_behavior.py # Agent Behavior Engine — role detection, scope enforcement, prompt builder, response-length rules
|
| 46 |
+
│ ├── scoring_service.py # Conversation scoring/evaluation logic
|
| 47 |
+
│ ├── config.py # App config (secret key, DB URI, API keys)
|
| 48 |
+
│ └── migrate_anchoring.py # Migration script for anchoring columns
|
| 49 |
+
│
|
| 50 |
+
└── frontend/
|
| 51 |
+
├── index.html # SPA shell — sidebar, modal, toast containers
|
| 52 |
+
├── css/
|
| 53 |
+
│ └── styles.css # Single large stylesheet (~90KB), dark mode via [data-theme=dark]
|
| 54 |
+
├── image/
|
| 55 |
+
│ └── favicon.png # App logo / favicon
|
| 56 |
+
├── 3d-assets/ # GLTF/FBX avatar model files
|
| 57 |
+
└── js/
|
| 58 |
+
├── app.js # Global App object, auth state, dark mode toggle
|
| 59 |
+
├── api.js # API wrapper (all fetch calls)
|
| 60 |
+
├── router.js # Hash-based SPA router (#/page routing)
|
| 61 |
+
├── components/
|
| 62 |
+
│ ├── sidebar.js # Sidebar nav + user info + logout
|
| 63 |
+
│ ├── modal.js # Global modal helper
|
| 64 |
+
│ ├── toast.js # Toast notification helper
|
| 65 |
+
│ ├── notifications.js # Notification panel (positioned correctly above sidebar)
|
| 66 |
+
│ ├── onboarding.js # First-time user onboarding flow
|
| 67 |
+
│ ├── avatar3d.js # Three.js 3D avatar renderer + animation (54KB)
|
| 68 |
+
│ ├── lipsync-engine.js # Phoneme-based lip-sync engine for avatar
|
| 69 |
+
│ └── three-converter.js # Three.js GLB/FBX loader helper
|
| 70 |
+
└── pages/
|
| 71 |
+
├── login.js # Login page
|
| 72 |
+
├── signup.js # Signup page
|
| 73 |
+
├── dashboard.js # Dashboard — stats, recent conversations
|
| 74 |
+
├── agents.js # Agent list page — CRUD, filter, search
|
| 75 |
+
├── agent-wizard.js # 4-step agent creation wizard
|
| 76 |
+
├── agent-detail.js # Agent detail — tabs: Overview, Conversations, Reports, Share, Anchoring, Report Chat
|
| 77 |
+
├── chat.js # Text chat interface with agent
|
| 78 |
+
├── video-call.js # 3D Avatar video call (51KB) — TTS, STT, lip-sync
|
| 79 |
+
├── conversations.js # All conversations list page
|
| 80 |
+
├── reports.js # Reports list page (history of all report cards)
|
| 81 |
+
├── share-access.js # Public share link landing page (no auth required)
|
| 82 |
+
├── anchoring.js # Anchoring teleprompter — owner/local view
|
| 83 |
+
├── anchoring-remote.js # Anchoring remote control view
|
| 84 |
+
└── templates.js # Agent template data (now used inline in agent wizard)
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## 🗃️ Database Models (backend/models.py)
|
| 90 |
+
|
| 91 |
+
| Model | Key Fields |
|
| 92 |
+
|----------------|-------------------------------------------------------------------------------------------|
|
| 93 |
+
| `User` | id, name, email, password_hash, avatar_color |
|
| 94 |
+
| `Agent` | id, user_id, name, role, goal, opening_message, task_description, rules (JSON), tone, knowledge, output_config (JSON), icon, color, status, agent_type (`conversation`/`anchoring`), is_default, script_content |
|
| 95 |
+
| `Conversation` | id, agent_id, user_id, share_link_id, participant_name/email, mode (`text`/`video`), status (`active`/`completed`), started_at, ended_at |
|
| 96 |
+
| `Message` | id, conversation_id, role (`user`/`agent`), content, timestamp |
|
| 97 |
+
| `ShareLink` | id, agent_id, token, password_hash, expires_at, max_uses, current_uses, require_name/email |
|
| 98 |
+
| `Report` | id, conversation_id, overall_score, criteria_scores (JSON), summary, feedback, recommendations, transcript (JSON) |
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## 🔌 Backend API Routes (backend/app.py)
|
| 103 |
+
|
| 104 |
+
### Auth
|
| 105 |
+
| Method | Endpoint | Description |
|
| 106 |
+
|--------|-----------------------|----------------------|
|
| 107 |
+
| POST | `/api/auth/signup` | Register new user |
|
| 108 |
+
| POST | `/api/auth/login` | Login |
|
| 109 |
+
| POST | `/api/auth/logout` | Logout |
|
| 110 |
+
| GET | `/api/auth/me` | Current user info |
|
| 111 |
+
|
| 112 |
+
### Agents
|
| 113 |
+
| Method | Endpoint | Description |
|
| 114 |
+
|--------|-----------------------------------|------------------------------------|
|
| 115 |
+
| GET | `/api/agents` | List user's agents |
|
| 116 |
+
| POST | `/api/agents` | Create agent |
|
| 117 |
+
| GET | `/api/agents/<id>` | Get agent |
|
| 118 |
+
| PUT | `/api/agents/<id>` | Update agent |
|
| 119 |
+
| DELETE | `/api/agents/<id>` | Delete agent |
|
| 120 |
+
| GET | `/api/agents/<id>/share-links` | List share links |
|
| 121 |
+
| POST | `/api/agents/<id>/share-links` | Create share link |
|
| 122 |
+
| POST | `/api/agents/<id>/report-chat` | AI chat about agent's report data |
|
| 123 |
+
| POST | `/api/agents/<id>/export-report` | Export report as DOCX |
|
| 124 |
+
|
| 125 |
+
### Conversations
|
| 126 |
+
| Method | Endpoint | Description |
|
| 127 |
+
|--------|---------------------------------------------|--------------------------|
|
| 128 |
+
| GET | `/api/conversations` | List conversations |
|
| 129 |
+
| POST | `/api/conversations` | Create conversation |
|
| 130 |
+
| GET | `/api/conversations/<id>` | Get conversation + msgs |
|
| 131 |
+
| DELETE | `/api/conversations/<id>` | Delete conversation |
|
| 132 |
+
| POST | `/api/conversations/<id>/messages` | Send a message |
|
| 133 |
+
| POST | `/api/conversations/<id>/end` | End conversation + generate report |
|
| 134 |
+
|
| 135 |
+
### Reports
|
| 136 |
+
| Method | Endpoint | Description |
|
| 137 |
+
|--------|---------------------------------------|--------------------------------|
|
| 138 |
+
| GET | `/api/reports` | List all reports |
|
| 139 |
+
| GET | `/api/reports/<id>` | Get single report |
|
| 140 |
+
| POST | `/api/reports/generate/<conv_id>` | Generate report for conv |
|
| 141 |
+
|
| 142 |
+
### Public Share
|
| 143 |
+
| Method | Endpoint | Description |
|
| 144 |
+
|--------|---------------------------------|-----------------------------------|
|
| 145 |
+
| GET | `/api/share/<token>` | Get share link info |
|
| 146 |
+
| POST | `/api/share/<token>/verify` | Verify share link password |
|
| 147 |
+
| POST | `/api/share/<token>/start` | Start public share conversation |
|
| 148 |
+
| POST | `/api/share/<token>/message` | Send message in public share conv |
|
| 149 |
+
|
| 150 |
+
### Anchoring
|
| 151 |
+
| Method | Endpoint | Description |
|
| 152 |
+
|--------|-------------------------------------------------|--------------------------------|
|
| 153 |
+
| POST | `/api/anchoring/<agent_id>/start` | Start anchoring session |
|
| 154 |
+
| POST | `/api/anchoring/<agent_id>/control` | Pause / resume / stop |
|
| 155 |
+
| GET | `/api/anchoring/<agent_id>/status` | Get current line / status |
|
| 156 |
+
| POST | `/api/anchoring/tts` | TTS for a line of the script |
|
| 157 |
+
|
| 158 |
+
### Other
|
| 159 |
+
| Method | Endpoint | Description |
|
| 160 |
+
|--------|------------------------|---------------------|
|
| 161 |
+
| POST | `/api/upload` | Upload image file |
|
| 162 |
+
| POST | `/api/speech-to-text` | STT (Whisper) |
|
| 163 |
+
| POST | `/api/tts` | Edge TTS |
|
| 164 |
+
|
| 165 |
+
---
|
| 166 |
+
|
| 167 |
+
## 🖥️ Frontend Pages (SPA Routes)
|
| 168 |
+
|
| 169 |
+
| Hash Route | JS File | Description |
|
| 170 |
+
|----------------------|----------------------|-----------------------------------------------------|
|
| 171 |
+
| `#/login` | login.js | Login form |
|
| 172 |
+
| `#/signup` | signup.js | Signup form |
|
| 173 |
+
| `#/dashboard` | dashboard.js | Summary stats, recent conversations |
|
| 174 |
+
| `#/agents` | agents.js | Agent list with search, filter, create |
|
| 175 |
+
| `#/agents/new` | agent-wizard.js | 4-step creation wizard |
|
| 176 |
+
| `#/agents/:id` | agent-detail.js | Tabbed detail: Overview / Conversations / Reports / Share / Anchoring / Report Chat |
|
| 177 |
+
| `#/chat/:convId` | chat.js | Text chat UI |
|
| 178 |
+
| `#/video-call/:convId` | video-call.js | 3D avatar video call |
|
| 179 |
+
| `#/conversations` | conversations.js | All conversations history |
|
| 180 |
+
| `#/reports` | reports.js | All reports history (card list) |
|
| 181 |
+
| `#/share/:token` | share-access.js | Public shareable agent chat (no auth needed) |
|
| 182 |
+
| `#/anchoring/:id` | anchoring.js | Local anchoring teleprompter |
|
| 183 |
+
| `#/anchoring-remote/:id` | anchoring-remote.js | Remote anchoring control |
|
| 184 |
+
|
| 185 |
+
---
|
| 186 |
+
|
| 187 |
+
## ▶️ How to Run
|
| 188 |
+
|
| 189 |
+
```bash
|
| 190 |
+
# 1. Install Python dependencies
|
| 191 |
+
pip install -r requirements.txt
|
| 192 |
+
|
| 193 |
+
# 2. Configure your API key
|
| 194 |
+
# Set the GEMINI_API_KEY environment variable (or edit backend/config.py)
|
| 195 |
+
export GEMINI_API_KEY="your-api-key-here"
|
| 196 |
+
|
| 197 |
+
# 3. Start the backend server
|
| 198 |
+
cd backend
|
| 199 |
+
python app.py
|
| 200 |
+
# Server starts at http://localhost:5000
|
| 201 |
+
|
| 202 |
+
# 4. Open browser
|
| 203 |
+
# Navigate to: http://localhost:5000
|
| 204 |
+
```
|
| 205 |
+
|
| 206 |
+
---
|
| 207 |
+
|
| 208 |
+
## ⚙️ Configuration (backend/config.py)
|
| 209 |
+
|
| 210 |
+
| Setting | Default | Notes |
|
| 211 |
+
|-------------------------|------------------------------------|------------------------------------|
|
| 212 |
+
| `SECRET_KEY` | `personaflow-secret-key-...` | Change in production |
|
| 213 |
+
| `SQLALCHEMY_DATABASE_URI` | `sqlite:///personaflow.db` | DB stored in `backend/instance/` |
|
| 214 |
+
| `GEMINI_API_KEY` | `AIzaSyBiL-wOiS8Rj5h3YuC...` | Your Gemini API Key |
|
| 215 |
+
| `GEMINI_MODEL` | `gemini-2.5-flash` | LLM model name |
|
| 216 |
+
| `KOKORO_DEFAULT_VOICE` | `af_heart` | Default Kokoro TTS voice |
|
| 217 |
+
| `PERMANENT_SESSION_LIFETIME` | `86400` (24 hours) | Session expiry |
|
| 218 |
+
|
| 219 |
+
---
|
| 220 |
+
|
| 221 |
+
## 🔑 Key Architecture Decisions
|
| 222 |
+
|
| 223 |
+
- **SPA with hash routing**: `router.js` intercepts all `hashchange` events and renders the correct page module. No page reloads.
|
| 224 |
+
- **Auth**: Session-based (Flask sessions). Protected routes use `@login_required` decorator. Frontend checks `/api/auth/me` on load.
|
| 225 |
+
- **AI calls**: All AI interactions go through `ai_service.py` → Gemini REST API. System prompt building is handled by `agent_behavior.py`.
|
| 226 |
+
- **Agent Behavior Engine** (`agent_behavior.py`): Centralizes all prompt-building logic. Auto-detects role type (INTERVIEWER / TEACHER / COACH / EVALUATOR / DEFAULT) and injects role-specific behavioral instructions. Enforces strict scope via `output_config.strict_mode`. Applies response-length rules based on conversation `mode` — video calls get 1–2 sentence responses; text chat gets 3–4 sentences. Supports `output_config` behavior fields: `strict_mode`, `allow_out_of_scope`, `max_answer_length`, `behavior`.
|
| 227 |
+
- **Agent types**: Two types — `conversation` (standard chat bot) and `anchoring` (teleprompter script reader). Anchoring agents have `script_content` and in-memory state tracking (`anchoring_states` dict in `app.py`).
|
| 228 |
+
- **Reports**: Auto-generated on conversation end if `output_config.evaluation` is enabled. Can also be manually generated via the API. Stored in `Report` model.
|
| 229 |
+
- **Report Chat**: `/api/agents/<id>/report-chat` feeds all the agent's conversations + reports as context to the LLM so users can ask analytical questions.
|
| 230 |
+
- **Video Call**: Uses Three.js for 3D avatar rendering. Text-to-speech via **Kokoro TTS** (local neural). Speech-to-text via Whisper + Google Web Speech API. Custom phoneme-based lip-sync engine (`lipsync-engine.js`). Kokoro pipeline is initialized as a singleton at first TTS call to avoid reload overhead.
|
| 231 |
+
- **Dark mode**: Stored in `localStorage` as `personaflow-theme`. Applied via `[data-theme=dark]` attribute on `<html>`. Applied immediately in a blocking `<script>` before body renders to prevent flash.
|
| 232 |
+
- **Share links**: Tokenized URLs (`/api/share/<token>`). Support password protection, expiry, max uses, and required name/email fields.
|
| 233 |
+
- **Notifications panel**: Rendered as a fixed overlay, positioned to appear above the sidebar (z-index managed carefully).
|
| 234 |
+
|
| 235 |
+
---
|
| 236 |
+
|
| 237 |
+
## 🐛 Known Issues / Recent Work History
|
| 238 |
+
|
| 239 |
+
- **Report Chat** was moved from Reports page → Agent Detail page (agent-specific context). The `agent-detail.js` "Report Chat" tab contains the chat UI.
|
| 240 |
+
- **Reports page** (`reports.js`) shows only the report history list (no embedded chat).
|
| 241 |
+
- **Agent Creation Flow**: The `agent-wizard.js` now features a "choice screen" before the wizard starts, offering "Build from Scratch" (with inspiration idea cards) or "Use a Template" (rendering the template gallery inline).
|
| 242 |
+
- **Templates**: The dedicated `#/templates` page was removed from the sidebar. Templates are exclusively accessed via the new Create Agent choice screen.
|
| 243 |
+
- **TTS (Avatar Voice)**: Migrated from `edge-tts` (Microsoft) to **Kokoro TTS** (local neural TTS). The `/api/avatar/talk` endpoint now uses `KPipeline` from the `kokoro` Python package. Outputs `.wav` audio. On first run, Kokoro auto-downloads its model weights (~82MB). No API key required.
|
| 244 |
+
- **Agent Behavior Engine**: New `backend/agent_behavior.py` centralizes all system-prompt building. Extracted from `ai_service.py`. Role-specific prompt sections (Interviewer, Teacher, Coach, Evaluator, Default). `output_config` JSON now supports `strict_mode`, `allow_out_of_scope`, `max_answer_length`, and `behavior` fields.
|
| 245 |
+
- **Response Length (video vs text)**: `ai_service.generate_response()` now accepts a `mode` parameter. Video calls pass `mode='video'` (from `conversation.mode`) → agent replies in 1–2 sentences for natural interrupt-handling. Text chat uses `mode='text'` → 3–4 sentences max.
|
| 246 |
+
- **3D Avatar lip-sync**: Complex phoneme mapping via `lipsync-engine.js`. Debugging history in conversation logs.
|
| 247 |
+
- **Notifications panel**: Was clipping behind sidebar — fixed with proper z-index and positioning.
|
| 248 |
+
- **Anchoring**: In-memory state per `agent_id` (`anchoring_states` dict in `app.py`). Script read line-by-line via `/api/anchoring/<agent_id>/status` polling.
|
| 249 |
+
- **Share Link UI**: Redesigned the "Create Share Link" modal to improve UX, grouping password, expiry, and max uses into a cleaner layout, and converting to a toggle switch for the password field.
|
| 250 |
+
- **Code QA**: Reviewed backend API routes and fixed minor transcript generation logic consistency in manual report generation.
|
SRS.md
ADDED
|
@@ -0,0 +1,1199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Software Requirements Specification (SRS)
|
| 2 |
+
## PersonaFlow — Dynamic AI Conversation Agent Platform
|
| 3 |
+
|
| 4 |
+
**Version:** 1.0
|
| 5 |
+
**Date:** 2026-03-10
|
| 6 |
+
**Standard:** IEEE 830-1998
|
| 7 |
+
**Status:** Draft
|
| 8 |
+
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
## Table of Contents
|
| 12 |
+
|
| 13 |
+
1. [Introduction](#1-introduction)
|
| 14 |
+
2. [Overall Description](#2-overall-description)
|
| 15 |
+
3. [Functional Requirements](#3-functional-requirements)
|
| 16 |
+
4. [Non-Functional Requirements](#4-non-functional-requirements)
|
| 17 |
+
5. [System Architecture](#5-system-architecture)
|
| 18 |
+
6. [Use Case Diagrams](#6-use-case-diagrams)
|
| 19 |
+
7. [Data Flow Diagrams (DFD)](#7-data-flow-diagrams-dfd)
|
| 20 |
+
8. [Activity Diagrams](#8-activity-diagrams)
|
| 21 |
+
9. [Sequence Diagrams](#9-sequence-diagrams)
|
| 22 |
+
10. [Entity-Relationship Diagram](#10-entity-relationship-diagram)
|
| 23 |
+
11. [State Diagrams](#11-state-diagrams)
|
| 24 |
+
12. [Class Diagram](#12-class-diagram)
|
| 25 |
+
13. [API Specification](#13-api-specification)
|
| 26 |
+
14. [UI/UX Requirements](#14-uiux-requirements)
|
| 27 |
+
15. [External Interface Requirements](#15-external-interface-requirements)
|
| 28 |
+
16. [Constraints & Limitations](#16-constraints--limitations)
|
| 29 |
+
17. [Future Enhancements](#17-future-enhancements)
|
| 30 |
+
18. [Appendix](#18-appendix)
|
| 31 |
+
|
| 32 |
+
---
|
| 33 |
+
|
| 34 |
+
## 1. Introduction
|
| 35 |
+
|
| 36 |
+
### 1.1 Purpose
|
| 37 |
+
This Software Requirements Specification (SRS) defines the complete functional and non-functional requirements for **PersonaFlow**, a full-stack web application enabling users to create, manage, and interact with custom AI-powered conversation agents. This document is intended for developers, testers, and stakeholders.
|
| 38 |
+
|
| 39 |
+
### 1.2 Scope
|
| 40 |
+
PersonaFlow provides:
|
| 41 |
+
- Custom AI agent creation and management
|
| 42 |
+
- Text chat and 3D avatar video call interactions
|
| 43 |
+
- Public agent sharing via tokenized URLs
|
| 44 |
+
- Automated performance reporting and scoring
|
| 45 |
+
- AI-powered analytics chat over report data
|
| 46 |
+
- Teleprompter-style Anchoring mode for public speaking practice
|
| 47 |
+
|
| 48 |
+
### 1.3 Definitions & Acronyms
|
| 49 |
+
|
| 50 |
+
| Term | Definition |
|
| 51 |
+
|------|-----------|
|
| 52 |
+
| SPA | Single Page Application |
|
| 53 |
+
| LLM | Large Language Model |
|
| 54 |
+
| TTS | Text-to-Speech |
|
| 55 |
+
| STT | Speech-to-Text |
|
| 56 |
+
| SRS | Software Requirements Specification |
|
| 57 |
+
| GLTF | GL Transmission Format (3D model format) |
|
| 58 |
+
| FBX | Filmbox (3D model format) |
|
| 59 |
+
| FR | Functional Requirement |
|
| 60 |
+
| NFR | Non-Functional Requirement |
|
| 61 |
+
| API | Application Programming Interface |
|
| 62 |
+
| JWT | JSON Web Token |
|
| 63 |
+
| CRUD | Create, Read, Update, Delete |
|
| 64 |
+
| DFD | Data Flow Diagram |
|
| 65 |
+
|
| 66 |
+
### 1.4 References
|
| 67 |
+
- IEEE Std 830-1998: IEEE Recommended Practice for Software Requirements Specifications
|
| 68 |
+
- Flask 3.0 Documentation
|
| 69 |
+
- Ollama REST API Documentation
|
| 70 |
+
- Three.js Documentation
|
| 71 |
+
- Microsoft Edge TTS Documentation
|
| 72 |
+
- OpenAI Whisper Documentation
|
| 73 |
+
|
| 74 |
+
### 1.5 Overview
|
| 75 |
+
This document is structured into: overall system description, detailed functional requirements per module, non-functional requirements, and Mermaid-based UML/DFD diagrams covering all major system interactions and flows.
|
| 76 |
+
|
| 77 |
+
---
|
| 78 |
+
|
| 79 |
+
## 2. Overall Description
|
| 80 |
+
|
| 81 |
+
### 2.1 Product Perspective
|
| 82 |
+
PersonaFlow is a standalone web application deployed locally. It consists of:
|
| 83 |
+
- A **Flask** REST API backend (port 5000)
|
| 84 |
+
- A **Vanilla JavaScript SPA** frontend served by Flask
|
| 85 |
+
- A **SQLite** database for persistence
|
| 86 |
+
- An **Ollama** local LLM server (port 11434) for all AI inference
|
| 87 |
+
|
| 88 |
+
```mermaid
|
| 89 |
+
graph LR
|
| 90 |
+
Browser["🌐 Browser (SPA)"] <-->|HTTP/REST| Flask["🐍 Flask Server\n:5000"]
|
| 91 |
+
Flask <-->|REST| Ollama["🤖 Ollama LLM\n:11434"]
|
| 92 |
+
Flask <-->|File I/O| SQLite["🗄️ SQLite DB"]
|
| 93 |
+
Flask <-->|subprocess| EdgeTTS["🔊 Edge TTS"]
|
| 94 |
+
Flask <-->|subprocess| Whisper["🎤 Whisper STT"]
|
| 95 |
+
Browser <-->|WebAudio| Mic["🎙️ Microphone"]
|
| 96 |
+
```
|
| 97 |
+
|
| 98 |
+
### 2.2 Product Functions Summary
|
| 99 |
+
|
| 100 |
+
| Module | Core Function |
|
| 101 |
+
|--------|--------------|
|
| 102 |
+
| Authentication | User registration, login, session management |
|
| 103 |
+
| Agent Management | Create/edit/delete AI agents with full personality config |
|
| 104 |
+
| Text Chat | Real-time AI conversation in text mode |
|
| 105 |
+
| Video Call | 3D avatar AI conversation with TTS/STT/lip-sync |
|
| 106 |
+
| Share Links | Tokenized public agent sharing with access controls |
|
| 107 |
+
| Reports | Auto-generated evaluation reports per conversation |
|
| 108 |
+
| Report Chat | AI analytics over historical report data |
|
| 109 |
+
| Anchoring | Teleprompter script reader with TTS and remote control |
|
| 110 |
+
| Dashboard | Aggregated stats and recent activity |
|
| 111 |
+
|
| 112 |
+
### 2.3 User Classes
|
| 113 |
+
|
| 114 |
+
| User Class | Description | Access Level |
|
| 115 |
+
|------------|-------------|--------------|
|
| 116 |
+
| Registered User | Created account, can manage agents and conversations | Full access to own data |
|
| 117 |
+
| Guest (Share Link User) | Accesses agent via public token URL | Chat only, no auth required |
|
| 118 |
+
| Agent Owner | Registered user who created a specific agent | Full control of that agent |
|
| 119 |
+
|
| 120 |
+
### 2.4 Operating Environment
|
| 121 |
+
- **Server OS:** Windows / Linux / macOS
|
| 122 |
+
- **Python:** 3.10+
|
| 123 |
+
- **Browser:** Chrome/Edge (recommended for Web Speech API support)
|
| 124 |
+
- **Ollama:** Must be running locally at `localhost:11434`
|
| 125 |
+
- **Deployment:** Currently localhost only (`http://localhost:5000`)
|
| 126 |
+
|
| 127 |
+
### 2.5 Design Constraints
|
| 128 |
+
- All AI inference must remain local (Ollama); no external AI API calls
|
| 129 |
+
- SQLite database (single file, not suitable for concurrent multi-user production)
|
| 130 |
+
- Browser must support WebAudio API for video call features
|
| 131 |
+
- Three.js avatar requires WebGL-capable browser
|
| 132 |
+
|
| 133 |
+
### 2.6 Assumptions & Dependencies
|
| 134 |
+
- Ollama is installed and running with the `jarvis-x` model loaded
|
| 135 |
+
- Python 3.10+ with all `requirements.txt` packages installed
|
| 136 |
+
- User browser supports: ES6 modules, WebAudio API, WebGL, Web Speech API
|
| 137 |
+
- `edge-tts` CLI is available on the system PATH
|
| 138 |
+
|
| 139 |
+
---
|
| 140 |
+
|
| 141 |
+
## 3. Functional Requirements
|
| 142 |
+
|
| 143 |
+
### 3.1 Authentication (FR-AUTH)
|
| 144 |
+
|
| 145 |
+
| ID | Requirement |
|
| 146 |
+
|----|-------------|
|
| 147 |
+
| FR-AUTH-01 | The system shall allow new users to register with name, email, and password |
|
| 148 |
+
| FR-AUTH-02 | Passwords shall be stored as bcrypt hashes; plain text passwords shall never be persisted |
|
| 149 |
+
| FR-AUTH-03 | The system shall authenticate users via email/password and create a server-side session |
|
| 150 |
+
| FR-AUTH-04 | Sessions shall expire after 24 hours of inactivity |
|
| 151 |
+
| FR-AUTH-05 | The system shall expose `GET /api/auth/me` to return the current authenticated user's info |
|
| 152 |
+
| FR-AUTH-06 | All non-public API routes shall be protected with `@login_required` decorator |
|
| 153 |
+
| FR-AUTH-07 | The frontend SPA shall redirect unauthenticated users to `#/login` |
|
| 154 |
+
| FR-AUTH-08 | The system shall allow users to log out, destroying the server-side session |
|
| 155 |
+
| FR-AUTH-09 | Each user shall have an `avatar_color` field auto-assigned on registration |
|
| 156 |
+
|
| 157 |
+
### 3.2 Agent Management (FR-AGENT)
|
| 158 |
+
|
| 159 |
+
| ID | Requirement |
|
| 160 |
+
|----|-------------|
|
| 161 |
+
| FR-AGENT-01 | The system shall allow users to create AI agents with: name, role, goal, opening message, task description, rules (JSON array), tone, knowledge base text |
|
| 162 |
+
| FR-AGENT-02 | The system shall support a 4-step creation wizard UI for guided agent setup |
|
| 163 |
+
| FR-AGENT-03 | Each agent shall have an `output_config` JSON field containing at minimum an `evaluation` boolean flag |
|
| 164 |
+
| FR-AGENT-04 | Each agent shall have a visual icon and color for identification |
|
| 165 |
+
| FR-AGENT-05 | The system shall support two agent types: `conversation` and `anchoring` |
|
| 166 |
+
| FR-AGENT-06 | Users shall be able to list, view, update, and delete their own agents |
|
| 167 |
+
| FR-AGENT-07 | The system shall provide a template gallery with pre-built agent configurations |
|
| 168 |
+
| FR-AGENT-08 | Agent detail page shall display tabs: Overview, Conversations, Reports, Share, Anchoring, Report Chat |
|
| 169 |
+
| FR-AGENT-09 | The system shall support a default agent flag (`is_default`) per user |
|
| 170 |
+
| FR-AGENT-10 | Agent rules shall be stored as a JSON array and rendered as an editable list |
|
| 171 |
+
|
| 172 |
+
### 3.3 Text Chat (FR-CHAT)
|
| 173 |
+
|
| 174 |
+
| ID | Requirement |
|
| 175 |
+
|----|-------------|
|
| 176 |
+
| FR-CHAT-01 | The system shall create a `Conversation` record when a chat session begins |
|
| 177 |
+
| FR-CHAT-02 | Each user message shall be persisted as a `Message` record with role `user` |
|
| 178 |
+
| FR-CHAT-03 | The system shall call the Ollama LLM with agent personality context + full conversation history to generate responses |
|
| 179 |
+
| FR-CHAT-04 | Agent responses shall be persisted as `Message` records with role `agent` |
|
| 180 |
+
| FR-CHAT-05 | Chat UI shall display messages in chronological order with timestamps |
|
| 181 |
+
| FR-CHAT-06 | The system shall allow users to end a conversation, triggering report generation if evaluation is enabled |
|
| 182 |
+
| FR-CHAT-07 | Ending a conversation shall set its status to `completed` and record `ended_at` |
|
| 183 |
+
|
| 184 |
+
### 3.4 Video Call — 3D Avatar (FR-VIDEO)
|
| 185 |
+
|
| 186 |
+
| ID | Requirement |
|
| 187 |
+
|----|-------------|
|
| 188 |
+
| FR-VIDEO-01 | The system shall render a 3D avatar using Three.js from a GLTF/FBX model |
|
| 189 |
+
| FR-VIDEO-02 | The system shall convert agent text responses to audio using Edge TTS |
|
| 190 |
+
| FR-VIDEO-03 | The system shall convert user speech to text using Whisper STT |
|
| 191 |
+
| FR-VIDEO-04 | The microphone shall remain active at all times (always-on) with browser echo cancellation enabled |
|
| 192 |
+
| FR-VIDEO-05 | If the agent is speaking and the user speaks, the system shall interrupt TTS playback and process user input |
|
| 193 |
+
| FR-VIDEO-06 | The avatar shall animate lip movements using a phoneme-based lip-sync engine (`lipsync-engine.js`) |
|
| 194 |
+
| FR-VIDEO-07 | The avatar shall play idle animations when not speaking |
|
| 195 |
+
| FR-VIDEO-08 | Video call mode shall be set as `video` in the Conversation record |
|
| 196 |
+
|
| 197 |
+
### 3.5 Public Share Links (FR-SHARE)
|
| 198 |
+
|
| 199 |
+
| ID | Requirement |
|
| 200 |
+
|----|-------------|
|
| 201 |
+
| FR-SHARE-01 | Agent owners shall be able to generate tokenized share URLs for any of their agents |
|
| 202 |
+
| FR-SHARE-02 | Share links shall support optional password protection |
|
| 203 |
+
| FR-SHARE-03 | Share links shall support optional expiry date/time |
|
| 204 |
+
| FR-SHARE-04 | Share links shall support a maximum usage count (`max_uses`) |
|
| 205 |
+
| FR-SHARE-05 | Share links shall optionally require participant name and/or email before chat begins |
|
| 206 |
+
| FR-SHARE-06 | Public users (guests) shall access shared agents without creating an account |
|
| 207 |
+
| FR-SHARE-07 | Each use of a share link shall increment `current_uses`; once `max_uses` is reached, the link shall be disabled |
|
| 208 |
+
| FR-SHARE-08 | The system shall record participant name/email on the `Conversation` record |
|
| 209 |
+
|
| 210 |
+
### 3.6 Performance Reports (FR-REPORT)
|
| 211 |
+
|
| 212 |
+
| ID | Requirement |
|
| 213 |
+
|----|-------------|
|
| 214 |
+
| FR-REPORT-01 | The system shall auto-generate a report when a conversation ends if `output_config.evaluation` is `true` |
|
| 215 |
+
| FR-REPORT-02 | Reports shall include: overall score (0–100), per-criteria scores (JSON), summary, feedback, and recommendations |
|
| 216 |
+
| FR-REPORT-03 | Reports shall include the full conversation transcript as a JSON array |
|
| 217 |
+
| FR-REPORT-04 | Reports shall be manually triggerable via `POST /api/reports/generate/<conv_id>` |
|
| 218 |
+
| FR-REPORT-05 | Users shall be able to export any report as a DOCX file |
|
| 219 |
+
| FR-REPORT-06 | The Reports page shall display all reports as a history card list |
|
| 220 |
+
|
| 221 |
+
### 3.7 Report Chat — AI Analytics (FR-RCHAT)
|
| 222 |
+
|
| 223 |
+
| ID | Requirement |
|
| 224 |
+
|----|-------------|
|
| 225 |
+
| FR-RCHAT-01 | Each agent detail page shall include a Report Chat tab with an AI chatbot |
|
| 226 |
+
| FR-RCHAT-02 | The LLM context shall include all of the agent's past conversations and associated reports |
|
| 227 |
+
| FR-RCHAT-03 | Users shall be able to ask analytical questions (e.g., "What topics does this user struggle with?") |
|
| 228 |
+
| FR-RCHAT-04 | Report chat shall be agent-specific (isolated per agent, not global) |
|
| 229 |
+
|
| 230 |
+
### 3.8 Anchoring Mode (FR-ANCHOR)
|
| 231 |
+
|
| 232 |
+
| ID | Requirement |
|
| 233 |
+
|----|-------------|
|
| 234 |
+
| FR-ANCHOR-01 | The system shall support a special `anchoring` agent type with a `script_content` field |
|
| 235 |
+
| FR-ANCHOR-02 | The anchoring local view shall display the script as a teleprompter, advancing line by line |
|
| 236 |
+
| FR-ANCHOR-03 | The system shall read each script line via TTS using Edge TTS |
|
| 237 |
+
| FR-ANCHOR-04 | A remote control view shall allow pause, resume, and stop of an anchoring session |
|
| 238 |
+
| FR-ANCHOR-05 | Anchoring session state (current line, paused/running/stopped) shall be stored in-memory per `agent_id` |
|
| 239 |
+
| FR-ANCHOR-06 | Remote view shall poll `GET /api/anchoring/<agent_id>/status` to display current state |
|
| 240 |
+
|
| 241 |
+
### 3.9 Dashboard (FR-DASH)
|
| 242 |
+
|
| 243 |
+
| ID | Requirement |
|
| 244 |
+
|----|-------------|
|
| 245 |
+
| FR-DASH-01 | Dashboard shall display total agent count, total conversation count, and total report count for the user |
|
| 246 |
+
| FR-DASH-02 | Dashboard shall list the most recent conversations with agent name, date, and status |
|
| 247 |
+
|
| 248 |
+
### 3.10 Notifications & UI System (FR-UI)
|
| 249 |
+
|
| 250 |
+
| ID | Requirement |
|
| 251 |
+
|----|-------------|
|
| 252 |
+
| FR-UI-01 | The system shall display toast notifications for success and error events |
|
| 253 |
+
| FR-UI-02 | The system shall display a notification panel as a fixed overlay above the sidebar |
|
| 254 |
+
| FR-UI-03 | Dark mode shall be toggled via a UI control, persisted in `localStorage` as `personaflow-theme` |
|
| 255 |
+
| FR-UI-04 | Dark mode shall be applied via `[data-theme=dark]` attribute on `<html>` using a blocking script before body render to prevent flash |
|
| 256 |
+
| FR-UI-05 | A first-time onboarding flow shall guide new users through the platform features |
|
| 257 |
+
|
| 258 |
+
---
|
| 259 |
+
|
| 260 |
+
## 4. Non-Functional Requirements
|
| 261 |
+
|
| 262 |
+
### 4.1 Performance (NFR-PERF)
|
| 263 |
+
|
| 264 |
+
| ID | Requirement |
|
| 265 |
+
|----|-------------|
|
| 266 |
+
| NFR-PERF-01 | Text chat responses shall appear within 5 seconds under normal Ollama load |
|
| 267 |
+
| NFR-PERF-02 | TTS audio generation shall complete within 3 seconds for responses under 100 words |
|
| 268 |
+
| NFR-PERF-03 | Page navigation within the SPA shall complete in under 200ms (no network round-trip) |
|
| 269 |
+
| NFR-PERF-04 | 3D avatar shall render at a minimum of 30 FPS on WebGL-capable hardware |
|
| 270 |
+
|
| 271 |
+
### 4.2 Security (NFR-SEC)
|
| 272 |
+
|
| 273 |
+
| ID | Requirement |
|
| 274 |
+
|----|-------------|
|
| 275 |
+
| NFR-SEC-01 | All passwords shall be hashed with bcrypt before storage |
|
| 276 |
+
| NFR-SEC-02 | Session tokens shall be HTTP-only cookies managed by Flask |
|
| 277 |
+
| NFR-SEC-03 | Share link tokens shall be cryptographically random (UUID or similar) |
|
| 278 |
+
| NFR-SEC-04 | All authenticated API routes shall validate session on every request |
|
| 279 |
+
| NFR-SEC-05 | Users shall only be able to access their own agents, conversations, and reports |
|
| 280 |
+
|
| 281 |
+
### 4.3 Usability (NFR-USE)
|
| 282 |
+
|
| 283 |
+
| ID | Requirement |
|
| 284 |
+
|----|-------------|
|
| 285 |
+
| NFR-USE-01 | The UI shall support both light and dark mode without any flash on load |
|
| 286 |
+
| NFR-USE-02 | All important actions shall provide immediate feedback via toast notifications |
|
| 287 |
+
| NFR-USE-03 | The agent creation wizard shall be completable in under 5 minutes for a new user |
|
| 288 |
+
| NFR-USE-04 | The application shall be fully navigable via the sidebar without page reloads |
|
| 289 |
+
|
| 290 |
+
### 4.4 Reliability (NFR-REL)
|
| 291 |
+
|
| 292 |
+
| ID | Requirement |
|
| 293 |
+
|----|-------------|
|
| 294 |
+
| NFR-REL-01 | If Ollama is unavailable, the system shall return a user-friendly error without crashing |
|
| 295 |
+
| NFR-REL-02 | Database transactions shall be atomic; partial failures shall be rolled back |
|
| 296 |
+
| NFR-REL-03 | If TTS fails during video call, the system shall fall back to text-only display |
|
| 297 |
+
|
| 298 |
+
### 4.5 Maintainability (NFR-MAINT)
|
| 299 |
+
|
| 300 |
+
| ID | Requirement |
|
| 301 |
+
|----|-------------|
|
| 302 |
+
| NFR-MAINT-01 | All backend routes shall be contained in `app.py` with logical grouping by feature |
|
| 303 |
+
| NFR-MAINT-02 | AI interaction logic shall be isolated in `ai_service.py` |
|
| 304 |
+
| NFR-MAINT-03 | Frontend pages shall be separate JS modules in `frontend/js/pages/` |
|
| 305 |
+
| NFR-MAINT-04 | A single `api.js` module shall centralize all frontend HTTP calls |
|
| 306 |
+
|
| 307 |
+
---
|
| 308 |
+
|
| 309 |
+
## 5. System Architecture
|
| 310 |
+
|
| 311 |
+
### 5.1 High-Level Component Architecture
|
| 312 |
+
|
| 313 |
+
```mermaid
|
| 314 |
+
graph TB
|
| 315 |
+
subgraph Frontend["Frontend (SPA - Browser)"]
|
| 316 |
+
Router["router.js\nHash Router"]
|
| 317 |
+
Pages["Pages\n(login, dashboard, agents,\nchat, video-call, reports...)"]
|
| 318 |
+
Components["Components\n(sidebar, modal, toast,\navatar3d, lipsync-engine)"]
|
| 319 |
+
API_JS["api.js\nHTTP Client"]
|
| 320 |
+
Router --> Pages
|
| 321 |
+
Pages --> Components
|
| 322 |
+
Pages --> API_JS
|
| 323 |
+
end
|
| 324 |
+
|
| 325 |
+
subgraph Backend["Backend (Flask :5000)"]
|
| 326 |
+
AppPy["app.py\nFlask Routes"]
|
| 327 |
+
AI["ai_service.py\nOllama Calls"]
|
| 328 |
+
Scoring["scoring_service.py\nReport Scoring"]
|
| 329 |
+
Models["models.py\nSQLAlchemy ORM"]
|
| 330 |
+
Config["config.py"]
|
| 331 |
+
AppPy --> AI
|
| 332 |
+
AppPy --> Scoring
|
| 333 |
+
AppPy --> Models
|
| 334 |
+
AppPy --> Config
|
| 335 |
+
end
|
| 336 |
+
|
| 337 |
+
subgraph ExternalServices["External Services"]
|
| 338 |
+
Ollama["Ollama LLM\n:11434\n(jarvis-x)"]
|
| 339 |
+
EdgeTTS["Edge TTS\n(subprocess)"]
|
| 340 |
+
Whisper["Whisper STT\n(subprocess)"]
|
| 341 |
+
end
|
| 342 |
+
|
| 343 |
+
DB[("SQLite DB\npersonaflow.db")]
|
| 344 |
+
|
| 345 |
+
API_JS <-->|REST/JSON| AppPy
|
| 346 |
+
AI <-->|REST| Ollama
|
| 347 |
+
AppPy -->|spawn| EdgeTTS
|
| 348 |
+
AppPy -->|spawn| Whisper
|
| 349 |
+
Models <-->|SQL| DB
|
| 350 |
+
```
|
| 351 |
+
|
| 352 |
+
---
|
| 353 |
+
|
| 354 |
+
## 6. Use Case Diagrams
|
| 355 |
+
|
| 356 |
+
### 6.1 Overall System Use Cases
|
| 357 |
+
|
| 358 |
+
```mermaid
|
| 359 |
+
graph LR
|
| 360 |
+
RU(["👤 Registered User"])
|
| 361 |
+
GU(["👥 Guest User"])
|
| 362 |
+
|
| 363 |
+
RU --> UC1["Register / Login"]
|
| 364 |
+
RU --> UC2["Create / Manage Agents"]
|
| 365 |
+
RU --> UC3["Text Chat with Agent"]
|
| 366 |
+
RU --> UC4["Video Call with Agent"]
|
| 367 |
+
RU --> UC5["Generate Share Link"]
|
| 368 |
+
RU --> UC6["View Reports"]
|
| 369 |
+
RU --> UC7["Use Report Chat"]
|
| 370 |
+
RU --> UC8["Use Anchoring Mode"]
|
| 371 |
+
RU --> UC9["View Dashboard"]
|
| 372 |
+
RU --> UC10["Toggle Dark Mode"]
|
| 373 |
+
|
| 374 |
+
GU --> UC11["Access via Share Link"]
|
| 375 |
+
GU --> UC12["Chat with Shared Agent"]
|
| 376 |
+
|
| 377 |
+
UC3 --> UC13["Auto-generate Report"]
|
| 378 |
+
UC4 --> UC13
|
| 379 |
+
```
|
| 380 |
+
|
| 381 |
+
### 6.2 Agent Management Use Case
|
| 382 |
+
|
| 383 |
+
```mermaid
|
| 384 |
+
graph LR
|
| 385 |
+
U(["👤 User"])
|
| 386 |
+
U --> A["Create Agent\n(4-step wizard)"]
|
| 387 |
+
U --> B["Edit Agent"]
|
| 388 |
+
U --> C["Delete Agent"]
|
| 389 |
+
U --> D["View Agent Detail"]
|
| 390 |
+
U --> E["Browse Templates"]
|
| 391 |
+
E --> A
|
| 392 |
+
D --> F["Start Text Chat"]
|
| 393 |
+
D --> G["Start Video Call"]
|
| 394 |
+
D --> H["Manage Share Links"]
|
| 395 |
+
D --> I["View Reports Tab"]
|
| 396 |
+
D --> J["Use Report Chat Tab"]
|
| 397 |
+
D --> K["Use Anchoring Tab"]
|
| 398 |
+
```
|
| 399 |
+
|
| 400 |
+
---
|
| 401 |
+
|
| 402 |
+
## 7. Data Flow Diagrams (DFD)
|
| 403 |
+
|
| 404 |
+
### 7.1 Level 0 — Context Diagram
|
| 405 |
+
|
| 406 |
+
```mermaid
|
| 407 |
+
graph LR
|
| 408 |
+
User(["👤 User"]) -->|"Login, Chat, Reports"| PF["PersonaFlow\nSystem"]
|
| 409 |
+
Guest(["👥 Guest"]) -->|"Share link chat"| PF
|
| 410 |
+
PF -->|"AI Responses"| User
|
| 411 |
+
PF -->|"AI Responses"| Guest
|
| 412 |
+
PF <-->|"LLM Inference"| Ollama["Ollama LLM"]
|
| 413 |
+
PF <-->|"Text-to-Speech"| TTS["Edge TTS"]
|
| 414 |
+
PF <-->|"Speech-to-Text"| STT["Whisper STT"]
|
| 415 |
+
PF <-->|"Read/Write"| DB[("SQLite DB")]
|
| 416 |
+
```
|
| 417 |
+
|
| 418 |
+
### 7.2 Level 1 — Main Data Flows
|
| 419 |
+
|
| 420 |
+
```mermaid
|
| 421 |
+
flowchart TD
|
| 422 |
+
U["User"] -->|credentials| P1["1.0\nAuthentication"]
|
| 423 |
+
P1 -->|session token| U
|
| 424 |
+
P1 -->|user record| DB[("DB")]
|
| 425 |
+
|
| 426 |
+
U -->|agent config| P2["2.0\nAgent CRUD"]
|
| 427 |
+
P2 -->|agent data| DB
|
| 428 |
+
|
| 429 |
+
U -->|message| P3["3.0\nChat Processing"]
|
| 430 |
+
P3 -->|conversation+messages| DB
|
| 431 |
+
P3 -->|prompt+history| P6["6.0\nOllama LLM"]
|
| 432 |
+
P6 -->|AI response| P3
|
| 433 |
+
P3 -->|AI response| U
|
| 434 |
+
|
| 435 |
+
U -->|voice input| P4["4.0\nVideo Call"]
|
| 436 |
+
P4 -->|audio| P7["7.0\nWhisper STT"]
|
| 437 |
+
P7 -->|text| P4
|
| 438 |
+
P4 -->|text| P6
|
| 439 |
+
P6 -->|response text| P4
|
| 440 |
+
P4 -->|text| P8["8.0\nEdge TTS"]
|
| 441 |
+
P8 -->|audio stream| U
|
| 442 |
+
|
| 443 |
+
P3 -->|conversation end| P5["5.0\nReport Generation"]
|
| 444 |
+
P5 -->|prompt| P6
|
| 445 |
+
P6 -->|scores+summary| P5
|
| 446 |
+
P5 -->|report| DB
|
| 447 |
+
DB -->|report data| U
|
| 448 |
+
```
|
| 449 |
+
|
| 450 |
+
### 7.3 Level 2 — Chat Processing Detail
|
| 451 |
+
|
| 452 |
+
```mermaid
|
| 453 |
+
flowchart TD
|
| 454 |
+
U["User"] -->|user message| A["Receive & Validate Message"]
|
| 455 |
+
A -->|save| B["Persist User Message\n(Message table)"]
|
| 456 |
+
B -->|conv_id| C["Fetch Full Conversation History"]
|
| 457 |
+
C -->|messages| D["Build LLM Prompt\n(system prompt + history)"]
|
| 458 |
+
D -->|prompt JSON| E["POST /api/chat\nOllama"]
|
| 459 |
+
E -->|response text| F["Persist Agent Message"]
|
| 460 |
+
F -->|response| G["Return JSON to Frontend"]
|
| 461 |
+
G -->|display| U
|
| 462 |
+
```
|
| 463 |
+
|
| 464 |
+
---
|
| 465 |
+
|
| 466 |
+
## 8. Activity Diagrams
|
| 467 |
+
|
| 468 |
+
### 8.1 User Registration & Login Flow
|
| 469 |
+
|
| 470 |
+
```mermaid
|
| 471 |
+
flowchart TD
|
| 472 |
+
Start([Start]) --> A["Open App"]
|
| 473 |
+
A --> B{"Has Account?"}
|
| 474 |
+
B -->|No| C["Navigate to #/signup"]
|
| 475 |
+
C --> D["Enter Name, Email, Password"]
|
| 476 |
+
D --> E["POST /api/auth/signup"]
|
| 477 |
+
E --> F{"Valid?"}
|
| 478 |
+
F -->|No| G["Show Error Toast"] --> D
|
| 479 |
+
F -->|Yes| H["Create User + Session"]
|
| 480 |
+
H --> I["Redirect to #/dashboard"]
|
| 481 |
+
B -->|Yes| J["Navigate to #/login"]
|
| 482 |
+
J --> K["Enter Email + Password"]
|
| 483 |
+
K --> L["POST /api/auth/login"]
|
| 484 |
+
L --> M{"Valid?"}
|
| 485 |
+
M -->|No| N["Show Error Toast"] --> K
|
| 486 |
+
M -->|Yes| O["Create Session"]
|
| 487 |
+
O --> I
|
| 488 |
+
I --> End([End])
|
| 489 |
+
```
|
| 490 |
+
|
| 491 |
+
### 8.2 Agent Creation Wizard Activity
|
| 492 |
+
|
| 493 |
+
```mermaid
|
| 494 |
+
flowchart TD
|
| 495 |
+
Start([Start]) --> S1["Step 1: Basic Info\n(name, role, icon, color)"]
|
| 496 |
+
S1 --> V1{"All required\nfields filled?"}
|
| 497 |
+
V1 -->|No| S1
|
| 498 |
+
V1 -->|Yes| S2["Step 2: Personality\n(goal, tone, rules, opening message)"]
|
| 499 |
+
S2 --> V2{"Valid?"}
|
| 500 |
+
V2 -->|No| S2
|
| 501 |
+
V2 -->|Yes| S3["Step 3: Knowledge Base\n(knowledge text, task description)"]
|
| 502 |
+
S3 --> S4["Step 4: Output Config\n(evaluation on/off, agent type)"]
|
| 503 |
+
S4 --> Post["POST /api/agents"]
|
| 504 |
+
Post --> R{"Created?"}
|
| 505 |
+
R -->|Error| Err["Show Error"] --> S1
|
| 506 |
+
R -->|Success| Nav["Navigate to Agent Detail"]
|
| 507 |
+
Nav --> End([End])
|
| 508 |
+
```
|
| 509 |
+
|
| 510 |
+
### 8.3 Video Call Flow Activity
|
| 511 |
+
|
| 512 |
+
```mermaid
|
| 513 |
+
flowchart TD
|
| 514 |
+
Start([Start]) --> A["Load 3D Avatar\n(Three.js)"]
|
| 515 |
+
A --> B["Create Conversation\n(mode=video)"]
|
| 516 |
+
B --> C["Start Always-On Mic\n(echo cancellation ON)"]
|
| 517 |
+
C --> D{"User Speaking?"}
|
| 518 |
+
D -->|No| D
|
| 519 |
+
D -->|Yes| E["Capture Audio"]
|
| 520 |
+
E --> F["POST /api/speech-to-text\n(Whisper)"]
|
| 521 |
+
F --> G["Get Transcript Text"]
|
| 522 |
+
G --> H{"Agent Currently\nSpeaking?"}
|
| 523 |
+
H -->|Yes| I["Interrupt: Stop TTS Audio"]
|
| 524 |
+
I --> J["Send Text to LLM"]
|
| 525 |
+
H -->|No| J
|
| 526 |
+
J --> K["Receive AI Response"]
|
| 527 |
+
K --> L["POST /api/tts\n(Edge TTS)"]
|
| 528 |
+
L --> M["Play Audio + Lip-sync\nAnimation"]
|
| 529 |
+
M --> N{"Conversation\nEnded?"}
|
| 530 |
+
N -->|No| D
|
| 531 |
+
N -->|Yes| O["POST /conversations/:id/end"]
|
| 532 |
+
O --> End([End])
|
| 533 |
+
```
|
| 534 |
+
|
| 535 |
+
### 8.4 Report Generation Activity
|
| 536 |
+
|
| 537 |
+
```mermaid
|
| 538 |
+
flowchart TD
|
| 539 |
+
Start([Start]) --> A["User Ends Conversation"]
|
| 540 |
+
A --> B["POST /conversations/:id/end"]
|
| 541 |
+
B --> C{"evaluation\nenabled?"}
|
| 542 |
+
C -->|No| D["Set status=completed"] --> End([End])
|
| 543 |
+
C -->|Yes| E["Fetch Full Transcript"]
|
| 544 |
+
E --> F["Build Scoring Prompt\n(ai_service.py)"]
|
| 545 |
+
F --> G["POST Ollama\n(scoring + summary)"]
|
| 546 |
+
G --> H["Parse Scores JSON"]
|
| 547 |
+
H --> I{"Parse\nSuccessful?"}
|
| 548 |
+
I -->|No| J["Use Default Scores"]
|
| 549 |
+
I -->|Yes| K["Create Report Record\n(overall_score, criteria_scores,\nsummary, feedback, recommendations)"]
|
| 550 |
+
J --> K
|
| 551 |
+
K --> L["Save Transcript JSON"]
|
| 552 |
+
L --> M["Return Report ID"]
|
| 553 |
+
M --> End
|
| 554 |
+
```
|
| 555 |
+
|
| 556 |
+
### 8.5 Anchoring Session Activity
|
| 557 |
+
|
| 558 |
+
```mermaid
|
| 559 |
+
flowchart TD
|
| 560 |
+
Start([Start]) --> A["Owner Opens Anchoring Tab"]
|
| 561 |
+
A --> B["POST /api/anchoring/:id/start"]
|
| 562 |
+
B --> C["Initialize In-Memory State\n(line=0, status=running)"]
|
| 563 |
+
C --> D["Remote Polls Status\n(GET /status every 2s)"]
|
| 564 |
+
D --> E["Fetch Current Line Text"]
|
| 565 |
+
E --> F["POST /api/anchoring/tts\n(Edge TTS for line)"]
|
| 566 |
+
F --> G["Play Audio to Audience"]
|
| 567 |
+
G --> H{"Remote\nCommand?"}
|
| 568 |
+
H -->|Pause| I["Set status=paused"] --> D
|
| 569 |
+
H -->|Resume| J["Set status=running"] --> E
|
| 570 |
+
H -->|Stop| K["Clear In-Memory State"] --> End([End])
|
| 571 |
+
H -->|None| L{"More\nLines?"}
|
| 572 |
+
L -->|Yes| M["Increment line++"] --> E
|
| 573 |
+
L -->|No| K
|
| 574 |
+
```
|
| 575 |
+
|
| 576 |
+
---
|
| 577 |
+
|
| 578 |
+
## 9. Sequence Diagrams
|
| 579 |
+
|
| 580 |
+
### 9.1 User Login Sequence
|
| 581 |
+
|
| 582 |
+
```mermaid
|
| 583 |
+
sequenceDiagram
|
| 584 |
+
actor User
|
| 585 |
+
participant Browser as Browser (SPA)
|
| 586 |
+
participant Flask as Flask Backend
|
| 587 |
+
participant DB as SQLite DB
|
| 588 |
+
|
| 589 |
+
User->>Browser: Enter email + password → Click Login
|
| 590 |
+
Browser->>Flask: POST /api/auth/login {email, password}
|
| 591 |
+
Flask->>DB: SELECT User WHERE email=?
|
| 592 |
+
DB-->>Flask: User record
|
| 593 |
+
Flask->>Flask: bcrypt.check_password_hash()
|
| 594 |
+
alt Invalid credentials
|
| 595 |
+
Flask-->>Browser: 401 {error: "Invalid credentials"}
|
| 596 |
+
Browser-->>User: Show error toast
|
| 597 |
+
else Valid
|
| 598 |
+
Flask->>Flask: session['user_id'] = user.id
|
| 599 |
+
Flask-->>Browser: 200 {user: {...}}
|
| 600 |
+
Browser->>Browser: Store user in App.state
|
| 601 |
+
Browser-->>User: Redirect to #/dashboard
|
| 602 |
+
end
|
| 603 |
+
```
|
| 604 |
+
|
| 605 |
+
### 9.2 Text Chat Message Sequence
|
| 606 |
+
|
| 607 |
+
```mermaid
|
| 608 |
+
sequenceDiagram
|
| 609 |
+
actor User
|
| 610 |
+
participant Chat as chat.js
|
| 611 |
+
participant API as api.js
|
| 612 |
+
participant Flask as Flask Backend
|
| 613 |
+
participant Ollama as Ollama LLM
|
| 614 |
+
participant DB as SQLite DB
|
| 615 |
+
|
| 616 |
+
User->>Chat: Type message → Send
|
| 617 |
+
Chat->>API: sendMessage(convId, text)
|
| 618 |
+
API->>Flask: POST /api/conversations/:id/messages
|
| 619 |
+
Flask->>DB: INSERT Message(role=user, content)
|
| 620 |
+
Flask->>DB: SELECT all Messages for conversation
|
| 621 |
+
DB-->>Flask: Full message history
|
| 622 |
+
Flask->>Flask: Build system prompt from Agent config
|
| 623 |
+
Flask->>Ollama: POST /api/chat {model, messages}
|
| 624 |
+
Ollama-->>Flask: {response: "AI reply text"}
|
| 625 |
+
Flask->>DB: INSERT Message(role=agent, content)
|
| 626 |
+
Flask-->>API: 200 {message: {...}}
|
| 627 |
+
API-->>Chat: Agent response text
|
| 628 |
+
Chat-->>User: Render agent message bubble
|
| 629 |
+
```
|
| 630 |
+
|
| 631 |
+
### 9.3 Video Call with Interrupt Sequence
|
| 632 |
+
|
| 633 |
+
```mermaid
|
| 634 |
+
sequenceDiagram
|
| 635 |
+
actor User
|
| 636 |
+
participant VC as video-call.js
|
| 637 |
+
participant STT as Whisper STT
|
| 638 |
+
participant Flask as Flask Backend
|
| 639 |
+
participant Ollama as Ollama LLM
|
| 640 |
+
participant TTS as Edge TTS
|
| 641 |
+
participant Avatar as avatar3d.js
|
| 642 |
+
|
| 643 |
+
User->>VC: Speak (mic always on)
|
| 644 |
+
VC->>STT: POST /api/speech-to-text (audio blob)
|
| 645 |
+
STT-->>VC: {transcript: "user speech text"}
|
| 646 |
+
|
| 647 |
+
alt Agent is currently speaking
|
| 648 |
+
VC->>VC: Stop audio playback immediately
|
| 649 |
+
VC->>Avatar: Stop lip-sync animation
|
| 650 |
+
end
|
| 651 |
+
|
| 652 |
+
VC->>Flask: POST /api/conversations/:id/messages
|
| 653 |
+
Flask->>Ollama: POST /api/chat {prompt}
|
| 654 |
+
Ollama-->>Flask: {response: "AI reply"}
|
| 655 |
+
Flask-->>VC: Agent response text
|
| 656 |
+
VC->>Flask: POST /api/tts {text}
|
| 657 |
+
Flask->>TTS: edge-tts --text "..." --write-media
|
| 658 |
+
TTS-->>Flask: audio file
|
| 659 |
+
Flask-->>VC: audio stream
|
| 660 |
+
VC->>Avatar: Play audio + start lip-sync
|
| 661 |
+
Avatar-->>User: Animated avatar speaks
|
| 662 |
+
```
|
| 663 |
+
|
| 664 |
+
### 9.4 Share Link — Guest Chat Sequence
|
| 665 |
+
|
| 666 |
+
```mermaid
|
| 667 |
+
sequenceDiagram
|
| 668 |
+
actor Guest
|
| 669 |
+
participant Browser as Browser (SPA)
|
| 670 |
+
participant Flask as Flask Backend
|
| 671 |
+
participant DB as SQLite DB
|
| 672 |
+
participant Ollama as Ollama LLM
|
| 673 |
+
|
| 674 |
+
Guest->>Browser: Open /share/<token>
|
| 675 |
+
Browser->>Flask: GET /api/share/<token>
|
| 676 |
+
Flask->>DB: SELECT ShareLink WHERE token=?
|
| 677 |
+
DB-->>Flask: ShareLink record
|
| 678 |
+
Flask-->>Browser: {agent_name, require_name, require_email, has_password}
|
| 679 |
+
|
| 680 |
+
alt Password Required
|
| 681 |
+
Browser-->>Guest: Show password form
|
| 682 |
+
Guest->>Browser: Enter password
|
| 683 |
+
Browser->>Flask: POST /api/share/<token>/verify {password}
|
| 684 |
+
Flask-->>Browser: 200 OK / 401
|
| 685 |
+
end
|
| 686 |
+
|
| 687 |
+
alt Name/Email Required
|
| 688 |
+
Browser-->>Guest: Show info form
|
| 689 |
+
Guest->>Browser: Enter name/email
|
| 690 |
+
end
|
| 691 |
+
|
| 692 |
+
Browser->>Flask: POST /api/share/<token>/start {name, email}
|
| 693 |
+
Flask->>DB: CREATE Conversation(share_link_id, participant_name/email)
|
| 694 |
+
Flask->>DB: UPDATE ShareLink(current_uses++)
|
| 695 |
+
Flask-->>Browser: {conv_id}
|
| 696 |
+
|
| 697 |
+
Guest->>Browser: Type message
|
| 698 |
+
Browser->>Flask: POST /api/share/<token>/message {conv_id, content}
|
| 699 |
+
Flask->>Ollama: POST /api/chat
|
| 700 |
+
Ollama-->>Flask: response
|
| 701 |
+
Flask-->>Browser: agent message
|
| 702 |
+
Browser-->>Guest: Display response
|
| 703 |
+
```
|
| 704 |
+
|
| 705 |
+
### 9.5 Report Generation Sequence
|
| 706 |
+
|
| 707 |
+
```mermaid
|
| 708 |
+
sequenceDiagram
|
| 709 |
+
actor User
|
| 710 |
+
participant Chat as chat.js
|
| 711 |
+
participant Flask as Flask Backend
|
| 712 |
+
participant AI as ai_service.py
|
| 713 |
+
participant Scoring as scoring_service.py
|
| 714 |
+
participant Ollama as Ollama LLM
|
| 715 |
+
participant DB as SQLite DB
|
| 716 |
+
|
| 717 |
+
User->>Chat: Click "End Conversation"
|
| 718 |
+
Chat->>Flask: POST /api/conversations/:id/end
|
| 719 |
+
Flask->>DB: UPDATE Conversation(status=completed, ended_at=now)
|
| 720 |
+
Flask->>DB: SELECT Agent(output_config)
|
| 721 |
+
|
| 722 |
+
alt evaluation == true
|
| 723 |
+
Flask->>DB: SELECT all Messages for conversation
|
| 724 |
+
DB-->>Flask: transcript array
|
| 725 |
+
Flask->>AI: generate_report(transcript, agent_config)
|
| 726 |
+
AI->>Scoring: build_scoring_prompt()
|
| 727 |
+
Scoring-->>AI: prompt string
|
| 728 |
+
AI->>Ollama: POST /api/chat {scoring prompt}
|
| 729 |
+
Ollama-->>AI: {scores JSON, summary, feedback}
|
| 730 |
+
AI->>DB: INSERT Report(overall_score, criteria_scores, summary, feedback, recommendations, transcript)
|
| 731 |
+
DB-->>AI: report.id
|
| 732 |
+
AI-->>Flask: report object
|
| 733 |
+
Flask-->>Chat: 200 {report_id}
|
| 734 |
+
Chat-->>User: Show "Report Generated" + link
|
| 735 |
+
else evaluation == false
|
| 736 |
+
Flask-->>Chat: 200 {message: "Conversation ended"}
|
| 737 |
+
end
|
| 738 |
+
```
|
| 739 |
+
|
| 740 |
+
---
|
| 741 |
+
|
| 742 |
+
## 10. Entity-Relationship Diagram
|
| 743 |
+
|
| 744 |
+
```mermaid
|
| 745 |
+
erDiagram
|
| 746 |
+
USER {
|
| 747 |
+
int id PK
|
| 748 |
+
string name
|
| 749 |
+
string email UK
|
| 750 |
+
string password_hash
|
| 751 |
+
string avatar_color
|
| 752 |
+
}
|
| 753 |
+
|
| 754 |
+
AGENT {
|
| 755 |
+
int id PK
|
| 756 |
+
int user_id FK
|
| 757 |
+
string name
|
| 758 |
+
string role
|
| 759 |
+
string goal
|
| 760 |
+
string opening_message
|
| 761 |
+
string task_description
|
| 762 |
+
json rules
|
| 763 |
+
string tone
|
| 764 |
+
text knowledge
|
| 765 |
+
json output_config
|
| 766 |
+
string icon
|
| 767 |
+
string color
|
| 768 |
+
string status
|
| 769 |
+
string agent_type
|
| 770 |
+
bool is_default
|
| 771 |
+
text script_content
|
| 772 |
+
}
|
| 773 |
+
|
| 774 |
+
CONVERSATION {
|
| 775 |
+
int id PK
|
| 776 |
+
int agent_id FK
|
| 777 |
+
int user_id FK
|
| 778 |
+
int share_link_id FK
|
| 779 |
+
string participant_name
|
| 780 |
+
string participant_email
|
| 781 |
+
string mode
|
| 782 |
+
string status
|
| 783 |
+
datetime started_at
|
| 784 |
+
datetime ended_at
|
| 785 |
+
}
|
| 786 |
+
|
| 787 |
+
MESSAGE {
|
| 788 |
+
int id PK
|
| 789 |
+
int conversation_id FK
|
| 790 |
+
string role
|
| 791 |
+
text content
|
| 792 |
+
datetime timestamp
|
| 793 |
+
}
|
| 794 |
+
|
| 795 |
+
SHARELINK {
|
| 796 |
+
int id PK
|
| 797 |
+
int agent_id FK
|
| 798 |
+
string token UK
|
| 799 |
+
string password_hash
|
| 800 |
+
datetime expires_at
|
| 801 |
+
int max_uses
|
| 802 |
+
int current_uses
|
| 803 |
+
bool require_name
|
| 804 |
+
bool require_email
|
| 805 |
+
}
|
| 806 |
+
|
| 807 |
+
REPORT {
|
| 808 |
+
int id PK
|
| 809 |
+
int conversation_id FK
|
| 810 |
+
float overall_score
|
| 811 |
+
json criteria_scores
|
| 812 |
+
text summary
|
| 813 |
+
text feedback
|
| 814 |
+
text recommendations
|
| 815 |
+
json transcript
|
| 816 |
+
}
|
| 817 |
+
|
| 818 |
+
USER ||--o{ AGENT : "owns"
|
| 819 |
+
USER ||--o{ CONVERSATION : "participates in"
|
| 820 |
+
AGENT ||--o{ CONVERSATION : "has"
|
| 821 |
+
AGENT ||--o{ SHARELINK : "has"
|
| 822 |
+
CONVERSATION ||--o{ MESSAGE : "contains"
|
| 823 |
+
CONVERSATION ||--o| REPORT : "generates"
|
| 824 |
+
SHARELINK ||--o{ CONVERSATION : "starts"
|
| 825 |
+
```
|
| 826 |
+
|
| 827 |
+
---
|
| 828 |
+
|
| 829 |
+
## 11. State Diagrams
|
| 830 |
+
|
| 831 |
+
### 11.1 Conversation State Machine
|
| 832 |
+
|
| 833 |
+
```mermaid
|
| 834 |
+
stateDiagram-v2
|
| 835 |
+
[*] --> Active : POST /api/conversations (create)
|
| 836 |
+
Active --> Active : POST /messages (send message)
|
| 837 |
+
Active --> Completed : POST /end (user ends conversation)
|
| 838 |
+
Completed --> [*] : DELETE /conversations/:id
|
| 839 |
+
Active --> [*] : DELETE /conversations/:id
|
| 840 |
+
|
| 841 |
+
state Completed {
|
| 842 |
+
[*] --> ReportPending
|
| 843 |
+
ReportPending --> ReportGenerated : evaluation=true + LLM success
|
| 844 |
+
ReportPending --> NoReport : evaluation=false
|
| 845 |
+
}
|
| 846 |
+
```
|
| 847 |
+
|
| 848 |
+
### 11.2 Share Link State Machine
|
| 849 |
+
|
| 850 |
+
```mermaid
|
| 851 |
+
stateDiagram-v2
|
| 852 |
+
[*] --> Active : POST /share-links (create)
|
| 853 |
+
Active --> Active : Guest uses (current_uses < max_uses)
|
| 854 |
+
Active --> Exhausted : current_uses == max_uses
|
| 855 |
+
Active --> Expired : datetime > expires_at
|
| 856 |
+
Exhausted --> [*]
|
| 857 |
+
Expired --> [*]
|
| 858 |
+
Active --> [*] : Owner deletes
|
| 859 |
+
```
|
| 860 |
+
|
| 861 |
+
### 11.3 Anchoring Session State Machine
|
| 862 |
+
|
| 863 |
+
```mermaid
|
| 864 |
+
stateDiagram-v2
|
| 865 |
+
[*] --> Running : POST /anchoring/:id/start
|
| 866 |
+
Running --> Paused : POST /control {action: pause}
|
| 867 |
+
Paused --> Running : POST /control {action: resume}
|
| 868 |
+
Running --> Stopped : POST /control {action: stop}
|
| 869 |
+
Running --> Stopped : Last line read
|
| 870 |
+
Paused --> Stopped : POST /control {action: stop}
|
| 871 |
+
Stopped --> [*] : In-memory state cleared
|
| 872 |
+
```
|
| 873 |
+
|
| 874 |
+
---
|
| 875 |
+
|
| 876 |
+
## 12. Class Diagram
|
| 877 |
+
|
| 878 |
+
```mermaid
|
| 879 |
+
classDiagram
|
| 880 |
+
class User {
|
| 881 |
+
+int id
|
| 882 |
+
+string name
|
| 883 |
+
+string email
|
| 884 |
+
+string password_hash
|
| 885 |
+
+string avatar_color
|
| 886 |
+
+set_password(password)
|
| 887 |
+
+check_password(password) bool
|
| 888 |
+
}
|
| 889 |
+
|
| 890 |
+
class Agent {
|
| 891 |
+
+int id
|
| 892 |
+
+int user_id
|
| 893 |
+
+string name
|
| 894 |
+
+string role
|
| 895 |
+
+string goal
|
| 896 |
+
+string opening_message
|
| 897 |
+
+string task_description
|
| 898 |
+
+list rules
|
| 899 |
+
+string tone
|
| 900 |
+
+string knowledge
|
| 901 |
+
+dict output_config
|
| 902 |
+
+string icon
|
| 903 |
+
+string color
|
| 904 |
+
+string status
|
| 905 |
+
+string agent_type
|
| 906 |
+
+bool is_default
|
| 907 |
+
+string script_content
|
| 908 |
+
+to_dict() dict
|
| 909 |
+
}
|
| 910 |
+
|
| 911 |
+
class Conversation {
|
| 912 |
+
+int id
|
| 913 |
+
+int agent_id
|
| 914 |
+
+int user_id
|
| 915 |
+
+int share_link_id
|
| 916 |
+
+string participant_name
|
| 917 |
+
+string participant_email
|
| 918 |
+
+string mode
|
| 919 |
+
+string status
|
| 920 |
+
+datetime started_at
|
| 921 |
+
+datetime ended_at
|
| 922 |
+
+to_dict() dict
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
class Message {
|
| 926 |
+
+int id
|
| 927 |
+
+int conversation_id
|
| 928 |
+
+string role
|
| 929 |
+
+string content
|
| 930 |
+
+datetime timestamp
|
| 931 |
+
+to_dict() dict
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
class ShareLink {
|
| 935 |
+
+int id
|
| 936 |
+
+int agent_id
|
| 937 |
+
+string token
|
| 938 |
+
+string password_hash
|
| 939 |
+
+datetime expires_at
|
| 940 |
+
+int max_uses
|
| 941 |
+
+int current_uses
|
| 942 |
+
+bool require_name
|
| 943 |
+
+bool require_email
|
| 944 |
+
+is_valid() bool
|
| 945 |
+
+set_password(password)
|
| 946 |
+
+check_password(password) bool
|
| 947 |
+
}
|
| 948 |
+
|
| 949 |
+
class Report {
|
| 950 |
+
+int id
|
| 951 |
+
+int conversation_id
|
| 952 |
+
+float overall_score
|
| 953 |
+
+dict criteria_scores
|
| 954 |
+
+string summary
|
| 955 |
+
+string feedback
|
| 956 |
+
+string recommendations
|
| 957 |
+
+list transcript
|
| 958 |
+
+to_dict() dict
|
| 959 |
+
}
|
| 960 |
+
|
| 961 |
+
class AIService {
|
| 962 |
+
+chat(agent, history) string
|
| 963 |
+
+generate_report(transcript, agent) dict
|
| 964 |
+
+report_chat(agent_id, question, history) string
|
| 965 |
+
}
|
| 966 |
+
|
| 967 |
+
class ScoringService {
|
| 968 |
+
+build_scoring_prompt(transcript, agent) string
|
| 969 |
+
+parse_scores(llm_response) dict
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
User "1" --> "0..*" Agent : owns
|
| 973 |
+
User "1" --> "0..*" Conversation : participates
|
| 974 |
+
Agent "1" --> "0..*" Conversation : has
|
| 975 |
+
Agent "1" --> "0..*" ShareLink : has
|
| 976 |
+
Conversation "1" --> "0..*" Message : contains
|
| 977 |
+
Conversation "1" --> "0..1" Report : generates
|
| 978 |
+
ShareLink "0..*" --> "0..*" Conversation : initiates
|
| 979 |
+
AIService --> Agent : uses config
|
| 980 |
+
ScoringService --> Report : generates
|
| 981 |
+
```
|
| 982 |
+
|
| 983 |
+
---
|
| 984 |
+
|
| 985 |
+
## 13. API Specification
|
| 986 |
+
|
| 987 |
+
### 13.1 Authentication Endpoints
|
| 988 |
+
|
| 989 |
+
| Method | Endpoint | Auth | Request Body | Response | Description |
|
| 990 |
+
|--------|----------|------|-------------|----------|-------------|
|
| 991 |
+
| POST | `/api/auth/signup` | ❌ | `{name, email, password}` | `{user}` | Register new user |
|
| 992 |
+
| POST | `/api/auth/login` | ❌ | `{email, password}` | `{user}` | Login, create session |
|
| 993 |
+
| POST | `/api/auth/logout` | ✅ | — | `{message}` | Destroy session |
|
| 994 |
+
| GET | `/api/auth/me` | ✅ | — | `{user}` | Get current user |
|
| 995 |
+
|
| 996 |
+
### 13.2 Agent Endpoints
|
| 997 |
+
|
| 998 |
+
| Method | Endpoint | Auth | Description |
|
| 999 |
+
|--------|----------|------|-------------|
|
| 1000 |
+
| GET | `/api/agents` | ✅ | List user's agents |
|
| 1001 |
+
| POST | `/api/agents` | ✅ | Create new agent |
|
| 1002 |
+
| GET | `/api/agents/<id>` | ✅ | Get agent details |
|
| 1003 |
+
| PUT | `/api/agents/<id>` | ✅ | Update agent |
|
| 1004 |
+
| DELETE | `/api/agents/<id>` | ✅ | Delete agent |
|
| 1005 |
+
| GET | `/api/agents/<id>/share-links` | ✅ | List share links for agent |
|
| 1006 |
+
| POST | `/api/agents/<id>/share-links` | ✅ | Create share link |
|
| 1007 |
+
| POST | `/api/agents/<id>/report-chat` | ✅ | AI chat with report context |
|
| 1008 |
+
| POST | `/api/agents/<id>/export-report` | ✅ | Export report as DOCX |
|
| 1009 |
+
|
| 1010 |
+
### 13.3 Conversation Endpoints
|
| 1011 |
+
|
| 1012 |
+
| Method | Endpoint | Auth | Description |
|
| 1013 |
+
|--------|----------|------|-------------|
|
| 1014 |
+
| GET | `/api/conversations` | ✅ | List all conversations |
|
| 1015 |
+
| POST | `/api/conversations` | ✅ | Create conversation |
|
| 1016 |
+
| GET | `/api/conversations/<id>` | ✅ | Get conversation + messages |
|
| 1017 |
+
| DELETE | `/api/conversations/<id>` | ✅ | Delete conversation |
|
| 1018 |
+
| POST | `/api/conversations/<id>/messages` | ✅ | Send message |
|
| 1019 |
+
| POST | `/api/conversations/<id>/end` | ✅ | End + generate report |
|
| 1020 |
+
|
| 1021 |
+
### 13.4 Report Endpoints
|
| 1022 |
+
|
| 1023 |
+
| Method | Endpoint | Auth | Description |
|
| 1024 |
+
|--------|----------|------|-------------|
|
| 1025 |
+
| GET | `/api/reports` | ✅ | List all reports |
|
| 1026 |
+
| GET | `/api/reports/<id>` | ✅ | Get single report |
|
| 1027 |
+
| POST | `/api/reports/generate/<conv_id>` | ✅ | Manually generate report |
|
| 1028 |
+
|
| 1029 |
+
### 13.5 Public Share Endpoints
|
| 1030 |
+
|
| 1031 |
+
| Method | Endpoint | Auth | Description |
|
| 1032 |
+
|--------|----------|------|-------------|
|
| 1033 |
+
| GET | `/api/share/<token>` | ❌ | Get share link info |
|
| 1034 |
+
| POST | `/api/share/<token>/verify` | ❌ | Verify share link password |
|
| 1035 |
+
| POST | `/api/share/<token>/start` | ❌ | Start guest conversation |
|
| 1036 |
+
| POST | `/api/share/<token>/message` | ❌ | Send message as guest |
|
| 1037 |
+
|
| 1038 |
+
### 13.6 Anchoring Endpoints
|
| 1039 |
+
|
| 1040 |
+
| Method | Endpoint | Auth | Description |
|
| 1041 |
+
|--------|----------|------|-------------|
|
| 1042 |
+
| POST | `/api/anchoring/<agent_id>/start` | ✅ | Start anchoring session |
|
| 1043 |
+
| POST | `/api/anchoring/<agent_id>/control` | ✅ | Pause / Resume / Stop |
|
| 1044 |
+
| GET | `/api/anchoring/<agent_id>/status` | ✅ | Get current line & status |
|
| 1045 |
+
| POST | `/api/anchoring/tts` | ✅ | TTS for a script line |
|
| 1046 |
+
|
| 1047 |
+
### 13.7 Utility Endpoints
|
| 1048 |
+
|
| 1049 |
+
| Method | Endpoint | Auth | Description |
|
| 1050 |
+
|--------|----------|------|-------------|
|
| 1051 |
+
| POST | `/api/upload` | ✅ | Upload image file |
|
| 1052 |
+
| POST | `/api/speech-to-text` | ✅ | Convert audio to text (Whisper) |
|
| 1053 |
+
| POST | `/api/tts` | ✅ | Convert text to audio (Edge TTS) |
|
| 1054 |
+
|
| 1055 |
+
---
|
| 1056 |
+
|
| 1057 |
+
## 14. UI/UX Requirements
|
| 1058 |
+
|
| 1059 |
+
### 14.1 SPA Navigation
|
| 1060 |
+
|
| 1061 |
+
| Req ID | Requirement |
|
| 1062 |
+
|--------|-------------|
|
| 1063 |
+
| UI-01 | All navigation shall use hash-based routing (`#/route`) with zero page reloads |
|
| 1064 |
+
| UI-02 | `router.js` shall intercept all `hashchange` events and render the correct page module |
|
| 1065 |
+
| UI-03 | Unauthenticated access to protected routes shall redirect to `#/login` |
|
| 1066 |
+
| UI-04 | The active sidebar item shall be highlighted based on the current route |
|
| 1067 |
+
|
| 1068 |
+
### 14.2 SPA Route Table
|
| 1069 |
+
|
| 1070 |
+
| Hash Route | JS File | Description |
|
| 1071 |
+
|------------|---------|-------------|
|
| 1072 |
+
| `#/login` | login.js | Login form |
|
| 1073 |
+
| `#/signup` | signup.js | Signup form |
|
| 1074 |
+
| `#/dashboard` | dashboard.js | Stats + recent activity |
|
| 1075 |
+
| `#/agents` | agents.js | Agent list, search, filter |
|
| 1076 |
+
| `#/agents/new` | agent-wizard.js | 4-step creation wizard |
|
| 1077 |
+
| `#/agents/:id` | agent-detail.js | Tabbed agent detail |
|
| 1078 |
+
| `#/chat/:convId` | chat.js | Text chat UI |
|
| 1079 |
+
| `#/video-call/:convId` | video-call.js | 3D avatar video call |
|
| 1080 |
+
| `#/conversations` | conversations.js | All conversations history |
|
| 1081 |
+
| `#/reports` | reports.js | Reports history card list |
|
| 1082 |
+
| `#/templates` | templates.js | Template gallery |
|
| 1083 |
+
| `#/share/:token` | share-access.js | Public guest chat |
|
| 1084 |
+
| `#/anchoring/:id` | anchoring.js | Teleprompter local view |
|
| 1085 |
+
| `#/anchoring-remote/:id` | anchoring-remote.js | Remote control view |
|
| 1086 |
+
|
| 1087 |
+
### 14.3 Theme & Styling
|
| 1088 |
+
|
| 1089 |
+
| Req ID | Requirement |
|
| 1090 |
+
|--------|-------------|
|
| 1091 |
+
| UI-05 | Dark mode shall be toggled and persisted in `localStorage` as `personaflow-theme` |
|
| 1092 |
+
| UI-06 | Dark mode shall be applied via `[data-theme=dark]` on `<html>` before body renders |
|
| 1093 |
+
| UI-07 | Single stylesheet (`styles.css`, ~90KB) shall define all visual styles |
|
| 1094 |
+
| UI-08 | Google Fonts (Inter) and Font Awesome 6.4 shall be used for typography and icons |
|
| 1095 |
+
|
| 1096 |
+
---
|
| 1097 |
+
|
| 1098 |
+
## 15. External Interface Requirements
|
| 1099 |
+
|
| 1100 |
+
### 15.1 Ollama LLM API
|
| 1101 |
+
|
| 1102 |
+
| Item | Detail |
|
| 1103 |
+
|------|--------|
|
| 1104 |
+
| Base URL | `http://localhost:11434` |
|
| 1105 |
+
| Endpoint | `POST /api/chat` |
|
| 1106 |
+
| Model | `jarvis-x` (configurable in `config.py`) |
|
| 1107 |
+
| Payload | `{model, messages: [{role, content}], stream: false}` |
|
| 1108 |
+
| Response | `{message: {content: "..."}}` |
|
| 1109 |
+
| Error handling | Returns 503 to client if Ollama unreachable |
|
| 1110 |
+
|
| 1111 |
+
### 15.2 Microsoft Edge TTS
|
| 1112 |
+
|
| 1113 |
+
| Item | Detail |
|
| 1114 |
+
|------|--------|
|
| 1115 |
+
| Invocation | Python subprocess via `edge-tts` CLI |
|
| 1116 |
+
| Input | Plain text string |
|
| 1117 |
+
| Output | MP3/WAV audio file written to temp path |
|
| 1118 |
+
| Voices | Configurable; default English voice |
|
| 1119 |
+
|
| 1120 |
+
### 15.3 OpenAI Whisper STT
|
| 1121 |
+
|
| 1122 |
+
| Item | Detail |
|
| 1123 |
+
|------|--------|
|
| 1124 |
+
| Invocation | Python `speech_recognition` library / Whisper model |
|
| 1125 |
+
| Input | Audio blob (WebM/WAV) from browser |
|
| 1126 |
+
| Output | Transcript text string |
|
| 1127 |
+
|
| 1128 |
+
### 15.4 Three.js 3D Avatar
|
| 1129 |
+
|
| 1130 |
+
| Item | Detail |
|
| 1131 |
+
|------|--------|
|
| 1132 |
+
| Library | Three.js (CDN or bundled) |
|
| 1133 |
+
| Model format | GLTF / FBX via `three-converter.js` |
|
| 1134 |
+
| Assets | Stored in `frontend/3d-assets/` |
|
| 1135 |
+
| Lip-sync | Custom phoneme engine in `lipsync-engine.js` |
|
| 1136 |
+
| Animations | Idle + morph-target based mouth shapes |
|
| 1137 |
+
|
| 1138 |
+
---
|
| 1139 |
+
|
| 1140 |
+
## 16. Constraints & Limitations
|
| 1141 |
+
|
| 1142 |
+
| Constraint | Detail |
|
| 1143 |
+
|------------|--------|
|
| 1144 |
+
| **Local Only** | Application runs at `localhost:5000`; no production deployment configured |
|
| 1145 |
+
| **Ollama Dependency** | All AI features require Ollama running locally; no fallback AI provider |
|
| 1146 |
+
| **SQLite** | Single-file database; not suitable for concurrent multi-user production workloads |
|
| 1147 |
+
| **Browser Compatibility** | Full feature set requires Chrome/Edge (WebAudio, Web Speech API, WebGL) |
|
| 1148 |
+
| **In-Memory Anchoring State** | Anchoring session state is not persisted to DB; server restart resets all sessions |
|
| 1149 |
+
| **Session Security** | Flask sessions use a single `SECRET_KEY`; should be changed in any production use |
|
| 1150 |
+
| **AI Model** | Default `jarvis-x` model must be pulled in Ollama; other models configurable in `config.py` |
|
| 1151 |
+
|
| 1152 |
+
---
|
| 1153 |
+
|
| 1154 |
+
## 17. Future Enhancements
|
| 1155 |
+
|
| 1156 |
+
| Priority | Enhancement |
|
| 1157 |
+
|----------|------------|
|
| 1158 |
+
| HIGH | Production deployment (PostgreSQL, Docker, HTTPS) |
|
| 1159 |
+
| HIGH | Multi-user concurrency support |
|
| 1160 |
+
| MEDIUM | OAuth2 / Social login (Google, GitHub) |
|
| 1161 |
+
| MEDIUM | Persist Anchoring state to database |
|
| 1162 |
+
| MEDIUM | Real-time WebSocket-based chat instead of REST polling |
|
| 1163 |
+
| MEDIUM | Agent marketplace (discover and use community agents) |
|
| 1164 |
+
| LOW | Mobile app (React Native / Flutter) |
|
| 1165 |
+
| LOW | Multi-language TTS and STT support |
|
| 1166 |
+
| LOW | Report comparison across multiple conversations |
|
| 1167 |
+
| LOW | Team/organization accounts with role-based access |
|
| 1168 |
+
| LOW | Plugin/extension system for custom agent capabilities |
|
| 1169 |
+
|
| 1170 |
+
---
|
| 1171 |
+
|
| 1172 |
+
## 18. Appendix
|
| 1173 |
+
|
| 1174 |
+
### 18.1 Glossary
|
| 1175 |
+
|
| 1176 |
+
| Term | Definition |
|
| 1177 |
+
|------|-----------|
|
| 1178 |
+
| **Agent** | A configured AI persona with specific role, personality, and rules |
|
| 1179 |
+
| **Anchoring** | A feature mode where an agent reads a pre-written script via TTS as a teleprompter |
|
| 1180 |
+
| **Conversation** | A single chat or video call session between a user/guest and an agent |
|
| 1181 |
+
| **Lip-sync** | Synchronization of avatar mouth animation with spoken audio using phoneme mapping |
|
| 1182 |
+
| **Ollama** | An open-source local LLM runtime supporting multiple language models |
|
| 1183 |
+
| **Phoneme** | The smallest unit of sound in language, used to drive avatar mouth shapes |
|
| 1184 |
+
| **Report** | An AI-generated evaluation of a completed conversation with scores and feedback |
|
| 1185 |
+
| **Share Link** | A tokenized URL allowing guest access to chat with a specific agent |
|
| 1186 |
+
| **SPA** | Single Page Application — all navigation happens client-side without page reloads |
|
| 1187 |
+
| **TTS** | Text-to-Speech — converting written text to spoken audio |
|
| 1188 |
+
| **STT** | Speech-to-Text — converting spoken audio to written text |
|
| 1189 |
+
| **Transcript** | A JSON record of all messages in a conversation, stored within a Report |
|
| 1190 |
+
|
| 1191 |
+
### 18.2 Revision History
|
| 1192 |
+
|
| 1193 |
+
| Version | Date | Author | Changes |
|
| 1194 |
+
|---------|------|--------|---------|
|
| 1195 |
+
| 1.0 | 2026-03-10 | PersonaFlow Team | Initial SRS creation |
|
| 1196 |
+
|
| 1197 |
+
---
|
| 1198 |
+
|
| 1199 |
+
*End of Software Requirements Specification — PersonaFlow v1.0*
|
backend/agent_behavior.py
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
| 1 |
+
"""
|
| 2 |
+
PersonaFlow - Agent Behavior Engine
|
| 3 |
+
====================================
|
| 4 |
+
Centralizes all agent behavior logic:
|
| 5 |
+
- Role-specific system prompt building
|
| 6 |
+
- Behavior config parsing (strict_mode, response_length, etc.)
|
| 7 |
+
- Scope enforcement templates
|
| 8 |
+
- Response length constraints by conversation mode
|
| 9 |
+
"""
|
| 10 |
+
import json
|
| 11 |
+
|
| 12 |
+
# ── Role detection keywords ──────────────────────────────────────────────────
|
| 13 |
+
_ROLE_KEYWORDS = {
|
| 14 |
+
'interviewer': ['interviewer', 'interview', 'hiring', 'recruiter', 'hr'],
|
| 15 |
+
'coach': ['coach', 'coaching', 'trainer', 'mentor', 'interview coach'],
|
| 16 |
+
'teacher': ['teacher', 'tutor', 'instructor', 'educator', 'professor', 'lecturer'],
|
| 17 |
+
'evaluator': ['evaluator', 'observer', 'assessor', 'judge', 'scorer', 'reviewer'],
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
# ── Response length budgets ───────────────────────────────────────────────────
|
| 21 |
+
_LENGTH_RULES = {
|
| 22 |
+
'video': (
|
| 23 |
+
"RESPONSE LENGTH — CRITICAL:\n"
|
| 24 |
+
"You are in a LIVE VOICE CALL. Keep every response to 1-2 SHORT sentences maximum.\n"
|
| 25 |
+
"Think of how a real person speaks in a live conversation — brief, natural, direct.\n"
|
| 26 |
+
"Never write lists, bullet points, or multi-paragraph explanations.\n"
|
| 27 |
+
"If a topic needs more detail, give ONE key point and offer to continue if they want more."
|
| 28 |
+
),
|
| 29 |
+
'text': (
|
| 30 |
+
"RESPONSE LENGTH:\n"
|
| 31 |
+
"Keep answers concise and conversational. Max 3-4 sentences per response.\n"
|
| 32 |
+
"Avoid lengthy explanations unless the user explicitly asks for more detail.\n"
|
| 33 |
+
"Use short paragraphs, not walls of text."
|
| 34 |
+
),
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def get_behavior_config(agent):
|
| 39 |
+
"""
|
| 40 |
+
Parse agent's output_config for behavior-related settings.
|
| 41 |
+
|
| 42 |
+
Supported fields in output_config JSON:
|
| 43 |
+
strict_mode (bool) — refuse all out-of-scope questions
|
| 44 |
+
allow_out_of_scope (bool) — override to allow off-topic answers
|
| 45 |
+
max_answer_length (int) — word limit hint for LLM
|
| 46 |
+
behavior (str) — 'question_only' | 'teach' | 'evaluate' | 'converse'
|
| 47 |
+
"""
|
| 48 |
+
try:
|
| 49 |
+
config = json.loads(agent.output_config) if agent.output_config else {}
|
| 50 |
+
except Exception:
|
| 51 |
+
config = {}
|
| 52 |
+
|
| 53 |
+
return {
|
| 54 |
+
'strict_mode': config.get('strict_mode', True),
|
| 55 |
+
'allow_out_of_scope': config.get('allow_out_of_scope', False),
|
| 56 |
+
'max_answer_length': config.get('max_answer_length', None),
|
| 57 |
+
'behavior': config.get('behavior', 'converse'),
|
| 58 |
+
'evaluation': config.get('evaluation', False),
|
| 59 |
+
'summary': config.get('summary', True),
|
| 60 |
+
'transcript': config.get('transcript', True),
|
| 61 |
+
'criteria': config.get('criteria', []),
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
def detect_role_type(role_text):
|
| 66 |
+
"""Detect the semantic role type from the agent's role string."""
|
| 67 |
+
role_lower = (role_text or '').lower()
|
| 68 |
+
for role_type, keywords in _ROLE_KEYWORDS.items():
|
| 69 |
+
if any(kw in role_lower for kw in keywords):
|
| 70 |
+
return role_type
|
| 71 |
+
return 'default'
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
def _role_behavior_section(role_type, behavior_config):
|
| 75 |
+
"""Return role-specific behavioral instructions for the system prompt."""
|
| 76 |
+
behavior = behavior_config.get('behavior', 'converse')
|
| 77 |
+
|
| 78 |
+
if role_type == 'interviewer':
|
| 79 |
+
return (
|
| 80 |
+
"ROLE-SPECIFIC BEHAVIOR — INTERVIEWER:\n"
|
| 81 |
+
"- Ask ONE interview question at a time. Wait for the candidate's full answer.\n"
|
| 82 |
+
"- Do NOT give away correct answers unless explicitly allowed in the rules.\n"
|
| 83 |
+
"- After each answer, either follow up with a probing question or move to the next topic.\n"
|
| 84 |
+
"- Evaluate critically but professionally.\n"
|
| 85 |
+
"- Keep questions relevant to the defined role and knowledge domain."
|
| 86 |
+
)
|
| 87 |
+
elif role_type == 'coach':
|
| 88 |
+
return (
|
| 89 |
+
"ROLE-SPECIFIC BEHAVIOR — INTERVIEW COACH:\n"
|
| 90 |
+
"- Ask interview questions, then provide example answers and improvement tips.\n"
|
| 91 |
+
"- Be encouraging but honest about weaknesses.\n"
|
| 92 |
+
"- Teach the candidate HOW to improve their responses.\n"
|
| 93 |
+
"- Give structured feedback: (1) What was good, (2) What to improve, (3) Example answer."
|
| 94 |
+
)
|
| 95 |
+
elif role_type == 'teacher':
|
| 96 |
+
return (
|
| 97 |
+
"ROLE-SPECIFIC BEHAVIOR — TEACHER:\n"
|
| 98 |
+
"- Explain concepts step by step in simple language.\n"
|
| 99 |
+
"- Ask follow-up questions to check the student's understanding.\n"
|
| 100 |
+
"- Use analogies and examples to clarify difficult ideas.\n"
|
| 101 |
+
"- Do not overwhelm the student — one concept at a time."
|
| 102 |
+
)
|
| 103 |
+
elif role_type == 'evaluator':
|
| 104 |
+
return (
|
| 105 |
+
"ROLE-SPECIFIC BEHAVIOR — EVALUATOR/OBSERVER:\n"
|
| 106 |
+
"- Observe the user's responses carefully.\n"
|
| 107 |
+
"- Provide structured feedback and scoring where applicable.\n"
|
| 108 |
+
"- Be objective, specific, and actionable in your feedback.\n"
|
| 109 |
+
"- Focus on measurable criteria defined in your knowledge/task description."
|
| 110 |
+
)
|
| 111 |
+
else:
|
| 112 |
+
# Default conversational agent
|
| 113 |
+
if behavior == 'question_only':
|
| 114 |
+
return (
|
| 115 |
+
"ROLE-SPECIFIC BEHAVIOR:\n"
|
| 116 |
+
"- Only ask questions — do NOT provide answers or explanations.\n"
|
| 117 |
+
"- Your job is to gather information from the user through questions.\n"
|
| 118 |
+
"- Ask one question at a time and wait for the answer."
|
| 119 |
+
)
|
| 120 |
+
return (
|
| 121 |
+
"ROLE-SPECIFIC BEHAVIOR:\n"
|
| 122 |
+
"- Engage naturally and conversationally.\n"
|
| 123 |
+
"- Ask follow-up questions to understand the user better.\n"
|
| 124 |
+
"- Provide helpful, relevant responses within your defined scope."
|
| 125 |
+
)
|
| 126 |
+
|
| 127 |
+
|
| 128 |
+
def build_system_prompt(agent, mode='text'):
|
| 129 |
+
"""
|
| 130 |
+
Build the complete system prompt for an agent, incorporating:
|
| 131 |
+
- Core identity (name, role, goal, tone)
|
| 132 |
+
- Task description and knowledge
|
| 133 |
+
- Agent rules
|
| 134 |
+
- Role-specific behavior (interviewer/teacher/coach/evaluator)
|
| 135 |
+
- Strict scope enforcement
|
| 136 |
+
- Response length constraints based on mode (video/text)
|
| 137 |
+
- Behavior config settings (strict_mode, max_answer_length, etc.)
|
| 138 |
+
|
| 139 |
+
Args:
|
| 140 |
+
agent: Agent model object
|
| 141 |
+
mode: 'video' | 'text' — controls response length rules
|
| 142 |
+
"""
|
| 143 |
+
behavior_config = get_behavior_config(agent)
|
| 144 |
+
role_type = detect_role_type(agent.role)
|
| 145 |
+
|
| 146 |
+
# Parse rules
|
| 147 |
+
rules = json.loads(agent.rules) if agent.rules else []
|
| 148 |
+
rules_text = "\n".join([f"- {rule}" for rule in rules]) if rules else "No specific rules defined."
|
| 149 |
+
|
| 150 |
+
# Scope description
|
| 151 |
+
scope_description = f"{agent.role}"
|
| 152 |
+
if agent.goal:
|
| 153 |
+
scope_description += f" focused on: {agent.goal}"
|
| 154 |
+
if agent.knowledge:
|
| 155 |
+
scope_description += f"\nKnowledge domain: {agent.knowledge}"
|
| 156 |
+
|
| 157 |
+
# Out-of-scope handling
|
| 158 |
+
strict_mode = behavior_config['strict_mode'] and not behavior_config['allow_out_of_scope']
|
| 159 |
+
if strict_mode:
|
| 160 |
+
scope_block = (
|
| 161 |
+
f"STRICT SCOPE ENFORCEMENT:\n"
|
| 162 |
+
f"You are ONLY allowed to respond within your defined scope:\n"
|
| 163 |
+
f" → Role: {agent.role}\n"
|
| 164 |
+
f" → Goal: {agent.goal or 'as defined above'}\n"
|
| 165 |
+
f" → Domain: {agent.knowledge or agent.task_description or agent.role}\n\n"
|
| 166 |
+
f"If a user asks ANYTHING outside this scope, respond exactly like:\n"
|
| 167 |
+
f" \"I'm here as a {agent.role}. That's outside my area — I can help you with "
|
| 168 |
+
f"{agent.goal or agent.role}. Would you like to ask something related?\"\n\n"
|
| 169 |
+
f"DO NOT: answer general knowledge questions, break character, or pretend to be a general assistant."
|
| 170 |
+
)
|
| 171 |
+
else:
|
| 172 |
+
scope_block = (
|
| 173 |
+
f"SCOPE PREFERENCE:\n"
|
| 174 |
+
f"Focus primarily on your role as {agent.role} and domain: "
|
| 175 |
+
f"{agent.knowledge or agent.goal or agent.role}.\n"
|
| 176 |
+
f"You may use your best judgment for closely related questions."
|
| 177 |
+
)
|
| 178 |
+
|
| 179 |
+
# Max length hint
|
| 180 |
+
length_hint = ""
|
| 181 |
+
if behavior_config.get('max_answer_length'):
|
| 182 |
+
length_hint = f"\nKeep responses under {behavior_config['max_answer_length']} words."
|
| 183 |
+
|
| 184 |
+
# Response length rules based on conversation mode
|
| 185 |
+
length_rule = _LENGTH_RULES.get(mode, _LENGTH_RULES['text']) + length_hint
|
| 186 |
+
|
| 187 |
+
# Role-specific section
|
| 188 |
+
role_section = _role_behavior_section(role_type, behavior_config)
|
| 189 |
+
|
| 190 |
+
prompt = f"""You are {agent.name}, a {agent.role}.
|
| 191 |
+
|
| 192 |
+
GOAL: {agent.goal or 'Assist the user effectively within your defined scope.'}
|
| 193 |
+
|
| 194 |
+
PERSONALITY & TONE: {agent.tone or 'professional'}
|
| 195 |
+
|
| 196 |
+
TASK DESCRIPTION:
|
| 197 |
+
{agent.task_description or 'Engage in helpful conversation within your scope.'}
|
| 198 |
+
|
| 199 |
+
KNOWLEDGE & DOMAIN:
|
| 200 |
+
{agent.knowledge or 'No additional knowledge provided.'}
|
| 201 |
+
|
| 202 |
+
RULES & CONSTRAINTS:
|
| 203 |
+
{rules_text}
|
| 204 |
+
|
| 205 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 206 |
+
{role_section}
|
| 207 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 208 |
+
|
| 209 |
+
{scope_block}
|
| 210 |
+
|
| 211 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 212 |
+
{length_rule}
|
| 213 |
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
| 214 |
+
|
| 215 |
+
BEHAVIOR GUIDELINES:
|
| 216 |
+
1. Stay in character as {agent.name} at all times
|
| 217 |
+
2. Follow all rules strictly
|
| 218 |
+
3. Be helpful, natural, and engaging within your scope
|
| 219 |
+
4. Never use bullet points or numbered lists unless specifically asked
|
| 220 |
+
5. Respond as you would in a real spoken conversation — naturally and concisely"""
|
| 221 |
+
|
| 222 |
+
return prompt
|
backend/ai_service.py
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
PersonaFlow AI Service
|
| 3 |
+
Handles AI conversation logic using Google Gemini API.
|
| 4 |
+
System prompt building is delegated to agent_behavior.py.
|
| 5 |
+
"""
|
| 6 |
+
import requests
|
| 7 |
+
import json
|
| 8 |
+
from config import Config
|
| 9 |
+
from agent_behavior import build_system_prompt
|
| 10 |
+
|
| 11 |
+
class AIService:
|
| 12 |
+
def __init__(self):
|
| 13 |
+
self.api_key = Config.GEMINI_API_KEY
|
| 14 |
+
self.model = Config.GEMINI_MODEL
|
| 15 |
+
self.base_url = f"https://generativelanguage.googleapis.com/v1beta/models/{self.model}:generateContent?key={self.api_key}"
|
| 16 |
+
|
| 17 |
+
def _get_gemini_text_from_response(self, response_json):
|
| 18 |
+
"""Helper to extract text from Gemini response."""
|
| 19 |
+
try:
|
| 20 |
+
return response_json.get('candidates', [{}])[0].get('content', {}).get('parts', [{}])[0].get('text', '')
|
| 21 |
+
except (IndexError, AttributeError):
|
| 22 |
+
return None
|
| 23 |
+
|
| 24 |
+
def generate_response(self, agent, messages, user_message, mode='text'):
|
| 25 |
+
"""
|
| 26 |
+
Generate AI response based on agent personality and conversation history.
|
| 27 |
+
mode: 'video' | 'text' — controls response length (video = 1-2 sentences)
|
| 28 |
+
"""
|
| 29 |
+
system_prompt = build_system_prompt(agent, mode=mode)
|
| 30 |
+
conversation = self._build_conversation(messages, user_message)
|
| 31 |
+
|
| 32 |
+
try:
|
| 33 |
+
headers = {"Content-Type": "application/json"}
|
| 34 |
+
payload = {
|
| 35 |
+
"systemInstruction": {
|
| 36 |
+
"parts": [{"text": system_prompt}]
|
| 37 |
+
},
|
| 38 |
+
"contents": conversation
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
response = requests.post(
|
| 42 |
+
self.base_url,
|
| 43 |
+
headers=headers,
|
| 44 |
+
json=payload,
|
| 45 |
+
timeout=60
|
| 46 |
+
)
|
| 47 |
+
|
| 48 |
+
if response.status_code == 200:
|
| 49 |
+
result = response.json()
|
| 50 |
+
text = self._get_gemini_text_from_response(result)
|
| 51 |
+
if text:
|
| 52 |
+
return text
|
| 53 |
+
return 'I apologize, but I encountered an issue parsing the response.'
|
| 54 |
+
elif response.status_code in [400, 403]:
|
| 55 |
+
return "API Key is missing or invalid. Please check your backend configuration."
|
| 56 |
+
elif response.status_code == 429:
|
| 57 |
+
return "Gemini API Error: Quota exceeded. Please check your API billing details."
|
| 58 |
+
else:
|
| 59 |
+
return f"Gemini API Error (HTTP {response.status_code}): {response.text}"
|
| 60 |
+
|
| 61 |
+
except requests.exceptions.Timeout:
|
| 62 |
+
return "I apologize, but my response is taking too long. Please try again."
|
| 63 |
+
except Exception as e:
|
| 64 |
+
print(f"AI Service Error: {e}")
|
| 65 |
+
return "I apologize, but I encountered an unexpected error. Please try again."
|
| 66 |
+
|
| 67 |
+
def _build_conversation(self, messages, user_message):
|
| 68 |
+
"""Convert message history to Gemini format."""
|
| 69 |
+
conversation = []
|
| 70 |
+
for msg in messages:
|
| 71 |
+
role = "model" if msg.role == "agent" else "user"
|
| 72 |
+
conversation.append({
|
| 73 |
+
"role": role,
|
| 74 |
+
"parts": [{"text": msg.content}]
|
| 75 |
+
})
|
| 76 |
+
|
| 77 |
+
conversation.append({
|
| 78 |
+
"role": "user",
|
| 79 |
+
"parts": [{"text": user_message}]
|
| 80 |
+
})
|
| 81 |
+
|
| 82 |
+
# Gemini requires strictly alternating roles (user, model, user...)
|
| 83 |
+
# Attempt to combine back-to-back same-role messages
|
| 84 |
+
if not conversation:
|
| 85 |
+
return conversation
|
| 86 |
+
|
| 87 |
+
deduped = []
|
| 88 |
+
for msg in conversation:
|
| 89 |
+
if deduped and deduped[-1]["role"] == msg["role"]:
|
| 90 |
+
deduped[-1]["parts"][0]["text"] += f"\n\n{msg['parts'][0]['text']}"
|
| 91 |
+
else:
|
| 92 |
+
deduped.append(msg)
|
| 93 |
+
|
| 94 |
+
# First message must be "user" or "model" (Gemini generally ok as long as alternating)
|
| 95 |
+
return deduped
|
| 96 |
+
|
| 97 |
+
def generate_summary(self, agent, messages):
|
| 98 |
+
"""Generate conversation summary."""
|
| 99 |
+
transcript = "\n".join([
|
| 100 |
+
f"{'Agent' if m.role == 'agent' else 'User'}: {m.content}"
|
| 101 |
+
for m in messages
|
| 102 |
+
])
|
| 103 |
+
|
| 104 |
+
prompt = f"""Analyze the following conversation between {agent.name} (a {agent.role}) and a user.
|
| 105 |
+
Generate a concise summary of the key points discussed.
|
| 106 |
+
|
| 107 |
+
CONVERSATION:
|
| 108 |
+
{transcript}
|
| 109 |
+
|
| 110 |
+
Provide a 2-3 paragraph summary focusing on:
|
| 111 |
+
1. The main topics discussed
|
| 112 |
+
2. Key information exchanged
|
| 113 |
+
3. Any outcomes or decisions made"""
|
| 114 |
+
|
| 115 |
+
try:
|
| 116 |
+
headers = {"Content-Type": "application/json"}
|
| 117 |
+
response = requests.post(
|
| 118 |
+
self.base_url,
|
| 119 |
+
headers=headers,
|
| 120 |
+
json={
|
| 121 |
+
"contents": [{"role": "user", "parts": [{"text": prompt}]}]
|
| 122 |
+
},
|
| 123 |
+
timeout=120
|
| 124 |
+
)
|
| 125 |
+
|
| 126 |
+
if response.status_code == 200:
|
| 127 |
+
result = response.json()
|
| 128 |
+
text = self._get_gemini_text_from_response(result)
|
| 129 |
+
return text if text else 'Summary generation failed.'
|
| 130 |
+
elif response.status_code == 429:
|
| 131 |
+
return "Summary generation failed: Gemini API quota exceeded."
|
| 132 |
+
return f"Summary generation failed (HTTP {response.status_code})."
|
| 133 |
+
except Exception as e:
|
| 134 |
+
print(f"Summary generation error: {e}")
|
| 135 |
+
return "Summary generation failed."
|
| 136 |
+
|
| 137 |
+
def generate_feedback(self, agent, messages, scores):
|
| 138 |
+
"""Generate feedback and recommendations."""
|
| 139 |
+
transcript = "\n".join([
|
| 140 |
+
f"{'Agent' if m.role == 'agent' else 'User'}: {m.content}"
|
| 141 |
+
for m in messages
|
| 142 |
+
])
|
| 143 |
+
|
| 144 |
+
output_config = json.loads(agent.output_config) if agent.output_config else {}
|
| 145 |
+
criteria = output_config.get('criteria', [])
|
| 146 |
+
|
| 147 |
+
criteria_text = "\n".join([
|
| 148 |
+
f"- {c.get('name', 'Unknown')}: {scores.get(c.get('name', ''), 0)}/100"
|
| 149 |
+
for c in criteria
|
| 150 |
+
])
|
| 151 |
+
|
| 152 |
+
prompt = f"""Analyze this conversation and provide constructive feedback.
|
| 153 |
+
|
| 154 |
+
AGENT: {agent.name} ({agent.role})
|
| 155 |
+
GOAL: {agent.goal}
|
| 156 |
+
|
| 157 |
+
CONVERSATION:
|
| 158 |
+
{transcript}
|
| 159 |
+
|
| 160 |
+
EVALUATION SCORES:
|
| 161 |
+
{criteria_text if criteria_text else 'No specific criteria evaluated.'}
|
| 162 |
+
|
| 163 |
+
Provide:
|
| 164 |
+
1. Strengths observed in the conversation
|
| 165 |
+
2. Areas for improvement
|
| 166 |
+
3. Specific actionable recommendations
|
| 167 |
+
|
| 168 |
+
Keep feedback constructive and helpful."""
|
| 169 |
+
|
| 170 |
+
try:
|
| 171 |
+
headers = {"Content-Type": "application/json"}
|
| 172 |
+
response = requests.post(
|
| 173 |
+
self.base_url,
|
| 174 |
+
headers=headers,
|
| 175 |
+
json={
|
| 176 |
+
"contents": [{"role": "user", "parts": [{"text": prompt}]}]
|
| 177 |
+
},
|
| 178 |
+
timeout=120
|
| 179 |
+
)
|
| 180 |
+
|
| 181 |
+
if response.status_code == 200:
|
| 182 |
+
result = response.json()
|
| 183 |
+
text = self._get_gemini_text_from_response(result)
|
| 184 |
+
return text if text else 'Feedback generation failed.'
|
| 185 |
+
elif response.status_code == 429:
|
| 186 |
+
return "Feedback generation failed: Gemini API quota exceeded."
|
| 187 |
+
return f"Feedback generation failed (HTTP {response.status_code})."
|
| 188 |
+
except Exception as e:
|
| 189 |
+
print(f"Feedback generation error: {e}")
|
| 190 |
+
return "Feedback generation failed."
|
| 191 |
+
|
| 192 |
+
def generate_report_chat_response(self, agent, conversations, reports, chat_history, user_message):
|
| 193 |
+
"""
|
| 194 |
+
Generate AI response for the per-agent report chatbot.
|
| 195 |
+
Answers questions about the agent's conversation data.
|
| 196 |
+
"""
|
| 197 |
+
total_convs = len(conversations)
|
| 198 |
+
completed = [c for c in conversations if c.status == 'completed']
|
| 199 |
+
|
| 200 |
+
scored_reports = [r for r in reports if r.overall_score is not None]
|
| 201 |
+
avg_score = (sum(r.overall_score for r in scored_reports) / len(scored_reports)) if scored_reports else None
|
| 202 |
+
|
| 203 |
+
perf_list = []
|
| 204 |
+
for r in sorted(scored_reports, key=lambda x: x.overall_score, reverse=True):
|
| 205 |
+
conv = next((c for c in conversations if c.id == r.conversation_id), None)
|
| 206 |
+
if conv:
|
| 207 |
+
perf_list.append({
|
| 208 |
+
'name': conv.participant_name or 'Anonymous',
|
| 209 |
+
'score': round(r.overall_score),
|
| 210 |
+
'date': conv.started_at.strftime('%b %d, %Y') if conv.started_at else '?',
|
| 211 |
+
'summary': (r.summary or '')[:200]
|
| 212 |
+
})
|
| 213 |
+
|
| 214 |
+
perf_text = ""
|
| 215 |
+
if perf_list:
|
| 216 |
+
perf_text = "PARTICIPANT PERFORMANCE RANKINGS:\n"
|
| 217 |
+
for i, p in enumerate(perf_list, 1):
|
| 218 |
+
perf_text += f"{i}. {p['name']} — Score: {p['score']}/100 (Date: {p['date']})\n"
|
| 219 |
+
if p['summary']:
|
| 220 |
+
perf_text += f" Summary: {p['summary']}\n"
|
| 221 |
+
else:
|
| 222 |
+
perf_text = "No scored conversations available yet."
|
| 223 |
+
|
| 224 |
+
recent_text = ""
|
| 225 |
+
recent = sorted(conversations, key=lambda c: c.started_at, reverse=True)[:5]
|
| 226 |
+
if recent:
|
| 227 |
+
recent_text = "RECENT CONVERSATIONS:\n"
|
| 228 |
+
for c in recent:
|
| 229 |
+
recent_text += f"- {c.participant_name or 'Anonymous'} ({c.started_at.strftime('%b %d') if c.started_at else '?'}): {c.status}, {len(c.messages)} messages\n"
|
| 230 |
+
|
| 231 |
+
system_prompt = f"""You are a data analyst assistant for the agent "{agent.name}" ({agent.role}).
|
| 232 |
+
You have access to all conversation and performance data for this agent.
|
| 233 |
+
Answer the user's questions about this data clearly and concisely.
|
| 234 |
+
|
| 235 |
+
AGENT OVERVIEW:
|
| 236 |
+
- Name: {agent.name}
|
| 237 |
+
- Role: {agent.role}
|
| 238 |
+
- Goal: {agent.goal or 'N/A'}
|
| 239 |
+
- Total Conversations: {total_convs}
|
| 240 |
+
- Completed Conversations: {len(completed)}
|
| 241 |
+
- Conversations with Scores: {len(scored_reports)}
|
| 242 |
+
- Average Score: {f"{avg_score:.1f}/100" if avg_score is not None else "N/A"}
|
| 243 |
+
|
| 244 |
+
{perf_text}
|
| 245 |
+
|
| 246 |
+
{recent_text}
|
| 247 |
+
|
| 248 |
+
INSTRUCTIONS:
|
| 249 |
+
- Answer questions about this agent's performance data, participant rankings, scores, trends
|
| 250 |
+
- If asked for "top N", provide the top N from the rankings above
|
| 251 |
+
- If asked for a PDF or DOCX, say: "Click the Download PDF or Download DOCX button below to export"
|
| 252 |
+
- Be concise and data-driven
|
| 253 |
+
- Format lists clearly with numbers or bullets"""
|
| 254 |
+
|
| 255 |
+
contents = []
|
| 256 |
+
for h in chat_history[-10:]:
|
| 257 |
+
role = "model" if h['role'] == "agent" else "user"
|
| 258 |
+
contents.append({
|
| 259 |
+
"role": role,
|
| 260 |
+
"parts": [{"text": h['content']}]
|
| 261 |
+
})
|
| 262 |
+
|
| 263 |
+
contents.append({
|
| 264 |
+
"role": "user",
|
| 265 |
+
"parts": [{"text": user_message}]
|
| 266 |
+
})
|
| 267 |
+
|
| 268 |
+
# Deduplicate same roles back to back for Gemini
|
| 269 |
+
deduped = []
|
| 270 |
+
for msg in contents:
|
| 271 |
+
if deduped and deduped[-1]["role"] == msg["role"]:
|
| 272 |
+
deduped[-1]["parts"][0]["text"] += f"\n\n{msg['parts'][0]['text']}"
|
| 273 |
+
else:
|
| 274 |
+
deduped.append(msg)
|
| 275 |
+
|
| 276 |
+
try:
|
| 277 |
+
headers = {"Content-Type": "application/json"}
|
| 278 |
+
payload = {
|
| 279 |
+
"systemInstruction": {
|
| 280 |
+
"parts": [{"text": system_prompt}]
|
| 281 |
+
},
|
| 282 |
+
"contents": deduped
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
response = requests.post(
|
| 286 |
+
self.base_url,
|
| 287 |
+
headers=headers,
|
| 288 |
+
json=payload,
|
| 289 |
+
timeout=90
|
| 290 |
+
)
|
| 291 |
+
|
| 292 |
+
if response.status_code == 200:
|
| 293 |
+
result = response.json()
|
| 294 |
+
text = self._get_gemini_text_from_response(result)
|
| 295 |
+
if text:
|
| 296 |
+
return text
|
| 297 |
+
return 'Unable to generate response.'
|
| 298 |
+
elif response.status_code in [400, 403]:
|
| 299 |
+
return "API Key is missing or invalid. Please check your backend configuration."
|
| 300 |
+
elif response.status_code == 429:
|
| 301 |
+
return "Gemini API Error: Quota exceeded. Please check your API billing details."
|
| 302 |
+
return f"Report analysis failed (HTTP {response.status_code}). Please try again."
|
| 303 |
+
except Exception as e:
|
| 304 |
+
print(f"Report chat error: {e}")
|
| 305 |
+
return "Report analysis failed. Please try again."
|
| 306 |
+
|
| 307 |
+
# Global instance
|
| 308 |
+
ai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Platform
|
| 4 |
+
"""
|
| 5 |
+
from flask import Flask, request, jsonify, session, send_from_directory, redirect
|
| 6 |
+
from flask_cors import CORS
|
| 7 |
+
from werkzeug.security import generate_password_hash, check_password_hash
|
| 8 |
+
from dotenv import load_dotenv
|
| 9 |
+
|
| 10 |
+
# Load environment variables from backend/.env file
|
| 11 |
+
load_dotenv()
|
| 12 |
+
from datetime import datetime, timedelta
|
| 13 |
+
from functools import wraps
|
| 14 |
+
import secrets
|
| 15 |
+
import json
|
| 16 |
+
import random
|
| 17 |
+
import os
|
| 18 |
+
os.environ['TF_ENABLE_ONEDNN_OPTS'] = '0'
|
| 19 |
+
import asyncio
|
| 20 |
+
import tempfile
|
| 21 |
+
|
| 22 |
+
# Speech Recognition (Google's free API — no ffmpeg dependency)
|
| 23 |
+
import speech_recognition as sr
|
| 24 |
+
_recognizer = sr.Recognizer()
|
| 25 |
+
|
| 26 |
+
from config import Config
|
| 27 |
+
from models import db, User, Agent, Conversation, Message, ShareLink, Report
|
| 28 |
+
from ai_service import ai_service
|
| 29 |
+
from scoring_service import scoring_service
|
| 30 |
+
|
| 31 |
+
# In-memory anchoring state tracker
|
| 32 |
+
# Format: { agent_id: { 'status': 'playing'|'paused'|'stopped', 'current_line': 0, 'script_lines': [] } }
|
| 33 |
+
anchoring_states = {}
|
| 34 |
+
|
| 35 |
+
# Get the frontend directory path
|
| 36 |
+
FRONTEND_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'frontend'))
|
| 37 |
+
|
| 38 |
+
app = Flask(__name__, static_folder=FRONTEND_DIR, static_url_path='')
|
| 39 |
+
app.config.from_object(Config)
|
| 40 |
+
app.config['UPLOAD_FOLDER'] = os.path.join(FRONTEND_DIR, 'image', 'uploads')
|
| 41 |
+
app.config['ALLOWED_EXTENSIONS'] = {'png', 'jpg', 'jpeg', 'gif', 'webp'}
|
| 42 |
+
CORS(app, supports_credentials=True)
|
| 43 |
+
db.init_app(app)
|
| 44 |
+
|
| 45 |
+
# Create tables
|
| 46 |
+
with app.app_context():
|
| 47 |
+
db.create_all()
|
| 48 |
+
|
| 49 |
+
# ============================================================================
|
| 50 |
+
# Kokoro TTS — Initialize once at startup (singleton)
|
| 51 |
+
# ============================================================================
|
| 52 |
+
_kokoro_pipeline = None
|
| 53 |
+
_kokoro_pipeline_lang = None # track which lang code is loaded
|
| 54 |
+
|
| 55 |
+
def _get_kokoro_pipeline(lang_code='a'):
|
| 56 |
+
"""Return or create a Kokoro KPipeline singleton for the given lang_code."""
|
| 57 |
+
global _kokoro_pipeline, _kokoro_pipeline_lang
|
| 58 |
+
if _kokoro_pipeline is None or _kokoro_pipeline_lang != lang_code:
|
| 59 |
+
try:
|
| 60 |
+
from kokoro import KPipeline
|
| 61 |
+
print(f'[Kokoro] Loading pipeline lang={lang_code} (first call may download model weights)...')
|
| 62 |
+
_kokoro_pipeline = KPipeline(lang_code=lang_code)
|
| 63 |
+
_kokoro_pipeline_lang = lang_code
|
| 64 |
+
print('[Kokoro] Pipeline ready.')
|
| 65 |
+
except Exception as e:
|
| 66 |
+
print(f'[Kokoro] Failed to initialize pipeline: {e}')
|
| 67 |
+
_kokoro_pipeline = None
|
| 68 |
+
return _kokoro_pipeline
|
| 69 |
+
|
| 70 |
+
# ============================================================================
|
| 71 |
+
# Frontend Routes - Serve static files
|
| 72 |
+
# ============================================================================
|
| 73 |
+
|
| 74 |
+
@app.route('/')
|
| 75 |
+
def serve_index():
|
| 76 |
+
return send_from_directory(FRONTEND_DIR, 'index.html')
|
| 77 |
+
|
| 78 |
+
@app.route('/<path:path>')
|
| 79 |
+
def serve_static(path):
|
| 80 |
+
# If the path starts with 'api/', skip static file serving
|
| 81 |
+
if path.startswith('api/'):
|
| 82 |
+
return jsonify({'error': 'Not found'}), 404
|
| 83 |
+
# Try to serve the file, fallback to index.html for SPA routing
|
| 84 |
+
try:
|
| 85 |
+
return send_from_directory(FRONTEND_DIR, path)
|
| 86 |
+
except:
|
| 87 |
+
return send_from_directory(FRONTEND_DIR, 'index.html')
|
| 88 |
+
|
| 89 |
+
# ============================================================================
|
| 90 |
+
# Authentication Decorator
|
| 91 |
+
# ============================================================================
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
def login_required(f):
|
| 95 |
+
@wraps(f)
|
| 96 |
+
def decorated(*args, **kwargs):
|
| 97 |
+
if 'user_id' not in session:
|
| 98 |
+
return jsonify({'error': 'Authentication required'}), 401
|
| 99 |
+
return f(*args, **kwargs)
|
| 100 |
+
return decorated
|
| 101 |
+
|
| 102 |
+
# ============================================================================
|
| 103 |
+
# Auth Routes
|
| 104 |
+
# ============================================================================
|
| 105 |
+
|
| 106 |
+
@app.route('/api/auth/signup', methods=['POST'])
|
| 107 |
+
def signup():
|
| 108 |
+
data = request.json
|
| 109 |
+
|
| 110 |
+
# Validation
|
| 111 |
+
if not data.get('name') or not data.get('email') or not data.get('password'):
|
| 112 |
+
return jsonify({'error': 'Name, email, and password are required'}), 400
|
| 113 |
+
|
| 114 |
+
if User.query.filter_by(email=data['email'].lower()).first():
|
| 115 |
+
return jsonify({'error': 'Email already registered'}), 400
|
| 116 |
+
|
| 117 |
+
if len(data['password']) < 6:
|
| 118 |
+
return jsonify({'error': 'Password must be at least 6 characters'}), 400
|
| 119 |
+
|
| 120 |
+
# Generate random avatar color
|
| 121 |
+
colors = ['#6366f1', '#8b5cf6', '#ec4899', '#f43f5e', '#f97316', '#eab308', '#22c55e', '#14b8a6', '#0ea5e9']
|
| 122 |
+
|
| 123 |
+
user = User(
|
| 124 |
+
name=data['name'],
|
| 125 |
+
email=data['email'].lower(),
|
| 126 |
+
password_hash=generate_password_hash(data['password']),
|
| 127 |
+
avatar_color=random.choice(colors)
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
db.session.add(user)
|
| 131 |
+
db.session.commit()
|
| 132 |
+
|
| 133 |
+
# Auto-create default anchoring agent for new user
|
| 134 |
+
_create_default_anchoring_agent(user.id)
|
| 135 |
+
|
| 136 |
+
session.permanent = True
|
| 137 |
+
session['user_id'] = user.id
|
| 138 |
+
|
| 139 |
+
return jsonify({
|
| 140 |
+
'message': 'Account created successfully',
|
| 141 |
+
'user': user.to_dict()
|
| 142 |
+
}), 201
|
| 143 |
+
|
| 144 |
+
@app.route('/api/auth/login', methods=['POST'])
|
| 145 |
+
def login():
|
| 146 |
+
data = request.json
|
| 147 |
+
|
| 148 |
+
if not data.get('email') or not data.get('password'):
|
| 149 |
+
return jsonify({'error': 'Email and password are required'}), 400
|
| 150 |
+
|
| 151 |
+
user = User.query.filter_by(email=data['email'].lower()).first()
|
| 152 |
+
|
| 153 |
+
if not user or not check_password_hash(user.password_hash, data['password']):
|
| 154 |
+
return jsonify({'error': 'Invalid email or password'}), 401
|
| 155 |
+
|
| 156 |
+
session.permanent = True
|
| 157 |
+
session['user_id'] = user.id
|
| 158 |
+
|
| 159 |
+
return jsonify({
|
| 160 |
+
'message': 'Login successful',
|
| 161 |
+
'user': user.to_dict()
|
| 162 |
+
})
|
| 163 |
+
|
| 164 |
+
@app.route('/api/auth/logout', methods=['POST'])
|
| 165 |
+
def logout():
|
| 166 |
+
session.pop('user_id', None)
|
| 167 |
+
return jsonify({'message': 'Logged out successfully'})
|
| 168 |
+
|
| 169 |
+
@app.route('/api/auth/me', methods=['GET'])
|
| 170 |
+
@login_required
|
| 171 |
+
def get_current_user():
|
| 172 |
+
user = db.session.get(User, session['user_id'])
|
| 173 |
+
if not user:
|
| 174 |
+
session.pop('user_id', None)
|
| 175 |
+
return jsonify({'error': 'User not found'}), 404
|
| 176 |
+
return jsonify({'user': user.to_dict()})
|
| 177 |
+
|
| 178 |
+
@app.route('/api/auth/forgot-password', methods=['POST'])
|
| 179 |
+
def forgot_password():
|
| 180 |
+
data = request.json
|
| 181 |
+
email = data.get('email', '').lower()
|
| 182 |
+
|
| 183 |
+
if not email:
|
| 184 |
+
return jsonify({'error': 'Email is required'}), 400
|
| 185 |
+
|
| 186 |
+
# In production, send reset email
|
| 187 |
+
# For demo, just return success
|
| 188 |
+
return jsonify({'message': 'If an account exists with this email, a reset link has been sent.'})
|
| 189 |
+
|
| 190 |
+
# ============================================================================
|
| 191 |
+
# Agent Routes
|
| 192 |
+
# ============================================================================
|
| 193 |
+
|
| 194 |
+
@app.route('/api/agents', methods=['GET'])
|
| 195 |
+
@login_required
|
| 196 |
+
def get_agents():
|
| 197 |
+
agents = Agent.query.filter_by(user_id=session['user_id']).order_by(Agent.created_at.desc()).all()
|
| 198 |
+
|
| 199 |
+
# Ensure default anchoring agent exists for this user
|
| 200 |
+
has_default = any(a.is_default and a.agent_type == 'anchoring' for a in agents)
|
| 201 |
+
if not has_default:
|
| 202 |
+
_create_default_anchoring_agent(session['user_id'])
|
| 203 |
+
agents = Agent.query.filter_by(user_id=session['user_id']).order_by(Agent.created_at.desc()).all()
|
| 204 |
+
|
| 205 |
+
return jsonify({'agents': [a.to_dict() for a in agents]})
|
| 206 |
+
|
| 207 |
+
@app.route('/api/agents', methods=['POST'])
|
| 208 |
+
@login_required
|
| 209 |
+
def create_agent():
|
| 210 |
+
data = request.json
|
| 211 |
+
|
| 212 |
+
if not data.get('name') or not data.get('role'):
|
| 213 |
+
return jsonify({'error': 'Name and role are required'}), 400
|
| 214 |
+
|
| 215 |
+
agent = Agent(
|
| 216 |
+
user_id=session['user_id'],
|
| 217 |
+
name=data['name'],
|
| 218 |
+
role=data['role'],
|
| 219 |
+
goal=data.get('goal', ''),
|
| 220 |
+
opening_message=data.get('opening_message', f"Hello! I'm {data['name']}. How can I help you today?"),
|
| 221 |
+
task_description=data.get('task_description', ''),
|
| 222 |
+
rules=json.dumps(data.get('rules', [])),
|
| 223 |
+
tone=data.get('tone', 'professional'),
|
| 224 |
+
knowledge=data.get('knowledge', ''),
|
| 225 |
+
output_config=json.dumps(data.get('output_config', {})),
|
| 226 |
+
icon=data.get('icon', '🤖'),
|
| 227 |
+
color=data.get('color', '#6366f1'),
|
| 228 |
+
status=data.get('status', 'active')
|
| 229 |
+
)
|
| 230 |
+
|
| 231 |
+
db.session.add(agent)
|
| 232 |
+
db.session.commit()
|
| 233 |
+
|
| 234 |
+
return jsonify({
|
| 235 |
+
'message': 'Agent created successfully',
|
| 236 |
+
'agent': agent.to_dict()
|
| 237 |
+
}), 201
|
| 238 |
+
|
| 239 |
+
@app.route('/api/agents/<int:agent_id>', methods=['GET'])
|
| 240 |
+
@login_required
|
| 241 |
+
def get_agent(agent_id):
|
| 242 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 243 |
+
if not agent:
|
| 244 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 245 |
+
return jsonify({'agent': agent.to_dict()})
|
| 246 |
+
|
| 247 |
+
@app.route('/api/agents/<int:agent_id>', methods=['PUT'])
|
| 248 |
+
@login_required
|
| 249 |
+
def update_agent(agent_id):
|
| 250 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 251 |
+
if not agent:
|
| 252 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 253 |
+
|
| 254 |
+
data = request.json
|
| 255 |
+
|
| 256 |
+
if 'name' in data:
|
| 257 |
+
agent.name = data['name']
|
| 258 |
+
if 'role' in data:
|
| 259 |
+
agent.role = data['role']
|
| 260 |
+
if 'goal' in data:
|
| 261 |
+
agent.goal = data['goal']
|
| 262 |
+
if 'opening_message' in data:
|
| 263 |
+
agent.opening_message = data['opening_message']
|
| 264 |
+
if 'task_description' in data:
|
| 265 |
+
agent.task_description = data['task_description']
|
| 266 |
+
if 'rules' in data:
|
| 267 |
+
agent.rules = json.dumps(data['rules'])
|
| 268 |
+
if 'tone' in data:
|
| 269 |
+
agent.tone = data['tone']
|
| 270 |
+
if 'knowledge' in data:
|
| 271 |
+
agent.knowledge = data['knowledge']
|
| 272 |
+
if 'output_config' in data:
|
| 273 |
+
agent.output_config = json.dumps(data['output_config'])
|
| 274 |
+
if 'icon' in data:
|
| 275 |
+
agent.icon = data['icon']
|
| 276 |
+
if 'color' in data:
|
| 277 |
+
agent.color = data['color']
|
| 278 |
+
if 'status' in data:
|
| 279 |
+
agent.status = data['status']
|
| 280 |
+
# Anchoring-specific: update script content
|
| 281 |
+
if 'script_content' in data:
|
| 282 |
+
agent.script_content = data['script_content']
|
| 283 |
+
|
| 284 |
+
db.session.commit()
|
| 285 |
+
|
| 286 |
+
return jsonify({
|
| 287 |
+
'message': 'Agent updated successfully',
|
| 288 |
+
'agent': agent.to_dict()
|
| 289 |
+
})
|
| 290 |
+
|
| 291 |
+
@app.route('/api/agents/<int:agent_id>', methods=['DELETE'])
|
| 292 |
+
@login_required
|
| 293 |
+
def delete_agent(agent_id):
|
| 294 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 295 |
+
if not agent:
|
| 296 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 297 |
+
|
| 298 |
+
# Prevent deletion of default system agents
|
| 299 |
+
if agent.is_default:
|
| 300 |
+
return jsonify({'error': 'Cannot delete system default agent'}), 403
|
| 301 |
+
|
| 302 |
+
db.session.delete(agent)
|
| 303 |
+
db.session.commit()
|
| 304 |
+
|
| 305 |
+
return jsonify({'message': 'Agent deleted successfully'})
|
| 306 |
+
|
| 307 |
+
# ============================================================================
|
| 308 |
+
# Share Link Routes
|
| 309 |
+
# ============================================================================
|
| 310 |
+
|
| 311 |
+
@app.route('/api/agents/<int:agent_id>/share-links', methods=['GET'])
|
| 312 |
+
@login_required
|
| 313 |
+
def get_share_links(agent_id):
|
| 314 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 315 |
+
if not agent:
|
| 316 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 317 |
+
|
| 318 |
+
links = ShareLink.query.filter_by(agent_id=agent_id).order_by(ShareLink.created_at.desc()).all()
|
| 319 |
+
return jsonify({'share_links': [l.to_dict() for l in links]})
|
| 320 |
+
|
| 321 |
+
@app.route('/api/agents/<int:agent_id>/share-links', methods=['POST'])
|
| 322 |
+
@login_required
|
| 323 |
+
def create_share_link(agent_id):
|
| 324 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 325 |
+
if not agent:
|
| 326 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 327 |
+
|
| 328 |
+
data = request.json
|
| 329 |
+
|
| 330 |
+
link = ShareLink(
|
| 331 |
+
agent_id=agent_id,
|
| 332 |
+
token=secrets.token_urlsafe(32),
|
| 333 |
+
name=data.get('name') or None,
|
| 334 |
+
password_hash=generate_password_hash(data['password']) if data.get('password') else None,
|
| 335 |
+
expires_at=datetime.utcnow() + timedelta(days=data.get('expires_days', 7)) if data.get('expires_days') else None,
|
| 336 |
+
max_uses=data.get('max_uses'),
|
| 337 |
+
require_name=data.get('require_name', True),
|
| 338 |
+
require_email=data.get('require_email', False)
|
| 339 |
+
)
|
| 340 |
+
|
| 341 |
+
db.session.add(link)
|
| 342 |
+
db.session.commit()
|
| 343 |
+
|
| 344 |
+
return jsonify({
|
| 345 |
+
'message': 'Share link created successfully',
|
| 346 |
+
'share_link': link.to_dict()
|
| 347 |
+
}), 201
|
| 348 |
+
|
| 349 |
+
@app.route('/api/share-links/<int:link_id>', methods=['DELETE'])
|
| 350 |
+
@login_required
|
| 351 |
+
def delete_share_link(link_id):
|
| 352 |
+
link = db.session.get(ShareLink, link_id)
|
| 353 |
+
if not link:
|
| 354 |
+
return jsonify({'error': 'Share link not found'}), 404
|
| 355 |
+
|
| 356 |
+
# Verify ownership
|
| 357 |
+
agent = Agent.query.filter_by(id=link.agent_id, user_id=session['user_id']).first()
|
| 358 |
+
if not agent:
|
| 359 |
+
return jsonify({'error': 'Not authorized'}), 403
|
| 360 |
+
|
| 361 |
+
db.session.delete(link)
|
| 362 |
+
db.session.commit()
|
| 363 |
+
|
| 364 |
+
return jsonify({'message': 'Share link deleted successfully'})
|
| 365 |
+
|
| 366 |
+
# ============================================================================
|
| 367 |
+
# Upload Routes
|
| 368 |
+
# ============================================================================
|
| 369 |
+
|
| 370 |
+
def allowed_file(filename):
|
| 371 |
+
return '.' in filename and \
|
| 372 |
+
filename.rsplit('.', 1)[1].lower() in app.config['ALLOWED_EXTENSIONS']
|
| 373 |
+
|
| 374 |
+
@app.route('/api/upload', methods=['POST'])
|
| 375 |
+
@login_required
|
| 376 |
+
def upload_file():
|
| 377 |
+
if 'file' not in request.files:
|
| 378 |
+
return jsonify({'error': 'No file part'}), 400
|
| 379 |
+
|
| 380 |
+
file = request.files['file']
|
| 381 |
+
|
| 382 |
+
if file.filename == '':
|
| 383 |
+
return jsonify({'error': 'No selected file'}), 400
|
| 384 |
+
|
| 385 |
+
if file and allowed_file(file.filename):
|
| 386 |
+
# Create directory if it doesn't exist
|
| 387 |
+
os.makedirs(app.config['UPLOAD_FOLDER'], exist_ok=True)
|
| 388 |
+
|
| 389 |
+
# Secure filename and add timestamp to prevent collisions
|
| 390 |
+
from werkzeug.utils import secure_filename
|
| 391 |
+
import time
|
| 392 |
+
|
| 393 |
+
original_filename = secure_filename(file.filename)
|
| 394 |
+
timestamp = int(time.time())
|
| 395 |
+
filename = f"{timestamp}_{original_filename}"
|
| 396 |
+
|
| 397 |
+
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
|
| 398 |
+
|
| 399 |
+
# Return the public URL
|
| 400 |
+
return jsonify({
|
| 401 |
+
'message': 'File uploaded successfully',
|
| 402 |
+
'url': f'image/uploads/{filename}'
|
| 403 |
+
})
|
| 404 |
+
|
| 405 |
+
return jsonify({'error': 'File type not allowed'}), 400
|
| 406 |
+
|
| 407 |
+
# ============================================================================
|
| 408 |
+
# Public Share Access Routes
|
| 409 |
+
# ============================================================================
|
| 410 |
+
|
| 411 |
+
@app.route('/api/share/<token>', methods=['GET'])
|
| 412 |
+
def get_share_info(token):
|
| 413 |
+
link = ShareLink.query.filter_by(token=token).first()
|
| 414 |
+
if not link:
|
| 415 |
+
return jsonify({'error': 'Invalid or expired link'}), 404
|
| 416 |
+
|
| 417 |
+
if link.expires_at and datetime.utcnow() > link.expires_at:
|
| 418 |
+
return jsonify({'error': 'This link has expired'}), 410
|
| 419 |
+
|
| 420 |
+
if link.max_uses and link.current_uses >= link.max_uses:
|
| 421 |
+
return jsonify({'error': 'This link has reached its maximum uses'}), 410
|
| 422 |
+
|
| 423 |
+
return jsonify({
|
| 424 |
+
'agent_name': link.agent.name,
|
| 425 |
+
'agent_icon': link.agent.icon,
|
| 426 |
+
'agent_color': link.agent.color,
|
| 427 |
+
'agent_role': link.agent.role,
|
| 428 |
+
'has_password': link.password_hash is not None,
|
| 429 |
+
'require_name': link.require_name,
|
| 430 |
+
'require_email': link.require_email
|
| 431 |
+
})
|
| 432 |
+
|
| 433 |
+
@app.route('/api/share/<token>/verify', methods=['POST'])
|
| 434 |
+
def verify_share_password(token):
|
| 435 |
+
link = ShareLink.query.filter_by(token=token).first()
|
| 436 |
+
if not link:
|
| 437 |
+
return jsonify({'error': 'Invalid link'}), 404
|
| 438 |
+
|
| 439 |
+
data = request.json
|
| 440 |
+
|
| 441 |
+
if link.password_hash:
|
| 442 |
+
if not data.get('password') or not check_password_hash(link.password_hash, data['password']):
|
| 443 |
+
return jsonify({'error': 'Incorrect password'}), 401
|
| 444 |
+
|
| 445 |
+
return jsonify({'message': 'Password verified'})
|
| 446 |
+
|
| 447 |
+
@app.route('/api/share/<token>/start', methods=['POST'])
|
| 448 |
+
def start_share_conversation(token):
|
| 449 |
+
link = ShareLink.query.filter_by(token=token).first()
|
| 450 |
+
if not link:
|
| 451 |
+
return jsonify({'error': 'Invalid link'}), 404
|
| 452 |
+
|
| 453 |
+
if link.expires_at and datetime.utcnow() > link.expires_at:
|
| 454 |
+
return jsonify({'error': 'This link has expired'}), 410
|
| 455 |
+
|
| 456 |
+
if link.max_uses and link.current_uses >= link.max_uses:
|
| 457 |
+
return jsonify({'error': 'This link has reached maximum uses'}), 410
|
| 458 |
+
|
| 459 |
+
data = request.json
|
| 460 |
+
|
| 461 |
+
if link.require_name and not data.get('name'):
|
| 462 |
+
return jsonify({'error': 'Name is required'}), 400
|
| 463 |
+
|
| 464 |
+
if link.require_email and not data.get('email'):
|
| 465 |
+
return jsonify({'error': 'Email is required'}), 400
|
| 466 |
+
|
| 467 |
+
# Increment link usage
|
| 468 |
+
link.current_uses += 1
|
| 469 |
+
|
| 470 |
+
# Create conversation
|
| 471 |
+
conversation = Conversation(
|
| 472 |
+
agent_id=link.agent_id,
|
| 473 |
+
share_link_id=link.id,
|
| 474 |
+
participant_name=data.get('name'),
|
| 475 |
+
participant_email=data.get('email'),
|
| 476 |
+
mode=data.get('mode', 'text'),
|
| 477 |
+
status='active'
|
| 478 |
+
)
|
| 479 |
+
|
| 480 |
+
db.session.add(conversation)
|
| 481 |
+
db.session.commit()
|
| 482 |
+
|
| 483 |
+
# Add opening message
|
| 484 |
+
if link.agent.opening_message:
|
| 485 |
+
opening = Message(
|
| 486 |
+
conversation_id=conversation.id,
|
| 487 |
+
role='agent',
|
| 488 |
+
content=link.agent.opening_message
|
| 489 |
+
)
|
| 490 |
+
db.session.add(opening)
|
| 491 |
+
db.session.commit()
|
| 492 |
+
|
| 493 |
+
return jsonify({
|
| 494 |
+
'conversation_id': conversation.id,
|
| 495 |
+
'agent': link.agent.to_dict(),
|
| 496 |
+
'opening_message': link.agent.opening_message
|
| 497 |
+
})
|
| 498 |
+
|
| 499 |
+
# ============================================================================
|
| 500 |
+
# Conversation Routes
|
| 501 |
+
# ============================================================================
|
| 502 |
+
|
| 503 |
+
@app.route('/api/conversations', methods=['GET'])
|
| 504 |
+
@login_required
|
| 505 |
+
def get_conversations():
|
| 506 |
+
# Get all conversations for user's agents
|
| 507 |
+
user_agents = Agent.query.filter_by(user_id=session['user_id']).all()
|
| 508 |
+
agent_ids = [a.id for a in user_agents]
|
| 509 |
+
|
| 510 |
+
conversations = Conversation.query.filter(
|
| 511 |
+
Conversation.agent_id.in_(agent_ids)
|
| 512 |
+
).order_by(Conversation.started_at.desc()).all()
|
| 513 |
+
|
| 514 |
+
return jsonify({'conversations': [c.to_dict() for c in conversations]})
|
| 515 |
+
|
| 516 |
+
@app.route('/api/conversations/<int:conv_id>', methods=['GET'])
|
| 517 |
+
def get_conversation(conv_id):
|
| 518 |
+
conversation = db.session.get(Conversation, conv_id)
|
| 519 |
+
if not conversation:
|
| 520 |
+
return jsonify({'error': 'Conversation not found'}), 404
|
| 521 |
+
|
| 522 |
+
messages = [m.to_dict() for m in conversation.messages]
|
| 523 |
+
|
| 524 |
+
return jsonify({
|
| 525 |
+
'conversation': conversation.to_dict(),
|
| 526 |
+
'messages': messages,
|
| 527 |
+
'agent': conversation.agent.to_dict()
|
| 528 |
+
})
|
| 529 |
+
|
| 530 |
+
@app.route('/api/conversations', methods=['POST'])
|
| 531 |
+
@login_required
|
| 532 |
+
def create_conversation():
|
| 533 |
+
data = request.json
|
| 534 |
+
agent_id = data.get('agent_id')
|
| 535 |
+
|
| 536 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 537 |
+
if not agent:
|
| 538 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 539 |
+
|
| 540 |
+
user = db.session.get(User, session['user_id'])
|
| 541 |
+
|
| 542 |
+
conversation = Conversation(
|
| 543 |
+
agent_id=agent_id,
|
| 544 |
+
user_id=session['user_id'],
|
| 545 |
+
participant_name=user.name,
|
| 546 |
+
participant_email=user.email,
|
| 547 |
+
mode=data.get('mode', 'text'),
|
| 548 |
+
status='active'
|
| 549 |
+
)
|
| 550 |
+
|
| 551 |
+
db.session.add(conversation)
|
| 552 |
+
db.session.commit()
|
| 553 |
+
|
| 554 |
+
# Add opening message
|
| 555 |
+
if agent.opening_message:
|
| 556 |
+
opening = Message(
|
| 557 |
+
conversation_id=conversation.id,
|
| 558 |
+
role='agent',
|
| 559 |
+
content=agent.opening_message
|
| 560 |
+
)
|
| 561 |
+
db.session.add(opening)
|
| 562 |
+
db.session.commit()
|
| 563 |
+
|
| 564 |
+
return jsonify({
|
| 565 |
+
'conversation': conversation.to_dict(),
|
| 566 |
+
'agent': agent.to_dict(),
|
| 567 |
+
'opening_message': agent.opening_message
|
| 568 |
+
}), 201
|
| 569 |
+
|
| 570 |
+
@app.route('/api/conversations/<int:conv_id>/messages', methods=['POST'])
|
| 571 |
+
def send_message(conv_id):
|
| 572 |
+
conversation = db.session.get(Conversation, conv_id)
|
| 573 |
+
if not conversation:
|
| 574 |
+
return jsonify({'error': 'Conversation not found'}), 404
|
| 575 |
+
|
| 576 |
+
if conversation.status == 'completed':
|
| 577 |
+
return jsonify({'error': 'Conversation has ended'}), 400
|
| 578 |
+
|
| 579 |
+
data = request.json
|
| 580 |
+
user_content = data.get('content', '').strip()
|
| 581 |
+
|
| 582 |
+
if not user_content:
|
| 583 |
+
return jsonify({'error': 'Message content is required'}), 400
|
| 584 |
+
|
| 585 |
+
# Save user message
|
| 586 |
+
user_message = Message(
|
| 587 |
+
conversation_id=conv_id,
|
| 588 |
+
role='user',
|
| 589 |
+
content=user_content
|
| 590 |
+
)
|
| 591 |
+
db.session.add(user_message)
|
| 592 |
+
db.session.commit()
|
| 593 |
+
|
| 594 |
+
# Get conversation history
|
| 595 |
+
messages = Message.query.filter_by(conversation_id=conv_id).order_by(Message.timestamp).all()
|
| 596 |
+
|
| 597 |
+
# Generate AI response — pass conversation mode so video calls get short responses
|
| 598 |
+
agent = conversation.agent
|
| 599 |
+
conv_mode = getattr(conversation, 'mode', 'text') or 'text'
|
| 600 |
+
ai_response = ai_service.generate_response(agent, messages[:-1], user_content, mode=conv_mode)
|
| 601 |
+
|
| 602 |
+
# Save AI response
|
| 603 |
+
agent_message = Message(
|
| 604 |
+
conversation_id=conv_id,
|
| 605 |
+
role='agent',
|
| 606 |
+
content=ai_response
|
| 607 |
+
)
|
| 608 |
+
db.session.add(agent_message)
|
| 609 |
+
db.session.commit()
|
| 610 |
+
|
| 611 |
+
return jsonify({
|
| 612 |
+
'user_message': user_message.to_dict(),
|
| 613 |
+
'agent_message': agent_message.to_dict()
|
| 614 |
+
})
|
| 615 |
+
|
| 616 |
+
@app.route('/api/conversations/<int:conv_id>/end', methods=['POST'])
|
| 617 |
+
def end_conversation(conv_id):
|
| 618 |
+
conversation = db.session.get(Conversation, conv_id)
|
| 619 |
+
if not conversation:
|
| 620 |
+
return jsonify({'error': 'Conversation not found'}), 404
|
| 621 |
+
|
| 622 |
+
conversation.status = 'completed'
|
| 623 |
+
conversation.ended_at = datetime.utcnow()
|
| 624 |
+
|
| 625 |
+
# Generate report if evaluation is enabled
|
| 626 |
+
agent = conversation.agent
|
| 627 |
+
output_config = json.loads(agent.output_config) if agent.output_config else {}
|
| 628 |
+
|
| 629 |
+
messages = Message.query.filter_by(conversation_id=conv_id).order_by(Message.timestamp).all()
|
| 630 |
+
|
| 631 |
+
report_data = {}
|
| 632 |
+
|
| 633 |
+
# Evaluate conversation
|
| 634 |
+
if output_config.get('evaluation', False):
|
| 635 |
+
evaluation = scoring_service.evaluate_conversation(agent, messages)
|
| 636 |
+
report_data['overall_score'] = evaluation['overall_score']
|
| 637 |
+
report_data['criteria_scores'] = json.dumps(evaluation['criteria_scores'])
|
| 638 |
+
|
| 639 |
+
# Generate summary
|
| 640 |
+
if output_config.get('summary', True):
|
| 641 |
+
report_data['summary'] = ai_service.generate_summary(agent, messages)
|
| 642 |
+
|
| 643 |
+
# Generate feedback
|
| 644 |
+
if output_config.get('evaluation', False):
|
| 645 |
+
scores = json.loads(report_data.get('criteria_scores', '{}'))
|
| 646 |
+
report_data['feedback'] = ai_service.generate_feedback(agent, messages, scores)
|
| 647 |
+
report_data['recommendations'] = ''
|
| 648 |
+
|
| 649 |
+
# Save transcript
|
| 650 |
+
if output_config.get('transcript', True):
|
| 651 |
+
transcript = [{'role': m.role, 'content': m.content, 'timestamp': m.timestamp.isoformat()} for m in messages]
|
| 652 |
+
report_data['transcript'] = json.dumps(transcript)
|
| 653 |
+
|
| 654 |
+
# Create report
|
| 655 |
+
if report_data:
|
| 656 |
+
report = Report(
|
| 657 |
+
conversation_id=conv_id,
|
| 658 |
+
**report_data
|
| 659 |
+
)
|
| 660 |
+
db.session.add(report)
|
| 661 |
+
|
| 662 |
+
db.session.commit()
|
| 663 |
+
|
| 664 |
+
return jsonify({
|
| 665 |
+
'message': 'Conversation ended',
|
| 666 |
+
'conversation': conversation.to_dict(),
|
| 667 |
+
'has_report': bool(report_data)
|
| 668 |
+
})
|
| 669 |
+
|
| 670 |
+
# ============================================================================
|
| 671 |
+
# Report Routes
|
| 672 |
+
# ============================================================================
|
| 673 |
+
|
| 674 |
+
@app.route('/api/reports/generate/<int:conv_id>', methods=['POST'])
|
| 675 |
+
@login_required
|
| 676 |
+
def generate_report_for_conversation(conv_id):
|
| 677 |
+
"""Generate a report for an existing conversation"""
|
| 678 |
+
conversation = db.session.get(Conversation, conv_id)
|
| 679 |
+
if not conversation:
|
| 680 |
+
return jsonify({'error': 'Conversation not found'}), 404
|
| 681 |
+
|
| 682 |
+
# Verify ownership
|
| 683 |
+
agent = Agent.query.filter_by(id=conversation.agent_id, user_id=session['user_id']).first()
|
| 684 |
+
if not agent:
|
| 685 |
+
return jsonify({'error': 'Not authorized'}), 403
|
| 686 |
+
|
| 687 |
+
# Check if report already exists
|
| 688 |
+
existing_report = Report.query.filter_by(conversation_id=conv_id).first()
|
| 689 |
+
if existing_report:
|
| 690 |
+
return jsonify({'message': 'Report already exists', 'report_id': existing_report.id})
|
| 691 |
+
|
| 692 |
+
messages = Message.query.filter_by(conversation_id=conv_id).order_by(Message.timestamp).all()
|
| 693 |
+
|
| 694 |
+
if not messages or len(messages) < 2:
|
| 695 |
+
return jsonify({'error': 'Not enough messages to generate a report'}), 400
|
| 696 |
+
|
| 697 |
+
output_config = json.loads(agent.output_config) if agent.output_config else {}
|
| 698 |
+
report_data = {}
|
| 699 |
+
|
| 700 |
+
# Evaluate conversation
|
| 701 |
+
if output_config.get('evaluation', False):
|
| 702 |
+
try:
|
| 703 |
+
evaluation = scoring_service.evaluate_conversation(agent, messages)
|
| 704 |
+
report_data['overall_score'] = evaluation.get('overall_score')
|
| 705 |
+
report_data['criteria_scores'] = json.dumps(evaluation.get('criteria_scores', {}))
|
| 706 |
+
except Exception as e:
|
| 707 |
+
print(f"Evaluation error: {e}")
|
| 708 |
+
|
| 709 |
+
# Generate summary
|
| 710 |
+
try:
|
| 711 |
+
report_data['summary'] = ai_service.generate_summary(agent, messages)
|
| 712 |
+
except Exception as e:
|
| 713 |
+
print(f"Summary generation error: {e}")
|
| 714 |
+
report_data['summary'] = 'Summary generation failed.'
|
| 715 |
+
|
| 716 |
+
# Generate feedback
|
| 717 |
+
if output_config.get('evaluation', False):
|
| 718 |
+
try:
|
| 719 |
+
scores = json.loads(report_data.get('criteria_scores', '{}'))
|
| 720 |
+
report_data['feedback'] = ai_service.generate_feedback(agent, messages, scores)
|
| 721 |
+
except Exception as e:
|
| 722 |
+
print(f"Feedback generation error: {e}")
|
| 723 |
+
|
| 724 |
+
# Save transcript
|
| 725 |
+
if output_config.get('transcript', True):
|
| 726 |
+
transcript = [{'role': m.role, 'content': m.content, 'timestamp': m.timestamp.isoformat()} for m in messages]
|
| 727 |
+
report_data['transcript'] = json.dumps(transcript)
|
| 728 |
+
|
| 729 |
+
# Create report
|
| 730 |
+
report = Report(
|
| 731 |
+
conversation_id=conv_id,
|
| 732 |
+
**report_data
|
| 733 |
+
)
|
| 734 |
+
db.session.add(report)
|
| 735 |
+
db.session.commit()
|
| 736 |
+
|
| 737 |
+
return jsonify({
|
| 738 |
+
'message': 'Report generated successfully',
|
| 739 |
+
'report_id': report.id
|
| 740 |
+
}), 201
|
| 741 |
+
|
| 742 |
+
@app.route('/api/conversations/<int:conv_id>', methods=['DELETE'])
|
| 743 |
+
@login_required
|
| 744 |
+
def delete_conversation(conv_id):
|
| 745 |
+
"""Delete a conversation"""
|
| 746 |
+
conversation = db.session.get(Conversation, conv_id)
|
| 747 |
+
if not conversation:
|
| 748 |
+
return jsonify({'error': 'Conversation not found'}), 404
|
| 749 |
+
|
| 750 |
+
# Verify ownership
|
| 751 |
+
agent = Agent.query.filter_by(id=conversation.agent_id, user_id=session['user_id']).first()
|
| 752 |
+
if not agent:
|
| 753 |
+
return jsonify({'error': 'Not authorized'}), 403
|
| 754 |
+
|
| 755 |
+
db.session.delete(conversation)
|
| 756 |
+
db.session.commit()
|
| 757 |
+
|
| 758 |
+
return jsonify({'message': 'Conversation deleted successfully'})
|
| 759 |
+
|
| 760 |
+
@app.route('/api/reports', methods=['GET'])
|
| 761 |
+
@login_required
|
| 762 |
+
def get_reports():
|
| 763 |
+
user_agents = Agent.query.filter_by(user_id=session['user_id']).all()
|
| 764 |
+
agent_ids = [a.id for a in user_agents]
|
| 765 |
+
|
| 766 |
+
conversations = Conversation.query.filter(
|
| 767 |
+
Conversation.agent_id.in_(agent_ids)
|
| 768 |
+
).all()
|
| 769 |
+
conv_ids = [c.id for c in conversations]
|
| 770 |
+
|
| 771 |
+
reports = Report.query.filter(Report.conversation_id.in_(conv_ids)).order_by(Report.created_at.desc()).all()
|
| 772 |
+
|
| 773 |
+
result = []
|
| 774 |
+
for report in reports:
|
| 775 |
+
data = report.to_dict()
|
| 776 |
+
data['agent_name'] = report.conversation.agent.name
|
| 777 |
+
data['agent_icon'] = report.conversation.agent.icon
|
| 778 |
+
data['participant_name'] = report.conversation.participant_name
|
| 779 |
+
result.append(data)
|
| 780 |
+
|
| 781 |
+
return jsonify({'reports': result})
|
| 782 |
+
|
| 783 |
+
@app.route('/api/reports/<int:report_id>', methods=['GET'])
|
| 784 |
+
def get_report(report_id):
|
| 785 |
+
report = db.session.get(Report, report_id)
|
| 786 |
+
if not report:
|
| 787 |
+
return jsonify({'error': 'Report not found'}), 404
|
| 788 |
+
|
| 789 |
+
data = report.to_dict()
|
| 790 |
+
data['agent'] = report.conversation.agent.to_dict()
|
| 791 |
+
data['conversation'] = report.conversation.to_dict()
|
| 792 |
+
|
| 793 |
+
return jsonify({'report': data})
|
| 794 |
+
|
| 795 |
+
# ============================================================================
|
| 796 |
+
# Report Chat & Export Routes (Login Required — agent owner only)
|
| 797 |
+
# ============================================================================
|
| 798 |
+
|
| 799 |
+
@app.route('/api/agents/<int:agent_id>/report-chat', methods=['POST'])
|
| 800 |
+
@login_required
|
| 801 |
+
def report_chat(agent_id):
|
| 802 |
+
"""AI chatbot that answers questions about an agent's conversation/report data."""
|
| 803 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 804 |
+
if not agent:
|
| 805 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 806 |
+
|
| 807 |
+
data = request.json
|
| 808 |
+
user_message = data.get('message', '').strip()
|
| 809 |
+
chat_history = data.get('history', []) # list of {role, content}
|
| 810 |
+
|
| 811 |
+
if not user_message:
|
| 812 |
+
return jsonify({'error': 'Message is required'}), 400
|
| 813 |
+
|
| 814 |
+
# Load all conversations and reports for this agent
|
| 815 |
+
conversations = Conversation.query.filter_by(agent_id=agent_id).order_by(Conversation.started_at.desc()).all()
|
| 816 |
+
conv_ids = [c.id for c in conversations]
|
| 817 |
+
reports = Report.query.filter(Report.conversation_id.in_(conv_ids)).all() if conv_ids else []
|
| 818 |
+
|
| 819 |
+
reply = ai_service.generate_report_chat_response(agent, conversations, reports, chat_history, user_message)
|
| 820 |
+
|
| 821 |
+
return jsonify({'reply': reply})
|
| 822 |
+
|
| 823 |
+
|
| 824 |
+
@app.route('/api/agents/<int:agent_id>/export-report', methods=['POST'])
|
| 825 |
+
@login_required
|
| 826 |
+
def export_report(agent_id):
|
| 827 |
+
"""Export agent report data as DOCX."""
|
| 828 |
+
from docx import Document
|
| 829 |
+
from docx.shared import Pt, RGBColor, Inches
|
| 830 |
+
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
| 831 |
+
import io
|
| 832 |
+
from flask import send_file
|
| 833 |
+
|
| 834 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 835 |
+
if not agent:
|
| 836 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 837 |
+
|
| 838 |
+
# Load data
|
| 839 |
+
conversations = Conversation.query.filter_by(agent_id=agent_id).order_by(Conversation.started_at.desc()).all()
|
| 840 |
+
conv_ids = [c.id for c in conversations]
|
| 841 |
+
reports = Report.query.filter(Report.conversation_id.in_(conv_ids)).all() if conv_ids else []
|
| 842 |
+
|
| 843 |
+
# Compute stats
|
| 844 |
+
completed = [c for c in conversations if c.status == 'completed']
|
| 845 |
+
scored = [r for r in reports if r.overall_score is not None]
|
| 846 |
+
avg_score = round(sum(r.overall_score for r in scored) / len(scored), 1) if scored else None
|
| 847 |
+
|
| 848 |
+
# Build performance list
|
| 849 |
+
perf = []
|
| 850 |
+
for r in sorted(scored, key=lambda x: x.overall_score, reverse=True):
|
| 851 |
+
conv = next((c for c in conversations if c.id == r.conversation_id), None)
|
| 852 |
+
if conv:
|
| 853 |
+
perf.append((conv.participant_name or 'Anonymous', round(r.overall_score), r.summary or ''))
|
| 854 |
+
|
| 855 |
+
# Build DOCX
|
| 856 |
+
doc = Document()
|
| 857 |
+
|
| 858 |
+
# Title
|
| 859 |
+
title = doc.add_heading(f'Report: {agent.name}', 0)
|
| 860 |
+
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
|
| 861 |
+
|
| 862 |
+
doc.add_paragraph(f'Role: {agent.role}')
|
| 863 |
+
doc.add_paragraph(f'Generated: {datetime.utcnow().strftime("%B %d, %Y")}')
|
| 864 |
+
doc.add_paragraph('')
|
| 865 |
+
|
| 866 |
+
# Stats section
|
| 867 |
+
doc.add_heading('Overview', level=1)
|
| 868 |
+
doc.add_paragraph(f'Total Conversations: {len(conversations)}')
|
| 869 |
+
doc.add_paragraph(f'Completed: {len(completed)}')
|
| 870 |
+
doc.add_paragraph(f'Average Score: {f"{avg_score}/100" if avg_score is not None else "N/A"}')
|
| 871 |
+
doc.add_paragraph('')
|
| 872 |
+
|
| 873 |
+
# Performance rankings
|
| 874 |
+
if perf:
|
| 875 |
+
doc.add_heading('Participant Performance Rankings', level=1)
|
| 876 |
+
table = doc.add_table(rows=1, cols=3)
|
| 877 |
+
table.style = 'Table Grid'
|
| 878 |
+
hdr = table.rows[0].cells
|
| 879 |
+
hdr[0].text = 'Rank'
|
| 880 |
+
hdr[1].text = 'Participant'
|
| 881 |
+
hdr[2].text = 'Score'
|
| 882 |
+
for i, (name, score, summary) in enumerate(perf, 1):
|
| 883 |
+
row = table.add_row().cells
|
| 884 |
+
row[0].text = str(i)
|
| 885 |
+
row[1].text = name
|
| 886 |
+
row[2].text = f'{score}/100'
|
| 887 |
+
doc.add_paragraph('')
|
| 888 |
+
|
| 889 |
+
# Recent conversations
|
| 890 |
+
if conversations:
|
| 891 |
+
doc.add_heading('Recent Conversations', level=1)
|
| 892 |
+
for c in conversations[:10]:
|
| 893 |
+
p = doc.add_paragraph(style='List Bullet')
|
| 894 |
+
p.add_run(f'{c.participant_name or "Anonymous"}').bold = True
|
| 895 |
+
date_str = c.started_at.strftime('%b %d, %Y') if c.started_at else '?'
|
| 896 |
+
p.add_run(f' — {date_str} ({c.status}, {len(c.messages)} messages)')
|
| 897 |
+
|
| 898 |
+
# Save to bytes
|
| 899 |
+
buf = io.BytesIO()
|
| 900 |
+
doc.save(buf)
|
| 901 |
+
buf.seek(0)
|
| 902 |
+
|
| 903 |
+
safe_name = agent.name.replace(' ', '_').lower()
|
| 904 |
+
filename = f'report_{safe_name}_{datetime.utcnow().strftime("%Y%m%d")}.docx'
|
| 905 |
+
|
| 906 |
+
return send_file(
|
| 907 |
+
buf,
|
| 908 |
+
mimetype='application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
| 909 |
+
as_attachment=True,
|
| 910 |
+
download_name=filename
|
| 911 |
+
)
|
| 912 |
+
|
| 913 |
+
|
| 914 |
+
# ============================================================================
|
| 915 |
+
# Dashboard Stats Route
|
| 916 |
+
# ============================================================================
|
| 917 |
+
|
| 918 |
+
@app.route('/api/dashboard/stats', methods=['GET'])
|
| 919 |
+
@login_required
|
| 920 |
+
def get_dashboard_stats():
|
| 921 |
+
user_id = session['user_id']
|
| 922 |
+
|
| 923 |
+
# Count agents
|
| 924 |
+
total_agents = Agent.query.filter_by(user_id=user_id).count()
|
| 925 |
+
active_agents = Agent.query.filter_by(user_id=user_id, status='active').count()
|
| 926 |
+
|
| 927 |
+
# Count conversations
|
| 928 |
+
user_agents = Agent.query.filter_by(user_id=user_id).all()
|
| 929 |
+
agent_ids = [a.id for a in user_agents]
|
| 930 |
+
|
| 931 |
+
conversations = Conversation.query.filter(Conversation.agent_id.in_(agent_ids)).count() if agent_ids else 0
|
| 932 |
+
|
| 933 |
+
# Count share links
|
| 934 |
+
share_links = ShareLink.query.filter(ShareLink.agent_id.in_(agent_ids)).count() if agent_ids else 0
|
| 935 |
+
|
| 936 |
+
# Recent agents
|
| 937 |
+
recent_agents = Agent.query.filter_by(user_id=user_id).order_by(Agent.created_at.desc()).limit(4).all()
|
| 938 |
+
|
| 939 |
+
# Recent conversations
|
| 940 |
+
recent_convs = Conversation.query.filter(
|
| 941 |
+
Conversation.agent_id.in_(agent_ids)
|
| 942 |
+
).order_by(Conversation.started_at.desc()).limit(5).all() if agent_ids else []
|
| 943 |
+
|
| 944 |
+
return jsonify({
|
| 945 |
+
'stats': {
|
| 946 |
+
'total_agents': total_agents,
|
| 947 |
+
'active_agents': active_agents,
|
| 948 |
+
'conversations': conversations,
|
| 949 |
+
'share_links': share_links
|
| 950 |
+
},
|
| 951 |
+
'recent_agents': [a.to_dict() for a in recent_agents],
|
| 952 |
+
'recent_conversations': [c.to_dict() for c in recent_convs]
|
| 953 |
+
})
|
| 954 |
+
|
| 955 |
+
# ============================================================================
|
| 956 |
+
# Agent Analytics Route
|
| 957 |
+
# ============================================================================
|
| 958 |
+
|
| 959 |
+
@app.route('/api/agents/<int:agent_id>/analytics', methods=['GET'])
|
| 960 |
+
@login_required
|
| 961 |
+
def get_agent_analytics(agent_id):
|
| 962 |
+
"""Return analytics data for a specific agent"""
|
| 963 |
+
agent = Agent.query.filter_by(id=agent_id, user_id=session['user_id']).first()
|
| 964 |
+
if not agent:
|
| 965 |
+
return jsonify({'error': 'Agent not found'}), 404
|
| 966 |
+
|
| 967 |
+
# Conversations for this agent
|
| 968 |
+
convs = Conversation.query.filter_by(agent_id=agent_id).all()
|
| 969 |
+
|
| 970 |
+
# Conversations by day (last 30 days)
|
| 971 |
+
from collections import defaultdict
|
| 972 |
+
day_counts = defaultdict(int)
|
| 973 |
+
cutoff = datetime.utcnow() - timedelta(days=30)
|
| 974 |
+
for c in convs:
|
| 975 |
+
if c.started_at >= cutoff:
|
| 976 |
+
day_key = c.started_at.strftime('%Y-%m-%d')
|
| 977 |
+
day_counts[day_key] += 1
|
| 978 |
+
|
| 979 |
+
# Build sorted list of last 30 days
|
| 980 |
+
days_data = []
|
| 981 |
+
for i in range(29, -1, -1):
|
| 982 |
+
d = (datetime.utcnow() - timedelta(days=i)).strftime('%Y-%m-%d')
|
| 983 |
+
days_data.append({'date': d, 'count': day_counts.get(d, 0)})
|
| 984 |
+
|
| 985 |
+
# Mode breakdown
|
| 986 |
+
text_count = sum(1 for c in convs if c.mode == 'text')
|
| 987 |
+
video_count = sum(1 for c in convs if c.mode == 'video')
|
| 988 |
+
|
| 989 |
+
# Average score from reports
|
| 990 |
+
reports = [Report.query.filter_by(conversation_id=c.id).first() for c in convs]
|
| 991 |
+
scores = [r.overall_score for r in reports if r and r.overall_score is not None]
|
| 992 |
+
avg_score = round(sum(scores) / len(scores), 1) if scores else None
|
| 993 |
+
|
| 994 |
+
# Score trend (last 10 scored conversations)
|
| 995 |
+
scored_convs = [(c, Report.query.filter_by(conversation_id=c.id).first()) for c in sorted(convs, key=lambda x: x.started_at)]
|
| 996 |
+
score_trend = [
|
| 997 |
+
{'date': c.started_at.strftime('%Y-%m-%d'), 'score': r.overall_score}
|
| 998 |
+
for c, r in scored_convs if r and r.overall_score is not None
|
| 999 |
+
][-10:]
|
| 1000 |
+
|
| 1001 |
+
# Share link stats
|
| 1002 |
+
share_convs = sum(1 for c in convs if c.share_link_id is not None)
|
| 1003 |
+
|
| 1004 |
+
return jsonify({
|
| 1005 |
+
'analytics': {
|
| 1006 |
+
'total_conversations': len(convs),
|
| 1007 |
+
'completed_conversations': sum(1 for c in convs if c.status == 'completed'),
|
| 1008 |
+
'text_count': text_count,
|
| 1009 |
+
'video_count': video_count,
|
| 1010 |
+
'avg_score': avg_score,
|
| 1011 |
+
'score_trend': score_trend,
|
| 1012 |
+
'conversations_by_day': days_data,
|
| 1013 |
+
'share_conversations': share_convs
|
| 1014 |
+
}
|
| 1015 |
+
})
|
| 1016 |
+
|
| 1017 |
+
# ============================================================================
|
| 1018 |
+
# Notifications Route
|
| 1019 |
+
# ============================================================================
|
| 1020 |
+
|
| 1021 |
+
@app.route('/api/notifications', methods=['GET'])
|
| 1022 |
+
@login_required
|
| 1023 |
+
def get_notifications():
|
| 1024 |
+
"""Get in-app notifications: recent conversations started via share links"""
|
| 1025 |
+
user_id = session['user_id']
|
| 1026 |
+
user_agents = Agent.query.filter_by(user_id=user_id).all()
|
| 1027 |
+
agent_map = {a.id: a for a in user_agents}
|
| 1028 |
+
agent_ids = list(agent_map.keys())
|
| 1029 |
+
|
| 1030 |
+
if not agent_ids:
|
| 1031 |
+
return jsonify({'notifications': []})
|
| 1032 |
+
|
| 1033 |
+
# Get recent share-link conversations for user's agents (last 15)
|
| 1034 |
+
share_convs = Conversation.query.filter(
|
| 1035 |
+
Conversation.agent_id.in_(agent_ids),
|
| 1036 |
+
Conversation.share_link_id.isnot(None)
|
| 1037 |
+
).order_by(Conversation.started_at.desc()).limit(15).all()
|
| 1038 |
+
|
| 1039 |
+
notifications = []
|
| 1040 |
+
for c in share_convs:
|
| 1041 |
+
agent = agent_map.get(c.agent_id)
|
| 1042 |
+
participant = c.participant_name or 'Someone'
|
| 1043 |
+
notifications.append({
|
| 1044 |
+
'id': f'conv-{c.id}',
|
| 1045 |
+
'icon': agent.icon if agent else '🔔',
|
| 1046 |
+
'title': f'{participant} started a chat',
|
| 1047 |
+
'message': f'with {agent.name if agent else "your agent"} via share link',
|
| 1048 |
+
'timestamp': c.started_at.isoformat(),
|
| 1049 |
+
'link': f'/conversations/{c.id}'
|
| 1050 |
+
})
|
| 1051 |
+
|
| 1052 |
+
return jsonify({'notifications': notifications})
|
| 1053 |
+
|
| 1054 |
+
# ============================================================================
|
| 1055 |
+
# Speech-to-Text (Whisper) Endpoint
|
| 1056 |
+
# ============================================================================
|
| 1057 |
+
|
| 1058 |
+
@app.route('/api/stt', methods=['POST'])
|
| 1059 |
+
def speech_to_text():
|
| 1060 |
+
"""Transcribe audio to text using Google Speech Recognition (free, no ffmpeg needed)"""
|
| 1061 |
+
if 'audio' not in request.files:
|
| 1062 |
+
return jsonify({'error': 'No audio file provided'}), 400
|
| 1063 |
+
|
| 1064 |
+
audio_file = request.files['audio']
|
| 1065 |
+
if not audio_file.filename:
|
| 1066 |
+
return jsonify({'error': 'Empty audio file'}), 400
|
| 1067 |
+
|
| 1068 |
+
tmp_path = None
|
| 1069 |
+
wav_path = None
|
| 1070 |
+
try:
|
| 1071 |
+
# Save uploaded audio to a temp file
|
| 1072 |
+
suffix = '.webm' if 'webm' in (audio_file.content_type or '') else '.wav'
|
| 1073 |
+
with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as tmp:
|
| 1074 |
+
audio_file.save(tmp)
|
| 1075 |
+
tmp_path = tmp.name
|
| 1076 |
+
|
| 1077 |
+
# Convert to WAV using pydub (pure Python, no ffmpeg for WAV output)
|
| 1078 |
+
try:
|
| 1079 |
+
from pydub import AudioSegment
|
| 1080 |
+
audio_seg = AudioSegment.from_file(tmp_path)
|
| 1081 |
+
wav_path = tmp_path + '.wav'
|
| 1082 |
+
audio_seg.export(wav_path, format='wav')
|
| 1083 |
+
except Exception:
|
| 1084 |
+
# If pydub fails, try using the file directly as WAV
|
| 1085 |
+
wav_path = tmp_path
|
| 1086 |
+
|
| 1087 |
+
# Transcribe using Google's free Speech Recognition
|
| 1088 |
+
with sr.AudioFile(wav_path) as source:
|
| 1089 |
+
audio_data = _recognizer.record(source)
|
| 1090 |
+
|
| 1091 |
+
try:
|
| 1092 |
+
text = _recognizer.recognize_google(audio_data, language='en-US')
|
| 1093 |
+
except sr.UnknownValueError:
|
| 1094 |
+
text = '' # Couldn't understand audio
|
| 1095 |
+
except sr.RequestError as e:
|
| 1096 |
+
print(f"STT Google API error: {e}")
|
| 1097 |
+
text = ''
|
| 1098 |
+
|
| 1099 |
+
return jsonify({'text': text.strip()})
|
| 1100 |
+
|
| 1101 |
+
except Exception as e:
|
| 1102 |
+
print(f"STT Error: {e}")
|
| 1103 |
+
return jsonify({'text': ''}), 200 # Return empty text instead of 500 to prevent spam
|
| 1104 |
+
finally:
|
| 1105 |
+
# Clean up temp files
|
| 1106 |
+
for p in [tmp_path, wav_path]:
|
| 1107 |
+
if p:
|
| 1108 |
+
try:
|
| 1109 |
+
os.unlink(p)
|
| 1110 |
+
except Exception:
|
| 1111 |
+
pass
|
| 1112 |
+
|
| 1113 |
+
# ============================================================================
|
| 1114 |
+
# 3D Avatar TTS + Lip-Sync Endpoint
|
| 1115 |
+
# ============================================================================
|
| 1116 |
+
|
| 1117 |
+
# Ensure audio directory exists
|
| 1118 |
+
AVATAR_AUDIO_DIR = os.path.abspath(os.path.join(FRONTEND_DIR, '3d-assets', 'audio'))
|
| 1119 |
+
os.makedirs(AVATAR_AUDIO_DIR, exist_ok=True)
|
| 1120 |
+
|
| 1121 |
+
@app.route('/api/avatar/talk', methods=['POST'])
|
| 1122 |
+
def avatar_talk():
|
| 1123 |
+
"""Generate TTS audio for 3D avatar using Kokoro TTS (local neural TTS — singleton pipeline)"""
|
| 1124 |
+
data = request.json
|
| 1125 |
+
text = data.get('text', '').strip()
|
| 1126 |
+
|
| 1127 |
+
if not text:
|
| 1128 |
+
return jsonify({'error': 'Text is required'}), 400
|
| 1129 |
+
|
| 1130 |
+
try:
|
| 1131 |
+
import time as time_module
|
| 1132 |
+
import soundfile as sf
|
| 1133 |
+
import numpy as np
|
| 1134 |
+
|
| 1135 |
+
# Map edge-tts style voice names to Kokoro voices
|
| 1136 |
+
voice_map = {
|
| 1137 |
+
'en-US-AriaNeural': 'af_heart',
|
| 1138 |
+
'en-US-JennyNeural': 'af_bella',
|
| 1139 |
+
'en-US-MichelleNeural':'af_nicole',
|
| 1140 |
+
'en-US-GuyNeural': 'am_michael',
|
| 1141 |
+
'en-US-DavisNeural': 'am_adam',
|
| 1142 |
+
'en-GB-SoniaNeural': 'bf_emma',
|
| 1143 |
+
'en-GB-RyanNeural': 'bm_george',
|
| 1144 |
+
}
|
| 1145 |
+
requested_voice = data.get('voice', 'en-US-AriaNeural')
|
| 1146 |
+
kokoro_voice = voice_map.get(requested_voice, 'af_heart')
|
| 1147 |
+
|
| 1148 |
+
# Determine language code from voice name
|
| 1149 |
+
lang_code = 'b' if 'GB' in requested_voice else 'a'
|
| 1150 |
+
|
| 1151 |
+
# Use the global singleton pipeline (loads once, reused every call)
|
| 1152 |
+
pipeline = _get_kokoro_pipeline(lang_code)
|
| 1153 |
+
if pipeline is None:
|
| 1154 |
+
return jsonify({'error': 'Kokoro TTS not available — check server logs'}), 500
|
| 1155 |
+
|
| 1156 |
+
audio_chunks = []
|
| 1157 |
+
sample_rate = 24000 # Kokoro default
|
| 1158 |
+
|
| 1159 |
+
for _, _, audio in pipeline(text, voice=kokoro_voice):
|
| 1160 |
+
audio_chunks.append(audio)
|
| 1161 |
+
|
| 1162 |
+
if not audio_chunks:
|
| 1163 |
+
raise RuntimeError('Kokoro TTS produced no audio output')
|
| 1164 |
+
|
| 1165 |
+
combined_audio = np.concatenate(audio_chunks)
|
| 1166 |
+
|
| 1167 |
+
# Save as WAV (natively supported by browsers)
|
| 1168 |
+
filename = f"audio-{int(time_module.time() * 1000)}.wav"
|
| 1169 |
+
filepath = os.path.join(AVATAR_AUDIO_DIR, filename)
|
| 1170 |
+
sf.write(filepath, combined_audio, sample_rate)
|
| 1171 |
+
|
| 1172 |
+
# Clean up old audio files (keep last 20)
|
| 1173 |
+
try:
|
| 1174 |
+
audio_files = sorted(
|
| 1175 |
+
[f for f in os.listdir(AVATAR_AUDIO_DIR) if f.endswith('.wav') or f.endswith('.mp3')],
|
| 1176 |
+
key=lambda x: os.path.getmtime(os.path.join(AVATAR_AUDIO_DIR, x))
|
| 1177 |
+
)
|
| 1178 |
+
for old_file in audio_files[:-20]:
|
| 1179 |
+
try:
|
| 1180 |
+
os.remove(os.path.join(AVATAR_AUDIO_DIR, old_file))
|
| 1181 |
+
except Exception:
|
| 1182 |
+
pass
|
| 1183 |
+
except Exception:
|
| 1184 |
+
pass
|
| 1185 |
+
|
| 1186 |
+
return jsonify({
|
| 1187 |
+
'audioUrl': f'/3d-assets/audio/{filename}'
|
| 1188 |
+
})
|
| 1189 |
+
|
| 1190 |
+
except Exception as e:
|
| 1191 |
+
print(f"Avatar TTS Error: {type(e).__name__}: {e}")
|
| 1192 |
+
return jsonify({'error': f'TTS generation failed: {str(e)}'}), 500
|
| 1193 |
+
|
| 1194 |
+
|
| 1195 |
+
# ============================================================================
|
| 1196 |
+
# Default Anchoring Agent Helper
|
| 1197 |
+
# ============================================================================
|
| 1198 |
+
|
| 1199 |
+
def _create_default_anchoring_agent(user_id):
|
| 1200 |
+
"""Create the default Event Anchoring agent for a user"""
|
| 1201 |
+
existing = Agent.query.filter_by(user_id=user_id, is_default=True, agent_type='anchoring').first()
|
| 1202 |
+
if existing:
|
| 1203 |
+
return existing
|
| 1204 |
+
|
| 1205 |
+
agent = Agent(
|
| 1206 |
+
user_id=user_id,
|
| 1207 |
+
name='Event Anchor',
|
| 1208 |
+
role='Event Anchoring Host',
|
| 1209 |
+
goal='Host and guide events smoothly through scripted delivery, keeping the audience engaged with dynamic stage presence.',
|
| 1210 |
+
opening_message='Welcome everyone! Let\'s get this event started!',
|
| 1211 |
+
task_description='Perform event anchoring based on the provided script. Read each line with energy, proper pacing, and dynamic delivery. This is a one-direction scripted presentation with no conversation.',
|
| 1212 |
+
rules=json.dumps([
|
| 1213 |
+
'Follow the script exactly as provided',
|
| 1214 |
+
'Maintain energetic and engaging delivery',
|
| 1215 |
+
'Do not engage in conversation - this is one-way anchoring',
|
| 1216 |
+
'Pause between script sections for natural flow',
|
| 1217 |
+
'Use proper tone and emphasis as indicated in the script'
|
| 1218 |
+
]),
|
| 1219 |
+
tone='energetic',
|
| 1220 |
+
knowledge='Expert event anchor with experience in hosting corporate events, conferences, ceremonies, and live shows.',
|
| 1221 |
+
output_config=json.dumps({'summary': True, 'transcript': True}),
|
| 1222 |
+
icon='🎤',
|
| 1223 |
+
color='#f59e0b',
|
| 1224 |
+
status='active',
|
| 1225 |
+
agent_type='anchoring',
|
| 1226 |
+
is_default=True,
|
| 1227 |
+
script_content='Welcome everyone to this wonderful event!\nWe are thrilled to have you all here today.\nLet\'s begin with our first segment.\nPlease welcome our first speaker to the stage!\nThank you all for being here. Let\'s make this event memorable!'
|
| 1228 |
+
)
|
| 1229 |
+
|
| 1230 |
+
db.session.add(agent)
|
| 1231 |
+
db.session.commit()
|
| 1232 |
+
return agent
|
| 1233 |
+
|
| 1234 |
+
# ============================================================================
|
| 1235 |
+
# Anchoring Control Routes
|
| 1236 |
+
# ============================================================================
|
| 1237 |
+
|
| 1238 |
+
@app.route('/api/agents/<int:agent_id>/anchoring/state', methods=['GET'])
|
| 1239 |
+
def get_anchoring_state(agent_id):
|
| 1240 |
+
"""Get the current anchoring state for an agent"""
|
| 1241 |
+
agent = db.session.get(Agent, agent_id)
|
| 1242 |
+
if not agent or agent.agent_type != 'anchoring':
|
| 1243 |
+
return jsonify({'error': 'Anchoring agent not found'}), 404
|
| 1244 |
+
|
| 1245 |
+
# Parse script lines
|
| 1246 |
+
script_lines = (agent.script_content or '').split('\n')
|
| 1247 |
+
script_lines = [l.strip() for l in script_lines if l.strip()]
|
| 1248 |
+
|
| 1249 |
+
state = anchoring_states.get(agent_id, {
|
| 1250 |
+
'status': 'stopped',
|
| 1251 |
+
'current_line': 0,
|
| 1252 |
+
'script_lines': script_lines
|
| 1253 |
+
})
|
| 1254 |
+
|
| 1255 |
+
# Always update script lines from DB
|
| 1256 |
+
state['script_lines'] = script_lines
|
| 1257 |
+
state['total_lines'] = len(script_lines)
|
| 1258 |
+
state['agent_name'] = agent.name
|
| 1259 |
+
state['agent_icon'] = agent.icon
|
| 1260 |
+
|
| 1261 |
+
return jsonify({'state': state})
|
| 1262 |
+
|
| 1263 |
+
@app.route('/api/agents/<int:agent_id>/anchoring/control', methods=['POST'])
|
| 1264 |
+
def control_anchoring(agent_id):
|
| 1265 |
+
"""Control the anchoring agent: play, pause, stop, restart, next"""
|
| 1266 |
+
agent = db.session.get(Agent, agent_id)
|
| 1267 |
+
if not agent or agent.agent_type != 'anchoring':
|
| 1268 |
+
return jsonify({'error': 'Anchoring agent not found'}), 404
|
| 1269 |
+
|
| 1270 |
+
data = request.json
|
| 1271 |
+
action = data.get('action')
|
| 1272 |
+
|
| 1273 |
+
script_lines = (agent.script_content or '').split('\n')
|
| 1274 |
+
script_lines = [l.strip() for l in script_lines if l.strip()]
|
| 1275 |
+
|
| 1276 |
+
if agent_id not in anchoring_states:
|
| 1277 |
+
anchoring_states[agent_id] = {
|
| 1278 |
+
'status': 'stopped',
|
| 1279 |
+
'current_line': 0,
|
| 1280 |
+
'script_lines': script_lines
|
| 1281 |
+
}
|
| 1282 |
+
|
| 1283 |
+
state = anchoring_states[agent_id]
|
| 1284 |
+
state['script_lines'] = script_lines
|
| 1285 |
+
|
| 1286 |
+
if action == 'play':
|
| 1287 |
+
state['status'] = 'playing'
|
| 1288 |
+
elif action == 'pause':
|
| 1289 |
+
state['status'] = 'paused'
|
| 1290 |
+
elif action == 'stop':
|
| 1291 |
+
state['status'] = 'stopped'
|
| 1292 |
+
state['current_line'] = 0
|
| 1293 |
+
elif action == 'restart':
|
| 1294 |
+
state['status'] = 'playing'
|
| 1295 |
+
state['current_line'] = 0
|
| 1296 |
+
elif action == 'next':
|
| 1297 |
+
if state['current_line'] < len(script_lines) - 1:
|
| 1298 |
+
state['current_line'] += 1
|
| 1299 |
+
else:
|
| 1300 |
+
state['status'] = 'stopped'
|
| 1301 |
+
state['current_line'] = 0
|
| 1302 |
+
elif action == 'set_line':
|
| 1303 |
+
line_num = data.get('line', 0)
|
| 1304 |
+
state['current_line'] = max(0, min(line_num, len(script_lines) - 1))
|
| 1305 |
+
else:
|
| 1306 |
+
return jsonify({'error': 'Invalid action. Use: play, pause, stop, restart, next, set_line'}), 400
|
| 1307 |
+
|
| 1308 |
+
state['total_lines'] = len(script_lines)
|
| 1309 |
+
anchoring_states[agent_id] = state
|
| 1310 |
+
|
| 1311 |
+
return jsonify({
|
| 1312 |
+
'message': f'Anchoring {action} successful',
|
| 1313 |
+
'state': state
|
| 1314 |
+
})
|
| 1315 |
+
|
| 1316 |
+
@app.route('/api/agents/<int:agent_id>/anchoring/script', methods=['POST'])
|
| 1317 |
+
def save_anchoring_script(agent_id):
|
| 1318 |
+
"""Save/update the anchoring script"""
|
| 1319 |
+
agent = db.session.get(Agent, agent_id)
|
| 1320 |
+
if not agent or agent.agent_type != 'anchoring':
|
| 1321 |
+
return jsonify({'error': 'Anchoring agent not found'}), 404
|
| 1322 |
+
|
| 1323 |
+
data = request.json
|
| 1324 |
+
script = data.get('script', '')
|
| 1325 |
+
|
| 1326 |
+
agent.script_content = script
|
| 1327 |
+
db.session.commit()
|
| 1328 |
+
|
| 1329 |
+
# Reset anchoring state when script changes
|
| 1330 |
+
if agent_id in anchoring_states:
|
| 1331 |
+
anchoring_states[agent_id]['current_line'] = 0
|
| 1332 |
+
anchoring_states[agent_id]['status'] = 'stopped'
|
| 1333 |
+
anchoring_states[agent_id]['script_lines'] = [l.strip() for l in script.split('\n') if l.strip()]
|
| 1334 |
+
|
| 1335 |
+
return jsonify({
|
| 1336 |
+
'message': 'Script saved successfully',
|
| 1337 |
+
'agent': agent.to_dict()
|
| 1338 |
+
})
|
| 1339 |
+
|
| 1340 |
+
# ============================================================================
|
| 1341 |
+
# Run Application
|
| 1342 |
+
# ============================================================================
|
| 1343 |
+
|
| 1344 |
+
if __name__ == '__main__':
|
| 1345 |
+
# use_reloader=False prevents Flask's watchdog from re-importing
|
| 1346 |
+
# TensorFlow/Kokoro in a subprocess, which causes native DLL crashes on Windows.
|
| 1347 |
+
app.run(debug=True, port=5000, use_reloader=False)
|
backend/config.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
PersonaFlow Configuration
|
| 3 |
+
"""
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
class Config:
|
| 7 |
+
# Flask
|
| 8 |
+
SECRET_KEY = os.environ.get('SECRET_KEY', 'personaflow-secret-key-change-in-production')
|
| 9 |
+
|
| 10 |
+
# Database
|
| 11 |
+
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL', 'sqlite:///personaflow.db')
|
| 12 |
+
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
| 13 |
+
|
| 14 |
+
# API LLM Settings (Gemini format)
|
| 15 |
+
GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY', '')
|
| 16 |
+
GEMINI_MODEL = os.environ.get('GEMINI_MODEL', 'gemini-2.5-flash')
|
| 17 |
+
|
| 18 |
+
# Session - Fixed for proper cookie handling
|
| 19 |
+
SESSION_TYPE = 'filesystem'
|
| 20 |
+
SESSION_COOKIE_SAMESITE = 'Lax'
|
| 21 |
+
SESSION_COOKIE_SECURE = False # Set to True in production with HTTPS
|
| 22 |
+
SESSION_COOKIE_HTTPONLY = True
|
| 23 |
+
PERMANENT_SESSION_LIFETIME = 86400 # 24 hours
|
| 24 |
+
|
backend/migrate_anchoring.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Quick migration to add anchoring columns to agents table"""
|
| 2 |
+
import sqlite3
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
db_path = os.path.join(os.path.dirname(__file__), 'instance', 'personaflow.db')
|
| 6 |
+
print(f"DB path: {db_path}")
|
| 7 |
+
|
| 8 |
+
conn = sqlite3.connect(db_path)
|
| 9 |
+
cursor = conn.cursor()
|
| 10 |
+
|
| 11 |
+
# Get existing columns
|
| 12 |
+
cursor.execute('PRAGMA table_info(agents)')
|
| 13 |
+
columns = [col[1] for col in cursor.fetchall()]
|
| 14 |
+
print(f"Existing columns: {columns}")
|
| 15 |
+
|
| 16 |
+
# Add missing columns
|
| 17 |
+
migrations = [
|
| 18 |
+
('agent_type', 'ALTER TABLE agents ADD COLUMN agent_type VARCHAR(20) DEFAULT "conversation"'),
|
| 19 |
+
('is_default', 'ALTER TABLE agents ADD COLUMN is_default BOOLEAN DEFAULT 0'),
|
| 20 |
+
('script_content', 'ALTER TABLE agents ADD COLUMN script_content TEXT'),
|
| 21 |
+
]
|
| 22 |
+
|
| 23 |
+
for col_name, sql in migrations:
|
| 24 |
+
if col_name not in columns:
|
| 25 |
+
print(f"Adding column: {col_name}")
|
| 26 |
+
cursor.execute(sql)
|
| 27 |
+
else:
|
| 28 |
+
print(f"Column already exists: {col_name}")
|
| 29 |
+
|
| 30 |
+
conn.commit()
|
| 31 |
+
conn.close()
|
| 32 |
+
print("Migration complete!")
|
backend/models.py
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
PersonaFlow Database Models
|
| 3 |
+
"""
|
| 4 |
+
from flask_sqlalchemy import SQLAlchemy
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
import json
|
| 7 |
+
|
| 8 |
+
db = SQLAlchemy()
|
| 9 |
+
|
| 10 |
+
class User(db.Model):
|
| 11 |
+
__tablename__ = 'users'
|
| 12 |
+
|
| 13 |
+
id = db.Column(db.Integer, primary_key=True)
|
| 14 |
+
name = db.Column(db.String(100), nullable=False)
|
| 15 |
+
email = db.Column(db.String(120), unique=True, nullable=False)
|
| 16 |
+
password_hash = db.Column(db.String(256), nullable=False)
|
| 17 |
+
avatar_color = db.Column(db.String(7), default='#6366f1')
|
| 18 |
+
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
| 19 |
+
|
| 20 |
+
# Relationships
|
| 21 |
+
agents = db.relationship('Agent', backref='owner', lazy=True, cascade='all, delete-orphan')
|
| 22 |
+
|
| 23 |
+
def to_dict(self):
|
| 24 |
+
return {
|
| 25 |
+
'id': self.id,
|
| 26 |
+
'name': self.name,
|
| 27 |
+
'email': self.email,
|
| 28 |
+
'avatar_color': self.avatar_color,
|
| 29 |
+
'created_at': self.created_at.isoformat()
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
class Agent(db.Model):
|
| 33 |
+
__tablename__ = 'agents'
|
| 34 |
+
|
| 35 |
+
id = db.Column(db.Integer, primary_key=True)
|
| 36 |
+
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=False)
|
| 37 |
+
|
| 38 |
+
# Identity (Step 1)
|
| 39 |
+
name = db.Column(db.String(100), nullable=False)
|
| 40 |
+
role = db.Column(db.String(100), nullable=False)
|
| 41 |
+
goal = db.Column(db.Text)
|
| 42 |
+
opening_message = db.Column(db.Text)
|
| 43 |
+
|
| 44 |
+
# Behavior (Step 2)
|
| 45 |
+
task_description = db.Column(db.Text)
|
| 46 |
+
rules = db.Column(db.Text) # JSON array of rules
|
| 47 |
+
tone = db.Column(db.String(50), default='professional')
|
| 48 |
+
knowledge = db.Column(db.Text)
|
| 49 |
+
|
| 50 |
+
# Output (Step 3)
|
| 51 |
+
output_config = db.Column(db.Text) # JSON: {summary, transcript, report, evaluation, criteria}
|
| 52 |
+
|
| 53 |
+
# Customize (Step 4)
|
| 54 |
+
icon = db.Column(db.String(10), default='🤖')
|
| 55 |
+
color = db.Column(db.String(7), default='#6366f1')
|
| 56 |
+
status = db.Column(db.String(20), default='active')
|
| 57 |
+
|
| 58 |
+
# Agent Type & System Fields
|
| 59 |
+
agent_type = db.Column(db.String(20), default='conversation') # 'conversation' or 'anchoring'
|
| 60 |
+
is_default = db.Column(db.Boolean, default=False) # True for system-created default agents
|
| 61 |
+
script_content = db.Column(db.Text) # Anchoring script text (line-by-line)
|
| 62 |
+
|
| 63 |
+
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
| 64 |
+
updated_at = db.Column(db.DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
| 65 |
+
|
| 66 |
+
# Relationships
|
| 67 |
+
conversations = db.relationship('Conversation', backref='agent', lazy=True, cascade='all, delete-orphan')
|
| 68 |
+
share_links = db.relationship('ShareLink', backref='agent', lazy=True, cascade='all, delete-orphan')
|
| 69 |
+
|
| 70 |
+
def to_dict(self):
|
| 71 |
+
return {
|
| 72 |
+
'id': self.id,
|
| 73 |
+
'user_id': self.user_id,
|
| 74 |
+
'name': self.name,
|
| 75 |
+
'role': self.role,
|
| 76 |
+
'goal': self.goal,
|
| 77 |
+
'opening_message': self.opening_message,
|
| 78 |
+
'task_description': self.task_description,
|
| 79 |
+
'rules': json.loads(self.rules) if self.rules else [],
|
| 80 |
+
'tone': self.tone,
|
| 81 |
+
'knowledge': self.knowledge,
|
| 82 |
+
'output_config': json.loads(self.output_config) if self.output_config else {},
|
| 83 |
+
'icon': self.icon,
|
| 84 |
+
'color': self.color,
|
| 85 |
+
'status': self.status,
|
| 86 |
+
'agent_type': self.agent_type or 'conversation',
|
| 87 |
+
'is_default': self.is_default or False,
|
| 88 |
+
'script_content': self.script_content,
|
| 89 |
+
'created_at': self.created_at.isoformat(),
|
| 90 |
+
'updated_at': self.updated_at.isoformat(),
|
| 91 |
+
'conversation_count': len(self.conversations),
|
| 92 |
+
'share_link_count': len(self.share_links)
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
class Conversation(db.Model):
|
| 96 |
+
__tablename__ = 'conversations'
|
| 97 |
+
|
| 98 |
+
id = db.Column(db.Integer, primary_key=True)
|
| 99 |
+
agent_id = db.Column(db.Integer, db.ForeignKey('agents.id'), nullable=False)
|
| 100 |
+
user_id = db.Column(db.Integer, db.ForeignKey('users.id'), nullable=True) # Null for public access
|
| 101 |
+
share_link_id = db.Column(db.Integer, db.ForeignKey('share_links.id'), nullable=True)
|
| 102 |
+
|
| 103 |
+
participant_name = db.Column(db.String(100))
|
| 104 |
+
participant_email = db.Column(db.String(120))
|
| 105 |
+
mode = db.Column(db.String(20), default='text') # 'text' or 'video'
|
| 106 |
+
status = db.Column(db.String(20), default='active') # 'active' or 'completed'
|
| 107 |
+
|
| 108 |
+
started_at = db.Column(db.DateTime, default=datetime.utcnow)
|
| 109 |
+
ended_at = db.Column(db.DateTime)
|
| 110 |
+
|
| 111 |
+
# Relationships
|
| 112 |
+
messages = db.relationship('Message', backref='conversation', lazy=True, cascade='all, delete-orphan', order_by='Message.timestamp')
|
| 113 |
+
report = db.relationship('Report', backref='conversation', uselist=False, cascade='all, delete-orphan')
|
| 114 |
+
|
| 115 |
+
def to_dict(self):
|
| 116 |
+
return {
|
| 117 |
+
'id': self.id,
|
| 118 |
+
'agent_id': self.agent_id,
|
| 119 |
+
'agent_name': self.agent.name if self.agent else None,
|
| 120 |
+
'agent_icon': self.agent.icon if self.agent else None,
|
| 121 |
+
'agent_color': self.agent.color if self.agent else None,
|
| 122 |
+
'participant_name': self.participant_name,
|
| 123 |
+
'participant_email': self.participant_email,
|
| 124 |
+
'mode': self.mode,
|
| 125 |
+
'status': self.status,
|
| 126 |
+
'started_at': self.started_at.isoformat(),
|
| 127 |
+
'ended_at': self.ended_at.isoformat() if self.ended_at else None,
|
| 128 |
+
'message_count': len(self.messages),
|
| 129 |
+
'has_report': self.report is not None
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
class Message(db.Model):
|
| 133 |
+
__tablename__ = 'messages'
|
| 134 |
+
|
| 135 |
+
id = db.Column(db.Integer, primary_key=True)
|
| 136 |
+
conversation_id = db.Column(db.Integer, db.ForeignKey('conversations.id'), nullable=False)
|
| 137 |
+
role = db.Column(db.String(20), nullable=False) # 'user' or 'agent'
|
| 138 |
+
content = db.Column(db.Text, nullable=False)
|
| 139 |
+
timestamp = db.Column(db.DateTime, default=datetime.utcnow)
|
| 140 |
+
|
| 141 |
+
def to_dict(self):
|
| 142 |
+
return {
|
| 143 |
+
'id': self.id,
|
| 144 |
+
'role': self.role,
|
| 145 |
+
'content': self.content,
|
| 146 |
+
'timestamp': self.timestamp.isoformat()
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
class ShareLink(db.Model):
|
| 150 |
+
__tablename__ = 'share_links'
|
| 151 |
+
|
| 152 |
+
id = db.Column(db.Integer, primary_key=True)
|
| 153 |
+
agent_id = db.Column(db.Integer, db.ForeignKey('agents.id'), nullable=False)
|
| 154 |
+
|
| 155 |
+
token = db.Column(db.String(64), unique=True, nullable=False)
|
| 156 |
+
name = db.Column(db.String(100)) # Optional label for the link
|
| 157 |
+
password_hash = db.Column(db.String(256))
|
| 158 |
+
expires_at = db.Column(db.DateTime)
|
| 159 |
+
max_uses = db.Column(db.Integer)
|
| 160 |
+
current_uses = db.Column(db.Integer, default=0)
|
| 161 |
+
require_name = db.Column(db.Boolean, default=True)
|
| 162 |
+
require_email = db.Column(db.Boolean, default=False)
|
| 163 |
+
|
| 164 |
+
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
| 165 |
+
|
| 166 |
+
# Relationships
|
| 167 |
+
conversations = db.relationship('Conversation', backref='share_link', lazy=True)
|
| 168 |
+
|
| 169 |
+
def to_dict(self):
|
| 170 |
+
return {
|
| 171 |
+
'id': self.id,
|
| 172 |
+
'agent_id': self.agent_id,
|
| 173 |
+
'agent_name': self.agent.name if self.agent else None,
|
| 174 |
+
'token': self.token,
|
| 175 |
+
'name': self.name or '',
|
| 176 |
+
'has_password': self.password_hash is not None,
|
| 177 |
+
'expires_at': self.expires_at.isoformat() if self.expires_at else None,
|
| 178 |
+
'max_uses': self.max_uses,
|
| 179 |
+
'current_uses': self.current_uses,
|
| 180 |
+
'require_name': self.require_name,
|
| 181 |
+
'require_email': self.require_email,
|
| 182 |
+
'created_at': self.created_at.isoformat(),
|
| 183 |
+
'is_expired': self.expires_at and datetime.utcnow() > self.expires_at,
|
| 184 |
+
'is_maxed': self.max_uses and self.current_uses >= self.max_uses
|
| 185 |
+
}
|
| 186 |
+
|
| 187 |
+
class Report(db.Model):
|
| 188 |
+
__tablename__ = 'reports'
|
| 189 |
+
|
| 190 |
+
id = db.Column(db.Integer, primary_key=True)
|
| 191 |
+
conversation_id = db.Column(db.Integer, db.ForeignKey('conversations.id'), nullable=False)
|
| 192 |
+
|
| 193 |
+
overall_score = db.Column(db.Float)
|
| 194 |
+
criteria_scores = db.Column(db.Text) # JSON: {criteria_name: score}
|
| 195 |
+
summary = db.Column(db.Text)
|
| 196 |
+
feedback = db.Column(db.Text)
|
| 197 |
+
recommendations = db.Column(db.Text)
|
| 198 |
+
transcript = db.Column(db.Text) # JSON array of messages
|
| 199 |
+
|
| 200 |
+
created_at = db.Column(db.DateTime, default=datetime.utcnow)
|
| 201 |
+
|
| 202 |
+
def to_dict(self):
|
| 203 |
+
return {
|
| 204 |
+
'id': self.id,
|
| 205 |
+
'conversation_id': self.conversation_id,
|
| 206 |
+
'overall_score': self.overall_score,
|
| 207 |
+
'criteria_scores': json.loads(self.criteria_scores) if self.criteria_scores else {},
|
| 208 |
+
'summary': self.summary,
|
| 209 |
+
'feedback': self.feedback,
|
| 210 |
+
'recommendations': self.recommendations,
|
| 211 |
+
'transcript': json.loads(self.transcript) if self.transcript else [],
|
| 212 |
+
'created_at': self.created_at.isoformat()
|
| 213 |
+
}
|
backend/scoring_service.py
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
PersonaFlow Scoring Service
|
| 3 |
+
Uses spaCy for response evaluation and scoring
|
| 4 |
+
"""
|
| 5 |
+
import json
|
| 6 |
+
|
| 7 |
+
try:
|
| 8 |
+
import spacy
|
| 9 |
+
nlp = spacy.load("en_core_web_sm")
|
| 10 |
+
except:
|
| 11 |
+
nlp = None
|
| 12 |
+
print("Warning: spaCy model not loaded. Scoring will use basic metrics.")
|
| 13 |
+
|
| 14 |
+
class ScoringService:
|
| 15 |
+
def __init__(self):
|
| 16 |
+
self.nlp = nlp
|
| 17 |
+
|
| 18 |
+
def evaluate_conversation(self, agent, messages):
|
| 19 |
+
"""
|
| 20 |
+
Evaluate conversation based on agent's criteria
|
| 21 |
+
Returns overall score and per-criteria scores
|
| 22 |
+
"""
|
| 23 |
+
output_config = json.loads(agent.output_config) if agent.output_config else {}
|
| 24 |
+
criteria = output_config.get('criteria', [])
|
| 25 |
+
|
| 26 |
+
if not criteria:
|
| 27 |
+
# Default evaluation if no criteria defined
|
| 28 |
+
return self._default_evaluation(messages)
|
| 29 |
+
|
| 30 |
+
user_messages = [m for m in messages if m.role == 'user']
|
| 31 |
+
agent_messages = [m for m in messages if m.role == 'agent']
|
| 32 |
+
|
| 33 |
+
criteria_scores = {}
|
| 34 |
+
total_weight = 0
|
| 35 |
+
weighted_sum = 0
|
| 36 |
+
|
| 37 |
+
for criterion in criteria:
|
| 38 |
+
name = criterion.get('name', 'Unknown')
|
| 39 |
+
weight = criterion.get('weight', 1)
|
| 40 |
+
score = self._evaluate_criterion(criterion, user_messages, agent_messages)
|
| 41 |
+
|
| 42 |
+
criteria_scores[name] = score
|
| 43 |
+
weighted_sum += score * weight
|
| 44 |
+
total_weight += weight
|
| 45 |
+
|
| 46 |
+
overall_score = weighted_sum / total_weight if total_weight > 0 else 0
|
| 47 |
+
|
| 48 |
+
return {
|
| 49 |
+
'overall_score': round(overall_score, 1),
|
| 50 |
+
'criteria_scores': criteria_scores
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
def _evaluate_criterion(self, criterion, user_messages, agent_messages):
|
| 54 |
+
"""Evaluate a single criterion"""
|
| 55 |
+
name = criterion.get('name', '').lower()
|
| 56 |
+
|
| 57 |
+
# Use different evaluation methods based on criterion type
|
| 58 |
+
if 'communication' in name or 'clarity' in name:
|
| 59 |
+
return self._evaluate_communication(user_messages)
|
| 60 |
+
elif 'engagement' in name or 'participation' in name:
|
| 61 |
+
return self._evaluate_engagement(user_messages)
|
| 62 |
+
elif 'knowledge' in name or 'technical' in name:
|
| 63 |
+
return self._evaluate_knowledge(user_messages)
|
| 64 |
+
elif 'response' in name or 'quality' in name:
|
| 65 |
+
return self._evaluate_response_quality(user_messages)
|
| 66 |
+
else:
|
| 67 |
+
return self._evaluate_general(user_messages)
|
| 68 |
+
|
| 69 |
+
def _evaluate_communication(self, messages):
|
| 70 |
+
"""Evaluate communication quality"""
|
| 71 |
+
if not messages:
|
| 72 |
+
return 50
|
| 73 |
+
|
| 74 |
+
scores = []
|
| 75 |
+
for msg in messages:
|
| 76 |
+
content = msg.content
|
| 77 |
+
|
| 78 |
+
# Base score
|
| 79 |
+
score = 60
|
| 80 |
+
|
| 81 |
+
# Length bonus (not too short, not too long)
|
| 82 |
+
word_count = len(content.split())
|
| 83 |
+
if 10 <= word_count <= 200:
|
| 84 |
+
score += 15
|
| 85 |
+
elif 5 <= word_count < 10 or 200 < word_count <= 300:
|
| 86 |
+
score += 8
|
| 87 |
+
|
| 88 |
+
# Sentence structure using spaCy if available
|
| 89 |
+
if self.nlp:
|
| 90 |
+
doc = self.nlp(content)
|
| 91 |
+
sentences = list(doc.sents)
|
| 92 |
+
if len(sentences) >= 2:
|
| 93 |
+
score += 10
|
| 94 |
+
|
| 95 |
+
# Check for proper nouns, named entities (shows specificity)
|
| 96 |
+
if len(doc.ents) > 0:
|
| 97 |
+
score += 5
|
| 98 |
+
|
| 99 |
+
# Punctuation check
|
| 100 |
+
if content.strip().endswith(('.', '?', '!')):
|
| 101 |
+
score += 5
|
| 102 |
+
|
| 103 |
+
# Cap at 100
|
| 104 |
+
scores.append(min(score, 100))
|
| 105 |
+
|
| 106 |
+
return sum(scores) / len(scores) if scores else 50
|
| 107 |
+
|
| 108 |
+
def _evaluate_engagement(self, messages):
|
| 109 |
+
"""Evaluate user engagement level"""
|
| 110 |
+
if not messages:
|
| 111 |
+
return 50
|
| 112 |
+
|
| 113 |
+
# More messages = more engagement
|
| 114 |
+
message_count = len(messages)
|
| 115 |
+
base_score = min(40 + (message_count * 5), 75)
|
| 116 |
+
|
| 117 |
+
# Average message length shows effort
|
| 118 |
+
avg_length = sum(len(m.content.split()) for m in messages) / len(messages)
|
| 119 |
+
if avg_length > 15:
|
| 120 |
+
base_score += 15
|
| 121 |
+
elif avg_length > 8:
|
| 122 |
+
base_score += 8
|
| 123 |
+
|
| 124 |
+
# Questions show curiosity
|
| 125 |
+
question_count = sum(1 for m in messages if '?' in m.content)
|
| 126 |
+
base_score += min(question_count * 3, 10)
|
| 127 |
+
|
| 128 |
+
return min(base_score, 100)
|
| 129 |
+
|
| 130 |
+
def _evaluate_knowledge(self, messages):
|
| 131 |
+
"""Evaluate demonstrated knowledge"""
|
| 132 |
+
if not messages:
|
| 133 |
+
return 50
|
| 134 |
+
|
| 135 |
+
score = 55
|
| 136 |
+
|
| 137 |
+
for msg in messages:
|
| 138 |
+
content = msg.content.lower()
|
| 139 |
+
|
| 140 |
+
# Length indicates depth
|
| 141 |
+
word_count = len(content.split())
|
| 142 |
+
if word_count > 30:
|
| 143 |
+
score += 3
|
| 144 |
+
|
| 145 |
+
# Technical terms or jargon (simplified check)
|
| 146 |
+
if self.nlp:
|
| 147 |
+
doc = self.nlp(msg.content)
|
| 148 |
+
# Named entities often indicate specific knowledge
|
| 149 |
+
score += min(len(doc.ents) * 2, 10)
|
| 150 |
+
|
| 151 |
+
return min(score, 100)
|
| 152 |
+
|
| 153 |
+
def _evaluate_response_quality(self, messages):
|
| 154 |
+
"""Evaluate overall response quality"""
|
| 155 |
+
if not messages:
|
| 156 |
+
return 50
|
| 157 |
+
|
| 158 |
+
scores = []
|
| 159 |
+
for msg in messages:
|
| 160 |
+
content = msg.content
|
| 161 |
+
score = 55
|
| 162 |
+
|
| 163 |
+
# Completeness
|
| 164 |
+
word_count = len(content.split())
|
| 165 |
+
if word_count >= 15:
|
| 166 |
+
score += 15
|
| 167 |
+
elif word_count >= 8:
|
| 168 |
+
score += 8
|
| 169 |
+
|
| 170 |
+
# Coherence (simplified)
|
| 171 |
+
if self.nlp:
|
| 172 |
+
doc = self.nlp(content)
|
| 173 |
+
sentences = list(doc.sents)
|
| 174 |
+
if len(sentences) >= 1:
|
| 175 |
+
score += 10
|
| 176 |
+
|
| 177 |
+
# Has verbs (complete thoughts)
|
| 178 |
+
verbs = [token for token in doc if token.pos_ == 'VERB']
|
| 179 |
+
if verbs:
|
| 180 |
+
score += 10
|
| 181 |
+
|
| 182 |
+
scores.append(min(score, 100))
|
| 183 |
+
|
| 184 |
+
return sum(scores) / len(scores) if scores else 50
|
| 185 |
+
|
| 186 |
+
def _evaluate_general(self, messages):
|
| 187 |
+
"""General evaluation for undefined criteria"""
|
| 188 |
+
if not messages:
|
| 189 |
+
return 50
|
| 190 |
+
|
| 191 |
+
# Combine multiple factors
|
| 192 |
+
comm_score = self._evaluate_communication(messages)
|
| 193 |
+
engage_score = self._evaluate_engagement(messages)
|
| 194 |
+
|
| 195 |
+
return (comm_score + engage_score) / 2
|
| 196 |
+
|
| 197 |
+
def _default_evaluation(self, messages):
|
| 198 |
+
"""Default evaluation when no criteria defined"""
|
| 199 |
+
user_messages = [m for m in messages if m.role == 'user']
|
| 200 |
+
|
| 201 |
+
if not user_messages:
|
| 202 |
+
return {
|
| 203 |
+
'overall_score': 50,
|
| 204 |
+
'criteria_scores': {
|
| 205 |
+
'Participation': 50,
|
| 206 |
+
'Communication': 50
|
| 207 |
+
}
|
| 208 |
+
}
|
| 209 |
+
|
| 210 |
+
return {
|
| 211 |
+
'overall_score': round(self._evaluate_general(user_messages), 1),
|
| 212 |
+
'criteria_scores': {
|
| 213 |
+
'Participation': round(self._evaluate_engagement(user_messages), 1),
|
| 214 |
+
'Communication': round(self._evaluate_communication(user_messages), 1)
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
|
| 218 |
+
# Global instance
|
| 219 |
+
scoring_service = ScoringService()
|
backend/test_anchoring.py
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Quick test script for anchoring agent endpoints"""
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
BASE = "http://localhost:5000"
|
| 5 |
+
session = requests.Session()
|
| 6 |
+
|
| 7 |
+
# Login - try known accounts
|
| 8 |
+
for creds in [
|
| 9 |
+
{"email": "demo@test.com", "password": "demo123"},
|
| 10 |
+
{"email": "demo@test.com", "password": "password"},
|
| 11 |
+
{"email": "demo@test.com", "password": "Demo@123"},
|
| 12 |
+
{"email": "test@example.com", "password": "test123"},
|
| 13 |
+
{"email": "test@example.com", "password": "password"},
|
| 14 |
+
{"email": "yukti06@gmail.com", "password": "password"},
|
| 15 |
+
{"email": "yukti06@gmail.com", "password": "test123"},
|
| 16 |
+
]:
|
| 17 |
+
r = session.post(f"{BASE}/api/auth/login", json=creds)
|
| 18 |
+
if r.status_code == 200:
|
| 19 |
+
print(f"Login OK with: {creds['email']}")
|
| 20 |
+
break
|
| 21 |
+
else:
|
| 22 |
+
print(f"Login failed: {creds['email']} / {creds['password']}")
|
| 23 |
+
else:
|
| 24 |
+
print("All login attempts failed. Creating new test user...")
|
| 25 |
+
r = session.post(f"{BASE}/api/auth/signup", json={
|
| 26 |
+
"name": "Test Anchoring",
|
| 27 |
+
"email": "anchoring@test.com",
|
| 28 |
+
"password": "test123"
|
| 29 |
+
})
|
| 30 |
+
print(f"Signup: {r.status_code} - {r.json().get('message', r.json().get('error'))}")
|
| 31 |
+
|
| 32 |
+
# Get agents
|
| 33 |
+
r = session.get(f"{BASE}/api/agents")
|
| 34 |
+
if r.status_code == 200:
|
| 35 |
+
agents = r.json()['agents']
|
| 36 |
+
print(f"\nAgents ({len(agents)}):")
|
| 37 |
+
for a in agents:
|
| 38 |
+
at = a.get('agent_type', '?')
|
| 39 |
+
default = a.get('is_default', False)
|
| 40 |
+
script = 'yes' if a.get('script_content') else 'no'
|
| 41 |
+
print(f" {a['icon']} {a['name']} [type={at}] [default={default}] [script={script}]")
|
| 42 |
+
|
| 43 |
+
# Find anchoring agent
|
| 44 |
+
anc = [a for a in agents if a.get('agent_type') == 'anchoring']
|
| 45 |
+
if anc:
|
| 46 |
+
agent = anc[0]
|
| 47 |
+
print(f"\n✅ Anchoring agent found: {agent['name']} (id={agent['id']})")
|
| 48 |
+
|
| 49 |
+
# Test state endpoint
|
| 50 |
+
r2 = session.get(f"{BASE}/api/agents/{agent['id']}/anchoring/state")
|
| 51 |
+
print(f"State endpoint: {r2.status_code} - {r2.json()}")
|
| 52 |
+
|
| 53 |
+
# Test control endpoint
|
| 54 |
+
r3 = session.post(f"{BASE}/api/agents/{agent['id']}/anchoring/control", json={"action": "play"})
|
| 55 |
+
print(f"Play control: {r3.status_code} - status={r3.json().get('state', {}).get('status')}")
|
| 56 |
+
|
| 57 |
+
r4 = session.post(f"{BASE}/api/agents/{agent['id']}/anchoring/control", json={"action": "stop"})
|
| 58 |
+
print(f"Stop control: {r4.status_code} - status={r4.json().get('state', {}).get('status')}")
|
| 59 |
+
|
| 60 |
+
# Test delete protection
|
| 61 |
+
r5 = session.delete(f"{BASE}/api/agents/{agent['id']}")
|
| 62 |
+
print(f"Delete attempt: {r5.status_code} - {r5.json().get('error', 'DELETED (BAD!)')}")
|
| 63 |
+
|
| 64 |
+
print("\n✅ All anchoring endpoints working correctly!")
|
| 65 |
+
else:
|
| 66 |
+
print("\n❌ No anchoring agent found!")
|
| 67 |
+
else:
|
| 68 |
+
print(f"Failed to get agents: {r.status_code}")
|
frontend/3d-assets/blendDataBlink.json
ADDED
|
@@ -0,0 +1,3323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[
|
| 2 |
+
{
|
| 3 |
+
"time": 0.7666666666666674,
|
| 4 |
+
"blendshapes": {
|
| 5 |
+
"eyeBlinkLeft": 0,
|
| 6 |
+
"eyeBlinkRight": 0,
|
| 7 |
+
"mouthSmileLeft": 0.3,
|
| 8 |
+
"mouthSmileRight": 0.3
|
| 9 |
+
}
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"time": 0.7833333333333341,
|
| 13 |
+
"blendshapes": {
|
| 14 |
+
"eyeBlinkLeft": 0,
|
| 15 |
+
"eyeBlinkRight": 0,
|
| 16 |
+
"mouthSmileLeft": 0.3,
|
| 17 |
+
"mouthSmileRight": 0.3
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
{
|
| 21 |
+
"time": 0.8000000000000008,
|
| 22 |
+
"blendshapes": {
|
| 23 |
+
"eyeBlinkLeft": 0,
|
| 24 |
+
"eyeBlinkRight": 0,
|
| 25 |
+
"mouthSmileLeft": 0.3,
|
| 26 |
+
"mouthSmileRight": 0.3
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"time": 0.8166666666666675,
|
| 31 |
+
"blendshapes": {
|
| 32 |
+
"eyeBlinkLeft": 0,
|
| 33 |
+
"eyeBlinkRight": 0,
|
| 34 |
+
"mouthSmileLeft": 0.3,
|
| 35 |
+
"mouthSmileRight": 0.3
|
| 36 |
+
}
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"time": 0.8333333333333343,
|
| 40 |
+
"blendshapes": {
|
| 41 |
+
"eyeBlinkLeft": 0,
|
| 42 |
+
"eyeBlinkRight": 0,
|
| 43 |
+
"mouthSmileLeft": 0.3,
|
| 44 |
+
"mouthSmileRight": 0.3
|
| 45 |
+
}
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"time": 0.850000000000001,
|
| 49 |
+
"blendshapes": {
|
| 50 |
+
"eyeBlinkLeft": 0,
|
| 51 |
+
"eyeBlinkRight": 0,
|
| 52 |
+
"mouthSmileLeft": 0.3,
|
| 53 |
+
"mouthSmileRight": 0.3
|
| 54 |
+
}
|
| 55 |
+
},
|
| 56 |
+
{
|
| 57 |
+
"time": 0.8666666666666677,
|
| 58 |
+
"blendshapes": {
|
| 59 |
+
"eyeBlinkLeft": 0,
|
| 60 |
+
"eyeBlinkRight": 0,
|
| 61 |
+
"mouthSmileLeft": 0.3,
|
| 62 |
+
"mouthSmileRight": 0.3
|
| 63 |
+
}
|
| 64 |
+
},
|
| 65 |
+
{
|
| 66 |
+
"time": 0.8833333333333344,
|
| 67 |
+
"blendshapes": {
|
| 68 |
+
"eyeBlinkLeft": 0,
|
| 69 |
+
"eyeBlinkRight": 0,
|
| 70 |
+
"mouthSmileLeft": 0.3,
|
| 71 |
+
"mouthSmileRight": 0.3
|
| 72 |
+
}
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"time": 0.9000000000000011,
|
| 76 |
+
"blendshapes": {
|
| 77 |
+
"eyeBlinkLeft": 0,
|
| 78 |
+
"eyeBlinkRight": 0,
|
| 79 |
+
"mouthSmileLeft": 0.3,
|
| 80 |
+
"mouthSmileRight": 0.3
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
"time": 0.9166666666666679,
|
| 85 |
+
"blendshapes": {
|
| 86 |
+
"eyeBlinkLeft": 0,
|
| 87 |
+
"eyeBlinkRight": 0,
|
| 88 |
+
"mouthSmileLeft": 0.3,
|
| 89 |
+
"mouthSmileRight": 0.3
|
| 90 |
+
}
|
| 91 |
+
},
|
| 92 |
+
{
|
| 93 |
+
"time": 0.9333333333333346,
|
| 94 |
+
"blendshapes": {
|
| 95 |
+
"eyeBlinkLeft": 0,
|
| 96 |
+
"eyeBlinkRight": 0,
|
| 97 |
+
"mouthSmileLeft": 0.3,
|
| 98 |
+
"mouthSmileRight": 0.3
|
| 99 |
+
}
|
| 100 |
+
},
|
| 101 |
+
{
|
| 102 |
+
"time": 0.9500000000000013,
|
| 103 |
+
"blendshapes": {
|
| 104 |
+
"eyeBlinkLeft": 0,
|
| 105 |
+
"eyeBlinkRight": 0,
|
| 106 |
+
"mouthSmileLeft": 0.3,
|
| 107 |
+
"mouthSmileRight": 0.3
|
| 108 |
+
}
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"time": 0.966666666666668,
|
| 112 |
+
"blendshapes": {
|
| 113 |
+
"eyeBlinkLeft": 0,
|
| 114 |
+
"eyeBlinkRight": 0,
|
| 115 |
+
"mouthSmileLeft": 0.3,
|
| 116 |
+
"mouthSmileRight": 0.3
|
| 117 |
+
}
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"time": 0.9833333333333347,
|
| 121 |
+
"blendshapes": {
|
| 122 |
+
"eyeBlinkLeft": 0,
|
| 123 |
+
"eyeBlinkRight": 0,
|
| 124 |
+
"mouthSmileLeft": 0.3,
|
| 125 |
+
"mouthSmileRight": 0.3
|
| 126 |
+
}
|
| 127 |
+
},
|
| 128 |
+
{
|
| 129 |
+
"time": 1.0000000000000013,
|
| 130 |
+
"blendshapes": {
|
| 131 |
+
"eyeBlinkLeft": 0,
|
| 132 |
+
"eyeBlinkRight": 0,
|
| 133 |
+
"mouthSmileLeft": 0.3,
|
| 134 |
+
"mouthSmileRight": 0.3
|
| 135 |
+
}
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"time": 1.016666666666668,
|
| 139 |
+
"blendshapes": {
|
| 140 |
+
"eyeBlinkLeft": 0,
|
| 141 |
+
"eyeBlinkRight": 0,
|
| 142 |
+
"mouthSmileLeft": 0.3,
|
| 143 |
+
"mouthSmileRight": 0.3
|
| 144 |
+
}
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"time": 1.0333333333333345,
|
| 148 |
+
"blendshapes": {
|
| 149 |
+
"eyeBlinkLeft": 0,
|
| 150 |
+
"eyeBlinkRight": 0,
|
| 151 |
+
"mouthSmileLeft": 0.3,
|
| 152 |
+
"mouthSmileRight": 0.3
|
| 153 |
+
}
|
| 154 |
+
},
|
| 155 |
+
{
|
| 156 |
+
"time": 1.0500000000000012,
|
| 157 |
+
"blendshapes": {
|
| 158 |
+
"eyeBlinkLeft": 0,
|
| 159 |
+
"eyeBlinkRight": 0,
|
| 160 |
+
"mouthSmileLeft": 0.3,
|
| 161 |
+
"mouthSmileRight": 0.3
|
| 162 |
+
}
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"time": 1.0666666666666678,
|
| 166 |
+
"blendshapes": {
|
| 167 |
+
"eyeBlinkLeft": 0,
|
| 168 |
+
"eyeBlinkRight": 0,
|
| 169 |
+
"mouthSmileLeft": 0.3,
|
| 170 |
+
"mouthSmileRight": 0.3
|
| 171 |
+
}
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
"time": 1.0833333333333344,
|
| 175 |
+
"blendshapes": {
|
| 176 |
+
"eyeBlinkLeft": 0,
|
| 177 |
+
"eyeBlinkRight": 0,
|
| 178 |
+
"mouthSmileLeft": 0.3,
|
| 179 |
+
"mouthSmileRight": 0.3
|
| 180 |
+
}
|
| 181 |
+
},
|
| 182 |
+
{
|
| 183 |
+
"time": 1.100000000000001,
|
| 184 |
+
"blendshapes": {
|
| 185 |
+
"eyeBlinkLeft": 0,
|
| 186 |
+
"eyeBlinkRight": 0,
|
| 187 |
+
"mouthSmileLeft": 0.3,
|
| 188 |
+
"mouthSmileRight": 0.3
|
| 189 |
+
}
|
| 190 |
+
},
|
| 191 |
+
{
|
| 192 |
+
"time": 1.1166666666666676,
|
| 193 |
+
"blendshapes": {
|
| 194 |
+
"eyeBlinkLeft": 0,
|
| 195 |
+
"eyeBlinkRight": 0,
|
| 196 |
+
"mouthSmileLeft": 0.3,
|
| 197 |
+
"mouthSmileRight": 0.3
|
| 198 |
+
}
|
| 199 |
+
},
|
| 200 |
+
{
|
| 201 |
+
"time": 1.1333333333333342,
|
| 202 |
+
"blendshapes": {
|
| 203 |
+
"eyeBlinkLeft": 0,
|
| 204 |
+
"eyeBlinkRight": 0,
|
| 205 |
+
"mouthSmileLeft": 0.3,
|
| 206 |
+
"mouthSmileRight": 0.3
|
| 207 |
+
}
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"time": 1.1500000000000008,
|
| 211 |
+
"blendshapes": {
|
| 212 |
+
"eyeBlinkLeft": 0,
|
| 213 |
+
"eyeBlinkRight": 0,
|
| 214 |
+
"mouthSmileLeft": 0.3,
|
| 215 |
+
"mouthSmileRight": 0.3
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
{
|
| 219 |
+
"time": 1.1666666666666674,
|
| 220 |
+
"blendshapes": {
|
| 221 |
+
"eyeBlinkLeft": 0,
|
| 222 |
+
"eyeBlinkRight": 0,
|
| 223 |
+
"mouthSmileLeft": 0.3,
|
| 224 |
+
"mouthSmileRight": 0.3
|
| 225 |
+
}
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"time": 1.183333333333334,
|
| 229 |
+
"blendshapes": {
|
| 230 |
+
"eyeBlinkLeft": 0,
|
| 231 |
+
"eyeBlinkRight": 0,
|
| 232 |
+
"mouthSmileLeft": 0.3,
|
| 233 |
+
"mouthSmileRight": 0.3
|
| 234 |
+
}
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"time": 1.2000000000000006,
|
| 238 |
+
"blendshapes": {
|
| 239 |
+
"eyeBlinkLeft": 0,
|
| 240 |
+
"eyeBlinkRight": 0,
|
| 241 |
+
"mouthSmileLeft": 0.3,
|
| 242 |
+
"mouthSmileRight": 0.3
|
| 243 |
+
}
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"time": 1.2166666666666672,
|
| 247 |
+
"blendshapes": {
|
| 248 |
+
"eyeBlinkLeft": 0,
|
| 249 |
+
"eyeBlinkRight": 0,
|
| 250 |
+
"mouthSmileLeft": 0.3,
|
| 251 |
+
"mouthSmileRight": 0.3
|
| 252 |
+
}
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"time": 1.2333333333333338,
|
| 256 |
+
"blendshapes": {
|
| 257 |
+
"eyeBlinkLeft": 0,
|
| 258 |
+
"eyeBlinkRight": 0,
|
| 259 |
+
"mouthSmileLeft": 0.3,
|
| 260 |
+
"mouthSmileRight": 0.3
|
| 261 |
+
}
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"time": 1.2500000000000004,
|
| 265 |
+
"blendshapes": {
|
| 266 |
+
"eyeBlinkLeft": 0,
|
| 267 |
+
"eyeBlinkRight": 0,
|
| 268 |
+
"mouthSmileLeft": 0.3,
|
| 269 |
+
"mouthSmileRight": 0.3
|
| 270 |
+
}
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"time": 1.266666666666667,
|
| 274 |
+
"blendshapes": {
|
| 275 |
+
"eyeBlinkLeft": 0,
|
| 276 |
+
"eyeBlinkRight": 0,
|
| 277 |
+
"mouthSmileLeft": 0.3,
|
| 278 |
+
"mouthSmileRight": 0.3
|
| 279 |
+
}
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"time": 1.2833333333333337,
|
| 283 |
+
"blendshapes": {
|
| 284 |
+
"eyeBlinkLeft": 0,
|
| 285 |
+
"eyeBlinkRight": 0,
|
| 286 |
+
"mouthSmileLeft": 0.3,
|
| 287 |
+
"mouthSmileRight": 0.3
|
| 288 |
+
}
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"time": 1.3000000000000003,
|
| 292 |
+
"blendshapes": {
|
| 293 |
+
"eyeBlinkLeft": 0,
|
| 294 |
+
"eyeBlinkRight": 0,
|
| 295 |
+
"mouthSmileLeft": 0.3,
|
| 296 |
+
"mouthSmileRight": 0.3
|
| 297 |
+
}
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"time": 1.3166666666666669,
|
| 301 |
+
"blendshapes": {
|
| 302 |
+
"eyeBlinkLeft": 0,
|
| 303 |
+
"eyeBlinkRight": 0,
|
| 304 |
+
"mouthSmileLeft": 0.3,
|
| 305 |
+
"mouthSmileRight": 0.3
|
| 306 |
+
}
|
| 307 |
+
},
|
| 308 |
+
{
|
| 309 |
+
"time": 1.3333333333333335,
|
| 310 |
+
"blendshapes": {
|
| 311 |
+
"eyeBlinkLeft": 0,
|
| 312 |
+
"eyeBlinkRight": 0,
|
| 313 |
+
"mouthSmileLeft": 0.3,
|
| 314 |
+
"mouthSmileRight": 0.3
|
| 315 |
+
}
|
| 316 |
+
},
|
| 317 |
+
{
|
| 318 |
+
"time": 1.35,
|
| 319 |
+
"blendshapes": {
|
| 320 |
+
"eyeBlinkLeft": 0,
|
| 321 |
+
"eyeBlinkRight": 0,
|
| 322 |
+
"mouthSmileLeft": 0.3,
|
| 323 |
+
"mouthSmileRight": 0.3
|
| 324 |
+
}
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"time": 1.3666666666666667,
|
| 328 |
+
"blendshapes": {
|
| 329 |
+
"eyeBlinkLeft": 0,
|
| 330 |
+
"eyeBlinkRight": 0,
|
| 331 |
+
"mouthSmileLeft": 0.3,
|
| 332 |
+
"mouthSmileRight": 0.3
|
| 333 |
+
}
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"time": 1.3833333333333333,
|
| 337 |
+
"blendshapes": {
|
| 338 |
+
"eyeBlinkLeft": 0,
|
| 339 |
+
"eyeBlinkRight": 0,
|
| 340 |
+
"mouthSmileLeft": 0.3,
|
| 341 |
+
"mouthSmileRight": 0.3
|
| 342 |
+
}
|
| 343 |
+
},
|
| 344 |
+
{
|
| 345 |
+
"time": 1.4,
|
| 346 |
+
"blendshapes": {
|
| 347 |
+
"eyeBlinkLeft": 0,
|
| 348 |
+
"eyeBlinkRight": 0,
|
| 349 |
+
"mouthSmileLeft": 0.3,
|
| 350 |
+
"mouthSmileRight": 0.3
|
| 351 |
+
}
|
| 352 |
+
},
|
| 353 |
+
{
|
| 354 |
+
"time": 1.4166666666666665,
|
| 355 |
+
"blendshapes": {
|
| 356 |
+
"eyeBlinkLeft": 0,
|
| 357 |
+
"eyeBlinkRight": 0,
|
| 358 |
+
"mouthSmileLeft": 0.3,
|
| 359 |
+
"mouthSmileRight": 0.3
|
| 360 |
+
}
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"time": 1.4333333333333331,
|
| 364 |
+
"blendshapes": {
|
| 365 |
+
"eyeBlinkLeft": 0,
|
| 366 |
+
"eyeBlinkRight": 0,
|
| 367 |
+
"mouthSmileLeft": 0.3,
|
| 368 |
+
"mouthSmileRight": 0.3
|
| 369 |
+
}
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"time": 1.4499999999999997,
|
| 373 |
+
"blendshapes": {
|
| 374 |
+
"eyeBlinkLeft": 0,
|
| 375 |
+
"eyeBlinkRight": 0,
|
| 376 |
+
"mouthSmileLeft": 0.3,
|
| 377 |
+
"mouthSmileRight": 0.3
|
| 378 |
+
}
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"time": 1.4666666666666663,
|
| 382 |
+
"blendshapes": {
|
| 383 |
+
"eyeBlinkLeft": 0,
|
| 384 |
+
"eyeBlinkRight": 0,
|
| 385 |
+
"mouthSmileLeft": 0.3,
|
| 386 |
+
"mouthSmileRight": 0.3
|
| 387 |
+
}
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
"time": 1.483333333333333,
|
| 391 |
+
"blendshapes": {
|
| 392 |
+
"eyeBlinkLeft": 0,
|
| 393 |
+
"eyeBlinkRight": 0,
|
| 394 |
+
"mouthSmileLeft": 0.3,
|
| 395 |
+
"mouthSmileRight": 0.3
|
| 396 |
+
}
|
| 397 |
+
},
|
| 398 |
+
{
|
| 399 |
+
"time": 1.4999999999999996,
|
| 400 |
+
"blendshapes": {
|
| 401 |
+
"eyeBlinkLeft": 0,
|
| 402 |
+
"eyeBlinkRight": 0,
|
| 403 |
+
"mouthSmileLeft": 0.3,
|
| 404 |
+
"mouthSmileRight": 0.3
|
| 405 |
+
}
|
| 406 |
+
},
|
| 407 |
+
{
|
| 408 |
+
"time": 1.5166666666666662,
|
| 409 |
+
"blendshapes": {
|
| 410 |
+
"eyeBlinkLeft": 0,
|
| 411 |
+
"eyeBlinkRight": 0,
|
| 412 |
+
"mouthSmileLeft": 0.3,
|
| 413 |
+
"mouthSmileRight": 0.3
|
| 414 |
+
}
|
| 415 |
+
},
|
| 416 |
+
{
|
| 417 |
+
"time": 1.5333333333333328,
|
| 418 |
+
"blendshapes": {
|
| 419 |
+
"eyeBlinkLeft": 0,
|
| 420 |
+
"eyeBlinkRight": 0,
|
| 421 |
+
"mouthSmileLeft": 0.3,
|
| 422 |
+
"mouthSmileRight": 0.3
|
| 423 |
+
}
|
| 424 |
+
},
|
| 425 |
+
{
|
| 426 |
+
"time": 1.5499999999999994,
|
| 427 |
+
"blendshapes": {
|
| 428 |
+
"eyeBlinkLeft": 0,
|
| 429 |
+
"eyeBlinkRight": 0,
|
| 430 |
+
"mouthSmileLeft": 0.3,
|
| 431 |
+
"mouthSmileRight": 0.3
|
| 432 |
+
}
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"time": 1.566666666666666,
|
| 436 |
+
"blendshapes": {
|
| 437 |
+
"eyeBlinkLeft": 0.004,
|
| 438 |
+
"eyeBlinkRight": 0.004,
|
| 439 |
+
"mouthSmileLeft": 0.3,
|
| 440 |
+
"mouthSmileRight": 0.3
|
| 441 |
+
}
|
| 442 |
+
},
|
| 443 |
+
{
|
| 444 |
+
"time": 1.5833333333333326,
|
| 445 |
+
"blendshapes": {
|
| 446 |
+
"eyeBlinkLeft": 0.174,
|
| 447 |
+
"eyeBlinkRight": 0.174,
|
| 448 |
+
"mouthSmileLeft": 0.3,
|
| 449 |
+
"mouthSmileRight": 0.3
|
| 450 |
+
}
|
| 451 |
+
},
|
| 452 |
+
{
|
| 453 |
+
"time": 1.5999999999999992,
|
| 454 |
+
"blendshapes": {
|
| 455 |
+
"eyeBlinkLeft": 0.391,
|
| 456 |
+
"eyeBlinkRight": 0.391,
|
| 457 |
+
"mouthSmileLeft": 0.3,
|
| 458 |
+
"mouthSmileRight": 0.3
|
| 459 |
+
}
|
| 460 |
+
},
|
| 461 |
+
{
|
| 462 |
+
"time": 1.6166666666666658,
|
| 463 |
+
"blendshapes": {
|
| 464 |
+
"eyeBlinkLeft": 0.581,
|
| 465 |
+
"eyeBlinkRight": 0.58,
|
| 466 |
+
"mouthSmileLeft": 0.3,
|
| 467 |
+
"mouthSmileRight": 0.3
|
| 468 |
+
}
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"time": 1.6333333333333324,
|
| 472 |
+
"blendshapes": {
|
| 473 |
+
"eyeBlinkLeft": 0.848,
|
| 474 |
+
"eyeBlinkRight": 0.848,
|
| 475 |
+
"mouthSmileLeft": 0.3,
|
| 476 |
+
"mouthSmileRight": 0.3
|
| 477 |
+
}
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
"time": 1.649999999999999,
|
| 481 |
+
"blendshapes": {
|
| 482 |
+
"eyeBlinkLeft": 0.87,
|
| 483 |
+
"eyeBlinkRight": 0.869,
|
| 484 |
+
"mouthSmileLeft": 0.3,
|
| 485 |
+
"mouthSmileRight": 0.3
|
| 486 |
+
}
|
| 487 |
+
},
|
| 488 |
+
{
|
| 489 |
+
"time": 1.6666666666666656,
|
| 490 |
+
"blendshapes": {
|
| 491 |
+
"eyeBlinkLeft": 0.628,
|
| 492 |
+
"eyeBlinkRight": 0.628,
|
| 493 |
+
"mouthSmileLeft": 0.3,
|
| 494 |
+
"mouthSmileRight": 0.3
|
| 495 |
+
}
|
| 496 |
+
},
|
| 497 |
+
{
|
| 498 |
+
"time": 1.6833333333333322,
|
| 499 |
+
"blendshapes": {
|
| 500 |
+
"eyeBlinkLeft": 0.454,
|
| 501 |
+
"eyeBlinkRight": 0.454,
|
| 502 |
+
"mouthSmileLeft": 0.3,
|
| 503 |
+
"mouthSmileRight": 0.3
|
| 504 |
+
}
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"time": 1.6999999999999988,
|
| 508 |
+
"blendshapes": {
|
| 509 |
+
"eyeBlinkLeft": 0.339,
|
| 510 |
+
"eyeBlinkRight": 0.339,
|
| 511 |
+
"mouthSmileLeft": 0.3,
|
| 512 |
+
"mouthSmileRight": 0.3
|
| 513 |
+
}
|
| 514 |
+
},
|
| 515 |
+
{
|
| 516 |
+
"time": 1.7166666666666655,
|
| 517 |
+
"blendshapes": {
|
| 518 |
+
"eyeBlinkLeft": 0.227,
|
| 519 |
+
"eyeBlinkRight": 0.227,
|
| 520 |
+
"mouthSmileLeft": 0.3,
|
| 521 |
+
"mouthSmileRight": 0.3
|
| 522 |
+
}
|
| 523 |
+
},
|
| 524 |
+
{
|
| 525 |
+
"time": 1.733333333333332,
|
| 526 |
+
"blendshapes": {
|
| 527 |
+
"eyeBlinkLeft": 0.154,
|
| 528 |
+
"eyeBlinkRight": 0.154,
|
| 529 |
+
"mouthSmileLeft": 0.3,
|
| 530 |
+
"mouthSmileRight": 0.3
|
| 531 |
+
}
|
| 532 |
+
},
|
| 533 |
+
{
|
| 534 |
+
"time": 1.7499999999999987,
|
| 535 |
+
"blendshapes": {
|
| 536 |
+
"eyeBlinkLeft": 0.104,
|
| 537 |
+
"eyeBlinkRight": 0.104,
|
| 538 |
+
"mouthSmileLeft": 0.3,
|
| 539 |
+
"mouthSmileRight": 0.3
|
| 540 |
+
}
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
"time": 1.7666666666666653,
|
| 544 |
+
"blendshapes": {
|
| 545 |
+
"eyeBlinkLeft": 0.076,
|
| 546 |
+
"eyeBlinkRight": 0.076,
|
| 547 |
+
"mouthSmileLeft": 0.3,
|
| 548 |
+
"mouthSmileRight": 0.3
|
| 549 |
+
}
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"time": 1.7833333333333319,
|
| 553 |
+
"blendshapes": {
|
| 554 |
+
"eyeBlinkLeft": 0.039,
|
| 555 |
+
"eyeBlinkRight": 0.039,
|
| 556 |
+
"mouthSmileLeft": 0.3,
|
| 557 |
+
"mouthSmileRight": 0.3
|
| 558 |
+
}
|
| 559 |
+
},
|
| 560 |
+
{
|
| 561 |
+
"time": 1.7999999999999985,
|
| 562 |
+
"blendshapes": {
|
| 563 |
+
"eyeBlinkLeft": 0.019,
|
| 564 |
+
"eyeBlinkRight": 0.019,
|
| 565 |
+
"mouthSmileLeft": 0.3,
|
| 566 |
+
"mouthSmileRight": 0.3
|
| 567 |
+
}
|
| 568 |
+
},
|
| 569 |
+
{
|
| 570 |
+
"time": 1.816666666666665,
|
| 571 |
+
"blendshapes": {
|
| 572 |
+
"eyeBlinkLeft": 0.01,
|
| 573 |
+
"eyeBlinkRight": 0.01,
|
| 574 |
+
"mouthSmileLeft": 0.3,
|
| 575 |
+
"mouthSmileRight": 0.3
|
| 576 |
+
}
|
| 577 |
+
},
|
| 578 |
+
{
|
| 579 |
+
"time": 1.8333333333333317,
|
| 580 |
+
"blendshapes": {
|
| 581 |
+
"eyeBlinkLeft": 0.005,
|
| 582 |
+
"eyeBlinkRight": 0.005,
|
| 583 |
+
"mouthSmileLeft": 0.3,
|
| 584 |
+
"mouthSmileRight": 0.3
|
| 585 |
+
}
|
| 586 |
+
},
|
| 587 |
+
{
|
| 588 |
+
"time": 1.8499999999999983,
|
| 589 |
+
"blendshapes": {
|
| 590 |
+
"eyeBlinkLeft": 0.002,
|
| 591 |
+
"eyeBlinkRight": 0.002,
|
| 592 |
+
"mouthSmileLeft": 0.3,
|
| 593 |
+
"mouthSmileRight": 0.3
|
| 594 |
+
}
|
| 595 |
+
},
|
| 596 |
+
{
|
| 597 |
+
"time": 1.866666666666665,
|
| 598 |
+
"blendshapes": {
|
| 599 |
+
"eyeBlinkLeft": 0.001,
|
| 600 |
+
"eyeBlinkRight": 0.001,
|
| 601 |
+
"mouthSmileLeft": 0.3,
|
| 602 |
+
"mouthSmileRight": 0.3
|
| 603 |
+
}
|
| 604 |
+
},
|
| 605 |
+
{
|
| 606 |
+
"time": 1.8833333333333315,
|
| 607 |
+
"blendshapes": {
|
| 608 |
+
"eyeBlinkLeft": 0,
|
| 609 |
+
"eyeBlinkRight": 0,
|
| 610 |
+
"mouthSmileLeft": 0.3,
|
| 611 |
+
"mouthSmileRight": 0.3
|
| 612 |
+
}
|
| 613 |
+
},
|
| 614 |
+
{
|
| 615 |
+
"time": 1.8999999999999981,
|
| 616 |
+
"blendshapes": {
|
| 617 |
+
"eyeBlinkLeft": 0,
|
| 618 |
+
"eyeBlinkRight": 0,
|
| 619 |
+
"mouthSmileLeft": 0.3,
|
| 620 |
+
"mouthSmileRight": 0.3
|
| 621 |
+
}
|
| 622 |
+
},
|
| 623 |
+
{
|
| 624 |
+
"time": 1.9166666666666647,
|
| 625 |
+
"blendshapes": {
|
| 626 |
+
"eyeBlinkLeft": 0,
|
| 627 |
+
"eyeBlinkRight": 0,
|
| 628 |
+
"mouthSmileLeft": 0.3,
|
| 629 |
+
"mouthSmileRight": 0.3
|
| 630 |
+
}
|
| 631 |
+
},
|
| 632 |
+
{
|
| 633 |
+
"time": 1.9333333333333313,
|
| 634 |
+
"blendshapes": {
|
| 635 |
+
"eyeBlinkLeft": 0,
|
| 636 |
+
"eyeBlinkRight": 0,
|
| 637 |
+
"mouthSmileLeft": 0.3,
|
| 638 |
+
"mouthSmileRight": 0.3
|
| 639 |
+
}
|
| 640 |
+
},
|
| 641 |
+
{
|
| 642 |
+
"time": 1.949999999999998,
|
| 643 |
+
"blendshapes": {
|
| 644 |
+
"eyeBlinkLeft": 0,
|
| 645 |
+
"eyeBlinkRight": 0,
|
| 646 |
+
"mouthSmileLeft": 0.3,
|
| 647 |
+
"mouthSmileRight": 0.3
|
| 648 |
+
}
|
| 649 |
+
},
|
| 650 |
+
{
|
| 651 |
+
"time": 1.9666666666666646,
|
| 652 |
+
"blendshapes": {
|
| 653 |
+
"eyeBlinkLeft": 0,
|
| 654 |
+
"eyeBlinkRight": 0,
|
| 655 |
+
"mouthSmileLeft": 0.3,
|
| 656 |
+
"mouthSmileRight": 0.3
|
| 657 |
+
}
|
| 658 |
+
},
|
| 659 |
+
{
|
| 660 |
+
"time": 1.9833333333333312,
|
| 661 |
+
"blendshapes": {
|
| 662 |
+
"eyeBlinkLeft": 0,
|
| 663 |
+
"eyeBlinkRight": 0,
|
| 664 |
+
"mouthSmileLeft": 0.3,
|
| 665 |
+
"mouthSmileRight": 0.3
|
| 666 |
+
}
|
| 667 |
+
},
|
| 668 |
+
{
|
| 669 |
+
"time": 1.9999999999999978,
|
| 670 |
+
"blendshapes": {
|
| 671 |
+
"eyeBlinkLeft": 0,
|
| 672 |
+
"eyeBlinkRight": 0,
|
| 673 |
+
"mouthSmileLeft": 0.3,
|
| 674 |
+
"mouthSmileRight": 0.3
|
| 675 |
+
}
|
| 676 |
+
},
|
| 677 |
+
{
|
| 678 |
+
"time": 2.0166666666666644,
|
| 679 |
+
"blendshapes": {
|
| 680 |
+
"eyeBlinkLeft": 0,
|
| 681 |
+
"eyeBlinkRight": 0,
|
| 682 |
+
"mouthSmileLeft": 0.3,
|
| 683 |
+
"mouthSmileRight": 0.3
|
| 684 |
+
}
|
| 685 |
+
},
|
| 686 |
+
{
|
| 687 |
+
"time": 2.033333333333331,
|
| 688 |
+
"blendshapes": {
|
| 689 |
+
"eyeBlinkLeft": 0,
|
| 690 |
+
"eyeBlinkRight": 0,
|
| 691 |
+
"mouthSmileLeft": 0.3,
|
| 692 |
+
"mouthSmileRight": 0.3
|
| 693 |
+
}
|
| 694 |
+
},
|
| 695 |
+
{
|
| 696 |
+
"time": 2.0499999999999976,
|
| 697 |
+
"blendshapes": {
|
| 698 |
+
"eyeBlinkLeft": 0,
|
| 699 |
+
"eyeBlinkRight": 0,
|
| 700 |
+
"mouthSmileLeft": 0.3,
|
| 701 |
+
"mouthSmileRight": 0.3
|
| 702 |
+
}
|
| 703 |
+
},
|
| 704 |
+
{
|
| 705 |
+
"time": 2.066666666666664,
|
| 706 |
+
"blendshapes": {
|
| 707 |
+
"eyeBlinkLeft": 0,
|
| 708 |
+
"eyeBlinkRight": 0,
|
| 709 |
+
"mouthSmileLeft": 0.3,
|
| 710 |
+
"mouthSmileRight": 0.3
|
| 711 |
+
}
|
| 712 |
+
},
|
| 713 |
+
{
|
| 714 |
+
"time": 2.083333333333331,
|
| 715 |
+
"blendshapes": {
|
| 716 |
+
"eyeBlinkLeft": 0,
|
| 717 |
+
"eyeBlinkRight": 0,
|
| 718 |
+
"mouthSmileLeft": 0.3,
|
| 719 |
+
"mouthSmileRight": 0.3
|
| 720 |
+
}
|
| 721 |
+
},
|
| 722 |
+
{
|
| 723 |
+
"time": 2.0999999999999974,
|
| 724 |
+
"blendshapes": {
|
| 725 |
+
"eyeBlinkLeft": 0,
|
| 726 |
+
"eyeBlinkRight": 0,
|
| 727 |
+
"mouthSmileLeft": 0.3,
|
| 728 |
+
"mouthSmileRight": 0.3
|
| 729 |
+
}
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
"time": 2.116666666666664,
|
| 733 |
+
"blendshapes": {
|
| 734 |
+
"eyeBlinkLeft": 0,
|
| 735 |
+
"eyeBlinkRight": 0,
|
| 736 |
+
"mouthSmileLeft": 0.3,
|
| 737 |
+
"mouthSmileRight": 0.3
|
| 738 |
+
}
|
| 739 |
+
},
|
| 740 |
+
{
|
| 741 |
+
"time": 2.1333333333333306,
|
| 742 |
+
"blendshapes": {
|
| 743 |
+
"eyeBlinkLeft": 0,
|
| 744 |
+
"eyeBlinkRight": 0,
|
| 745 |
+
"mouthSmileLeft": 0.3,
|
| 746 |
+
"mouthSmileRight": 0.3
|
| 747 |
+
}
|
| 748 |
+
},
|
| 749 |
+
{
|
| 750 |
+
"time": 2.1499999999999972,
|
| 751 |
+
"blendshapes": {
|
| 752 |
+
"eyeBlinkLeft": 0,
|
| 753 |
+
"eyeBlinkRight": 0,
|
| 754 |
+
"mouthSmileLeft": 0.3,
|
| 755 |
+
"mouthSmileRight": 0.3
|
| 756 |
+
}
|
| 757 |
+
},
|
| 758 |
+
{
|
| 759 |
+
"time": 2.166666666666664,
|
| 760 |
+
"blendshapes": {
|
| 761 |
+
"eyeBlinkLeft": 0,
|
| 762 |
+
"eyeBlinkRight": 0,
|
| 763 |
+
"mouthSmileLeft": 0.3,
|
| 764 |
+
"mouthSmileRight": 0.3
|
| 765 |
+
}
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
"time": 2.1833333333333305,
|
| 769 |
+
"blendshapes": {
|
| 770 |
+
"eyeBlinkLeft": 0,
|
| 771 |
+
"eyeBlinkRight": 0,
|
| 772 |
+
"mouthSmileLeft": 0.3,
|
| 773 |
+
"mouthSmileRight": 0.3
|
| 774 |
+
}
|
| 775 |
+
},
|
| 776 |
+
{
|
| 777 |
+
"time": 2.199999999999997,
|
| 778 |
+
"blendshapes": {
|
| 779 |
+
"eyeBlinkLeft": 0,
|
| 780 |
+
"eyeBlinkRight": 0,
|
| 781 |
+
"mouthSmileLeft": 0.3,
|
| 782 |
+
"mouthSmileRight": 0.3
|
| 783 |
+
}
|
| 784 |
+
},
|
| 785 |
+
{
|
| 786 |
+
"time": 2.2166666666666637,
|
| 787 |
+
"blendshapes": {
|
| 788 |
+
"eyeBlinkLeft": 0,
|
| 789 |
+
"eyeBlinkRight": 0,
|
| 790 |
+
"mouthSmileLeft": 0.3,
|
| 791 |
+
"mouthSmileRight": 0.3
|
| 792 |
+
}
|
| 793 |
+
},
|
| 794 |
+
{
|
| 795 |
+
"time": 2.2333333333333303,
|
| 796 |
+
"blendshapes": {
|
| 797 |
+
"eyeBlinkLeft": 0,
|
| 798 |
+
"eyeBlinkRight": 0,
|
| 799 |
+
"mouthSmileLeft": 0.3,
|
| 800 |
+
"mouthSmileRight": 0.3
|
| 801 |
+
}
|
| 802 |
+
},
|
| 803 |
+
{
|
| 804 |
+
"time": 2.249999999999997,
|
| 805 |
+
"blendshapes": {
|
| 806 |
+
"eyeBlinkLeft": 0,
|
| 807 |
+
"eyeBlinkRight": 0,
|
| 808 |
+
"mouthSmileLeft": 0.3,
|
| 809 |
+
"mouthSmileRight": 0.3
|
| 810 |
+
}
|
| 811 |
+
},
|
| 812 |
+
{
|
| 813 |
+
"time": 2.2666666666666635,
|
| 814 |
+
"blendshapes": {
|
| 815 |
+
"eyeBlinkLeft": 0,
|
| 816 |
+
"eyeBlinkRight": 0,
|
| 817 |
+
"mouthSmileLeft": 0.3,
|
| 818 |
+
"mouthSmileRight": 0.3
|
| 819 |
+
}
|
| 820 |
+
},
|
| 821 |
+
{
|
| 822 |
+
"time": 2.28333333333333,
|
| 823 |
+
"blendshapes": {
|
| 824 |
+
"eyeBlinkLeft": 0,
|
| 825 |
+
"eyeBlinkRight": 0,
|
| 826 |
+
"mouthSmileLeft": 0.3,
|
| 827 |
+
"mouthSmileRight": 0.3
|
| 828 |
+
}
|
| 829 |
+
},
|
| 830 |
+
{
|
| 831 |
+
"time": 2.2999999999999967,
|
| 832 |
+
"blendshapes": {
|
| 833 |
+
"eyeBlinkLeft": 0,
|
| 834 |
+
"eyeBlinkRight": 0,
|
| 835 |
+
"mouthSmileLeft": 0.3,
|
| 836 |
+
"mouthSmileRight": 0.3
|
| 837 |
+
}
|
| 838 |
+
},
|
| 839 |
+
{
|
| 840 |
+
"time": 2.3166666666666633,
|
| 841 |
+
"blendshapes": {
|
| 842 |
+
"eyeBlinkLeft": 0,
|
| 843 |
+
"eyeBlinkRight": 0,
|
| 844 |
+
"mouthSmileLeft": 0.3,
|
| 845 |
+
"mouthSmileRight": 0.3
|
| 846 |
+
}
|
| 847 |
+
},
|
| 848 |
+
{
|
| 849 |
+
"time": 2.33333333333333,
|
| 850 |
+
"blendshapes": {
|
| 851 |
+
"eyeBlinkLeft": 0,
|
| 852 |
+
"eyeBlinkRight": 0,
|
| 853 |
+
"mouthSmileLeft": 0.3,
|
| 854 |
+
"mouthSmileRight": 0.3
|
| 855 |
+
}
|
| 856 |
+
},
|
| 857 |
+
{
|
| 858 |
+
"time": 2.3499999999999965,
|
| 859 |
+
"blendshapes": {
|
| 860 |
+
"eyeBlinkLeft": 0,
|
| 861 |
+
"eyeBlinkRight": 0,
|
| 862 |
+
"mouthSmileLeft": 0.3,
|
| 863 |
+
"mouthSmileRight": 0.3
|
| 864 |
+
}
|
| 865 |
+
},
|
| 866 |
+
{
|
| 867 |
+
"time": 2.366666666666663,
|
| 868 |
+
"blendshapes": {
|
| 869 |
+
"eyeBlinkLeft": 0,
|
| 870 |
+
"eyeBlinkRight": 0,
|
| 871 |
+
"mouthSmileLeft": 0.3,
|
| 872 |
+
"mouthSmileRight": 0.3
|
| 873 |
+
}
|
| 874 |
+
},
|
| 875 |
+
{
|
| 876 |
+
"time": 2.3833333333333298,
|
| 877 |
+
"blendshapes": {
|
| 878 |
+
"eyeBlinkLeft": 0,
|
| 879 |
+
"eyeBlinkRight": 0,
|
| 880 |
+
"mouthSmileLeft": 0.3,
|
| 881 |
+
"mouthSmileRight": 0.3
|
| 882 |
+
}
|
| 883 |
+
},
|
| 884 |
+
{
|
| 885 |
+
"time": 2.3999999999999964,
|
| 886 |
+
"blendshapes": {
|
| 887 |
+
"eyeBlinkLeft": 0,
|
| 888 |
+
"eyeBlinkRight": 0,
|
| 889 |
+
"mouthSmileLeft": 0.3,
|
| 890 |
+
"mouthSmileRight": 0.3
|
| 891 |
+
}
|
| 892 |
+
},
|
| 893 |
+
{
|
| 894 |
+
"time": 2.416666666666663,
|
| 895 |
+
"blendshapes": {
|
| 896 |
+
"eyeBlinkLeft": 0,
|
| 897 |
+
"eyeBlinkRight": 0,
|
| 898 |
+
"mouthSmileLeft": 0.3,
|
| 899 |
+
"mouthSmileRight": 0.3
|
| 900 |
+
}
|
| 901 |
+
},
|
| 902 |
+
{
|
| 903 |
+
"time": 2.4333333333333296,
|
| 904 |
+
"blendshapes": {
|
| 905 |
+
"eyeBlinkLeft": 0,
|
| 906 |
+
"eyeBlinkRight": 0,
|
| 907 |
+
"mouthSmileLeft": 0.3,
|
| 908 |
+
"mouthSmileRight": 0.3
|
| 909 |
+
}
|
| 910 |
+
},
|
| 911 |
+
{
|
| 912 |
+
"time": 2.449999999999996,
|
| 913 |
+
"blendshapes": {
|
| 914 |
+
"eyeBlinkLeft": 0,
|
| 915 |
+
"eyeBlinkRight": 0,
|
| 916 |
+
"mouthSmileLeft": 0.3,
|
| 917 |
+
"mouthSmileRight": 0.3
|
| 918 |
+
}
|
| 919 |
+
},
|
| 920 |
+
{
|
| 921 |
+
"time": 2.466666666666663,
|
| 922 |
+
"blendshapes": {
|
| 923 |
+
"eyeBlinkLeft": 0,
|
| 924 |
+
"eyeBlinkRight": 0,
|
| 925 |
+
"mouthSmileLeft": 0.3,
|
| 926 |
+
"mouthSmileRight": 0.3
|
| 927 |
+
}
|
| 928 |
+
},
|
| 929 |
+
{
|
| 930 |
+
"time": 2.4833333333333294,
|
| 931 |
+
"blendshapes": {
|
| 932 |
+
"eyeBlinkLeft": 0,
|
| 933 |
+
"eyeBlinkRight": 0,
|
| 934 |
+
"mouthSmileLeft": 0.3,
|
| 935 |
+
"mouthSmileRight": 0.3
|
| 936 |
+
}
|
| 937 |
+
},
|
| 938 |
+
{
|
| 939 |
+
"time": 2.499999999999996,
|
| 940 |
+
"blendshapes": {
|
| 941 |
+
"eyeBlinkLeft": 0,
|
| 942 |
+
"eyeBlinkRight": 0,
|
| 943 |
+
"mouthSmileLeft": 0.3,
|
| 944 |
+
"mouthSmileRight": 0.3
|
| 945 |
+
}
|
| 946 |
+
},
|
| 947 |
+
{
|
| 948 |
+
"time": 2.5166666666666626,
|
| 949 |
+
"blendshapes": {
|
| 950 |
+
"eyeBlinkLeft": 0,
|
| 951 |
+
"eyeBlinkRight": 0,
|
| 952 |
+
"mouthSmileLeft": 0.3,
|
| 953 |
+
"mouthSmileRight": 0.3
|
| 954 |
+
}
|
| 955 |
+
},
|
| 956 |
+
{
|
| 957 |
+
"time": 2.533333333333329,
|
| 958 |
+
"blendshapes": {
|
| 959 |
+
"eyeBlinkLeft": 0,
|
| 960 |
+
"eyeBlinkRight": 0,
|
| 961 |
+
"mouthSmileLeft": 0.3,
|
| 962 |
+
"mouthSmileRight": 0.3
|
| 963 |
+
}
|
| 964 |
+
},
|
| 965 |
+
{
|
| 966 |
+
"time": 2.549999999999996,
|
| 967 |
+
"blendshapes": {
|
| 968 |
+
"eyeBlinkLeft": 0,
|
| 969 |
+
"eyeBlinkRight": 0,
|
| 970 |
+
"mouthSmileLeft": 0.3,
|
| 971 |
+
"mouthSmileRight": 0.3
|
| 972 |
+
}
|
| 973 |
+
},
|
| 974 |
+
{
|
| 975 |
+
"time": 2.5666666666666624,
|
| 976 |
+
"blendshapes": {
|
| 977 |
+
"eyeBlinkLeft": 0,
|
| 978 |
+
"eyeBlinkRight": 0,
|
| 979 |
+
"mouthSmileLeft": 0.3,
|
| 980 |
+
"mouthSmileRight": 0.3
|
| 981 |
+
}
|
| 982 |
+
},
|
| 983 |
+
{
|
| 984 |
+
"time": 2.583333333333329,
|
| 985 |
+
"blendshapes": {
|
| 986 |
+
"eyeBlinkLeft": 0,
|
| 987 |
+
"eyeBlinkRight": 0,
|
| 988 |
+
"mouthSmileLeft": 0.3,
|
| 989 |
+
"mouthSmileRight": 0.3
|
| 990 |
+
}
|
| 991 |
+
},
|
| 992 |
+
{
|
| 993 |
+
"time": 2.5999999999999956,
|
| 994 |
+
"blendshapes": {
|
| 995 |
+
"eyeBlinkLeft": 0,
|
| 996 |
+
"eyeBlinkRight": 0,
|
| 997 |
+
"mouthSmileLeft": 0.3,
|
| 998 |
+
"mouthSmileRight": 0.3
|
| 999 |
+
}
|
| 1000 |
+
},
|
| 1001 |
+
{
|
| 1002 |
+
"time": 2.6166666666666623,
|
| 1003 |
+
"blendshapes": {
|
| 1004 |
+
"eyeBlinkLeft": 0,
|
| 1005 |
+
"eyeBlinkRight": 0,
|
| 1006 |
+
"mouthSmileLeft": 0.3,
|
| 1007 |
+
"mouthSmileRight": 0.3
|
| 1008 |
+
}
|
| 1009 |
+
},
|
| 1010 |
+
{
|
| 1011 |
+
"time": 2.633333333333329,
|
| 1012 |
+
"blendshapes": {
|
| 1013 |
+
"eyeBlinkLeft": 0,
|
| 1014 |
+
"eyeBlinkRight": 0,
|
| 1015 |
+
"mouthSmileLeft": 0.3,
|
| 1016 |
+
"mouthSmileRight": 0.3
|
| 1017 |
+
}
|
| 1018 |
+
},
|
| 1019 |
+
{
|
| 1020 |
+
"time": 2.6499999999999955,
|
| 1021 |
+
"blendshapes": {
|
| 1022 |
+
"eyeBlinkLeft": 0,
|
| 1023 |
+
"eyeBlinkRight": 0,
|
| 1024 |
+
"mouthSmileLeft": 0.3,
|
| 1025 |
+
"mouthSmileRight": 0.3
|
| 1026 |
+
}
|
| 1027 |
+
},
|
| 1028 |
+
{
|
| 1029 |
+
"time": 2.666666666666662,
|
| 1030 |
+
"blendshapes": {
|
| 1031 |
+
"eyeBlinkLeft": 0,
|
| 1032 |
+
"eyeBlinkRight": 0,
|
| 1033 |
+
"mouthSmileLeft": 0.3,
|
| 1034 |
+
"mouthSmileRight": 0.3
|
| 1035 |
+
}
|
| 1036 |
+
},
|
| 1037 |
+
{
|
| 1038 |
+
"time": 2.6833333333333287,
|
| 1039 |
+
"blendshapes": {
|
| 1040 |
+
"eyeBlinkLeft": 0,
|
| 1041 |
+
"eyeBlinkRight": 0,
|
| 1042 |
+
"mouthSmileLeft": 0.3,
|
| 1043 |
+
"mouthSmileRight": 0.3
|
| 1044 |
+
}
|
| 1045 |
+
},
|
| 1046 |
+
{
|
| 1047 |
+
"time": 2.6999999999999953,
|
| 1048 |
+
"blendshapes": {
|
| 1049 |
+
"eyeBlinkLeft": 0,
|
| 1050 |
+
"eyeBlinkRight": 0,
|
| 1051 |
+
"mouthSmileLeft": 0.3,
|
| 1052 |
+
"mouthSmileRight": 0.3
|
| 1053 |
+
}
|
| 1054 |
+
},
|
| 1055 |
+
{
|
| 1056 |
+
"time": 2.716666666666662,
|
| 1057 |
+
"blendshapes": {
|
| 1058 |
+
"eyeBlinkLeft": 0,
|
| 1059 |
+
"eyeBlinkRight": 0,
|
| 1060 |
+
"mouthSmileLeft": 0.3,
|
| 1061 |
+
"mouthSmileRight": 0.3
|
| 1062 |
+
}
|
| 1063 |
+
},
|
| 1064 |
+
{
|
| 1065 |
+
"time": 2.7333333333333285,
|
| 1066 |
+
"blendshapes": {
|
| 1067 |
+
"eyeBlinkLeft": 0,
|
| 1068 |
+
"eyeBlinkRight": 0,
|
| 1069 |
+
"mouthSmileLeft": 0.3,
|
| 1070 |
+
"mouthSmileRight": 0.3
|
| 1071 |
+
}
|
| 1072 |
+
},
|
| 1073 |
+
{
|
| 1074 |
+
"time": 2.749999999999995,
|
| 1075 |
+
"blendshapes": {
|
| 1076 |
+
"eyeBlinkLeft": 0,
|
| 1077 |
+
"eyeBlinkRight": 0,
|
| 1078 |
+
"mouthSmileLeft": 0.3,
|
| 1079 |
+
"mouthSmileRight": 0.3
|
| 1080 |
+
}
|
| 1081 |
+
},
|
| 1082 |
+
{
|
| 1083 |
+
"time": 2.7666666666666617,
|
| 1084 |
+
"blendshapes": {
|
| 1085 |
+
"eyeBlinkLeft": 0,
|
| 1086 |
+
"eyeBlinkRight": 0,
|
| 1087 |
+
"mouthSmileLeft": 0.3,
|
| 1088 |
+
"mouthSmileRight": 0.3
|
| 1089 |
+
}
|
| 1090 |
+
},
|
| 1091 |
+
{
|
| 1092 |
+
"time": 2.7833333333333283,
|
| 1093 |
+
"blendshapes": {
|
| 1094 |
+
"eyeBlinkLeft": 0,
|
| 1095 |
+
"eyeBlinkRight": 0,
|
| 1096 |
+
"mouthSmileLeft": 0.3,
|
| 1097 |
+
"mouthSmileRight": 0.3
|
| 1098 |
+
}
|
| 1099 |
+
},
|
| 1100 |
+
{
|
| 1101 |
+
"time": 2.799999999999995,
|
| 1102 |
+
"blendshapes": {
|
| 1103 |
+
"eyeBlinkLeft": 0,
|
| 1104 |
+
"eyeBlinkRight": 0,
|
| 1105 |
+
"mouthSmileLeft": 0.3,
|
| 1106 |
+
"mouthSmileRight": 0.3
|
| 1107 |
+
}
|
| 1108 |
+
},
|
| 1109 |
+
{
|
| 1110 |
+
"time": 2.8166666666666615,
|
| 1111 |
+
"blendshapes": {
|
| 1112 |
+
"eyeBlinkLeft": 0,
|
| 1113 |
+
"eyeBlinkRight": 0,
|
| 1114 |
+
"mouthSmileLeft": 0.3,
|
| 1115 |
+
"mouthSmileRight": 0.3
|
| 1116 |
+
}
|
| 1117 |
+
},
|
| 1118 |
+
{
|
| 1119 |
+
"time": 2.833333333333328,
|
| 1120 |
+
"blendshapes": {
|
| 1121 |
+
"eyeBlinkLeft": 0,
|
| 1122 |
+
"eyeBlinkRight": 0,
|
| 1123 |
+
"mouthSmileLeft": 0.3,
|
| 1124 |
+
"mouthSmileRight": 0.3
|
| 1125 |
+
}
|
| 1126 |
+
},
|
| 1127 |
+
{
|
| 1128 |
+
"time": 2.8499999999999948,
|
| 1129 |
+
"blendshapes": {
|
| 1130 |
+
"eyeBlinkLeft": 0,
|
| 1131 |
+
"eyeBlinkRight": 0,
|
| 1132 |
+
"mouthSmileLeft": 0.3,
|
| 1133 |
+
"mouthSmileRight": 0.3
|
| 1134 |
+
}
|
| 1135 |
+
},
|
| 1136 |
+
{
|
| 1137 |
+
"time": 2.8666666666666614,
|
| 1138 |
+
"blendshapes": {
|
| 1139 |
+
"eyeBlinkLeft": 0,
|
| 1140 |
+
"eyeBlinkRight": 0,
|
| 1141 |
+
"mouthSmileLeft": 0.3,
|
| 1142 |
+
"mouthSmileRight": 0.3
|
| 1143 |
+
}
|
| 1144 |
+
},
|
| 1145 |
+
{
|
| 1146 |
+
"time": 2.883333333333328,
|
| 1147 |
+
"blendshapes": {
|
| 1148 |
+
"eyeBlinkLeft": 0,
|
| 1149 |
+
"eyeBlinkRight": 0,
|
| 1150 |
+
"mouthSmileLeft": 0.3,
|
| 1151 |
+
"mouthSmileRight": 0.3
|
| 1152 |
+
}
|
| 1153 |
+
},
|
| 1154 |
+
{
|
| 1155 |
+
"time": 2.8999999999999946,
|
| 1156 |
+
"blendshapes": {
|
| 1157 |
+
"eyeBlinkLeft": 0,
|
| 1158 |
+
"eyeBlinkRight": 0,
|
| 1159 |
+
"mouthSmileLeft": 0.3,
|
| 1160 |
+
"mouthSmileRight": 0.3
|
| 1161 |
+
}
|
| 1162 |
+
},
|
| 1163 |
+
{
|
| 1164 |
+
"time": 2.916666666666661,
|
| 1165 |
+
"blendshapes": {
|
| 1166 |
+
"eyeBlinkLeft": 0,
|
| 1167 |
+
"eyeBlinkRight": 0,
|
| 1168 |
+
"mouthSmileLeft": 0.3,
|
| 1169 |
+
"mouthSmileRight": 0.3
|
| 1170 |
+
}
|
| 1171 |
+
},
|
| 1172 |
+
{
|
| 1173 |
+
"time": 2.933333333333328,
|
| 1174 |
+
"blendshapes": {
|
| 1175 |
+
"eyeBlinkLeft": 0,
|
| 1176 |
+
"eyeBlinkRight": 0,
|
| 1177 |
+
"mouthSmileLeft": 0.3,
|
| 1178 |
+
"mouthSmileRight": 0.3
|
| 1179 |
+
}
|
| 1180 |
+
},
|
| 1181 |
+
{
|
| 1182 |
+
"time": 2.9499999999999944,
|
| 1183 |
+
"blendshapes": {
|
| 1184 |
+
"eyeBlinkLeft": 0,
|
| 1185 |
+
"eyeBlinkRight": 0,
|
| 1186 |
+
"mouthSmileLeft": 0.3,
|
| 1187 |
+
"mouthSmileRight": 0.3
|
| 1188 |
+
}
|
| 1189 |
+
},
|
| 1190 |
+
{
|
| 1191 |
+
"time": 2.966666666666661,
|
| 1192 |
+
"blendshapes": {
|
| 1193 |
+
"eyeBlinkLeft": 0,
|
| 1194 |
+
"eyeBlinkRight": 0,
|
| 1195 |
+
"mouthSmileLeft": 0.3,
|
| 1196 |
+
"mouthSmileRight": 0.3
|
| 1197 |
+
}
|
| 1198 |
+
},
|
| 1199 |
+
{
|
| 1200 |
+
"time": 2.9833333333333276,
|
| 1201 |
+
"blendshapes": {
|
| 1202 |
+
"eyeBlinkLeft": 0,
|
| 1203 |
+
"eyeBlinkRight": 0,
|
| 1204 |
+
"mouthSmileLeft": 0.3,
|
| 1205 |
+
"mouthSmileRight": 0.3
|
| 1206 |
+
}
|
| 1207 |
+
},
|
| 1208 |
+
{
|
| 1209 |
+
"time": 2.9999999999999942,
|
| 1210 |
+
"blendshapes": {
|
| 1211 |
+
"eyeBlinkLeft": 0,
|
| 1212 |
+
"eyeBlinkRight": 0,
|
| 1213 |
+
"mouthSmileLeft": 0.3,
|
| 1214 |
+
"mouthSmileRight": 0.3
|
| 1215 |
+
}
|
| 1216 |
+
},
|
| 1217 |
+
{
|
| 1218 |
+
"time": 3.016666666666661,
|
| 1219 |
+
"blendshapes": {
|
| 1220 |
+
"eyeBlinkLeft": 0,
|
| 1221 |
+
"eyeBlinkRight": 0,
|
| 1222 |
+
"mouthSmileLeft": 0.3,
|
| 1223 |
+
"mouthSmileRight": 0.3
|
| 1224 |
+
}
|
| 1225 |
+
},
|
| 1226 |
+
{
|
| 1227 |
+
"time": 3.0333333333333274,
|
| 1228 |
+
"blendshapes": {
|
| 1229 |
+
"eyeBlinkLeft": 0,
|
| 1230 |
+
"eyeBlinkRight": 0,
|
| 1231 |
+
"mouthSmileLeft": 0.3,
|
| 1232 |
+
"mouthSmileRight": 0.3
|
| 1233 |
+
}
|
| 1234 |
+
},
|
| 1235 |
+
{
|
| 1236 |
+
"time": 3.049999999999994,
|
| 1237 |
+
"blendshapes": {
|
| 1238 |
+
"eyeBlinkLeft": 0,
|
| 1239 |
+
"eyeBlinkRight": 0,
|
| 1240 |
+
"mouthSmileLeft": 0.3,
|
| 1241 |
+
"mouthSmileRight": 0.3
|
| 1242 |
+
}
|
| 1243 |
+
},
|
| 1244 |
+
{
|
| 1245 |
+
"time": 3.0666666666666607,
|
| 1246 |
+
"blendshapes": {
|
| 1247 |
+
"eyeBlinkLeft": 0,
|
| 1248 |
+
"eyeBlinkRight": 0,
|
| 1249 |
+
"mouthSmileLeft": 0.3,
|
| 1250 |
+
"mouthSmileRight": 0.3
|
| 1251 |
+
}
|
| 1252 |
+
},
|
| 1253 |
+
{
|
| 1254 |
+
"time": 3.0833333333333273,
|
| 1255 |
+
"blendshapes": {
|
| 1256 |
+
"eyeBlinkLeft": 0,
|
| 1257 |
+
"eyeBlinkRight": 0,
|
| 1258 |
+
"mouthSmileLeft": 0.3,
|
| 1259 |
+
"mouthSmileRight": 0.3
|
| 1260 |
+
}
|
| 1261 |
+
},
|
| 1262 |
+
{
|
| 1263 |
+
"time": 3.099999999999994,
|
| 1264 |
+
"blendshapes": {
|
| 1265 |
+
"eyeBlinkLeft": 0,
|
| 1266 |
+
"eyeBlinkRight": 0,
|
| 1267 |
+
"mouthSmileLeft": 0.3,
|
| 1268 |
+
"mouthSmileRight": 0.3
|
| 1269 |
+
}
|
| 1270 |
+
},
|
| 1271 |
+
{
|
| 1272 |
+
"time": 3.1166666666666605,
|
| 1273 |
+
"blendshapes": {
|
| 1274 |
+
"eyeBlinkLeft": 0,
|
| 1275 |
+
"eyeBlinkRight": 0,
|
| 1276 |
+
"mouthSmileLeft": 0.3,
|
| 1277 |
+
"mouthSmileRight": 0.3
|
| 1278 |
+
}
|
| 1279 |
+
},
|
| 1280 |
+
{
|
| 1281 |
+
"time": 3.133333333333327,
|
| 1282 |
+
"blendshapes": {
|
| 1283 |
+
"eyeBlinkLeft": 0,
|
| 1284 |
+
"eyeBlinkRight": 0,
|
| 1285 |
+
"mouthSmileLeft": 0.3,
|
| 1286 |
+
"mouthSmileRight": 0.3
|
| 1287 |
+
}
|
| 1288 |
+
},
|
| 1289 |
+
{
|
| 1290 |
+
"time": 3.1499999999999937,
|
| 1291 |
+
"blendshapes": {
|
| 1292 |
+
"eyeBlinkLeft": 0,
|
| 1293 |
+
"eyeBlinkRight": 0,
|
| 1294 |
+
"mouthSmileLeft": 0.3,
|
| 1295 |
+
"mouthSmileRight": 0.3
|
| 1296 |
+
}
|
| 1297 |
+
},
|
| 1298 |
+
{
|
| 1299 |
+
"time": 3.1666666666666603,
|
| 1300 |
+
"blendshapes": {
|
| 1301 |
+
"eyeBlinkLeft": 0,
|
| 1302 |
+
"eyeBlinkRight": 0,
|
| 1303 |
+
"mouthSmileLeft": 0.3,
|
| 1304 |
+
"mouthSmileRight": 0.3
|
| 1305 |
+
}
|
| 1306 |
+
},
|
| 1307 |
+
{
|
| 1308 |
+
"time": 3.183333333333327,
|
| 1309 |
+
"blendshapes": {
|
| 1310 |
+
"eyeBlinkLeft": 0,
|
| 1311 |
+
"eyeBlinkRight": 0,
|
| 1312 |
+
"mouthSmileLeft": 0.3,
|
| 1313 |
+
"mouthSmileRight": 0.3
|
| 1314 |
+
}
|
| 1315 |
+
},
|
| 1316 |
+
{
|
| 1317 |
+
"time": 3.1999999999999935,
|
| 1318 |
+
"blendshapes": {
|
| 1319 |
+
"eyeBlinkLeft": 0,
|
| 1320 |
+
"eyeBlinkRight": 0,
|
| 1321 |
+
"mouthSmileLeft": 0.3,
|
| 1322 |
+
"mouthSmileRight": 0.3
|
| 1323 |
+
}
|
| 1324 |
+
},
|
| 1325 |
+
{
|
| 1326 |
+
"time": 3.21666666666666,
|
| 1327 |
+
"blendshapes": {
|
| 1328 |
+
"eyeBlinkLeft": 0,
|
| 1329 |
+
"eyeBlinkRight": 0,
|
| 1330 |
+
"mouthSmileLeft": 0.3,
|
| 1331 |
+
"mouthSmileRight": 0.3
|
| 1332 |
+
}
|
| 1333 |
+
},
|
| 1334 |
+
{
|
| 1335 |
+
"time": 3.2333333333333267,
|
| 1336 |
+
"blendshapes": {
|
| 1337 |
+
"eyeBlinkLeft": 0,
|
| 1338 |
+
"eyeBlinkRight": 0,
|
| 1339 |
+
"mouthSmileLeft": 0.3,
|
| 1340 |
+
"mouthSmileRight": 0.3
|
| 1341 |
+
}
|
| 1342 |
+
},
|
| 1343 |
+
{
|
| 1344 |
+
"time": 3.2499999999999933,
|
| 1345 |
+
"blendshapes": {
|
| 1346 |
+
"eyeBlinkLeft": 0,
|
| 1347 |
+
"eyeBlinkRight": 0,
|
| 1348 |
+
"mouthSmileLeft": 0.3,
|
| 1349 |
+
"mouthSmileRight": 0.3
|
| 1350 |
+
}
|
| 1351 |
+
},
|
| 1352 |
+
{
|
| 1353 |
+
"time": 3.26666666666666,
|
| 1354 |
+
"blendshapes": {
|
| 1355 |
+
"eyeBlinkLeft": 0,
|
| 1356 |
+
"eyeBlinkRight": 0,
|
| 1357 |
+
"mouthSmileLeft": 0.3,
|
| 1358 |
+
"mouthSmileRight": 0.3
|
| 1359 |
+
}
|
| 1360 |
+
},
|
| 1361 |
+
{
|
| 1362 |
+
"time": 3.2833333333333266,
|
| 1363 |
+
"blendshapes": {
|
| 1364 |
+
"eyeBlinkLeft": 0,
|
| 1365 |
+
"eyeBlinkRight": 0,
|
| 1366 |
+
"mouthSmileLeft": 0.3,
|
| 1367 |
+
"mouthSmileRight": 0.3
|
| 1368 |
+
}
|
| 1369 |
+
},
|
| 1370 |
+
{
|
| 1371 |
+
"time": 3.299999999999993,
|
| 1372 |
+
"blendshapes": {
|
| 1373 |
+
"eyeBlinkLeft": 0,
|
| 1374 |
+
"eyeBlinkRight": 0,
|
| 1375 |
+
"mouthSmileLeft": 0.3,
|
| 1376 |
+
"mouthSmileRight": 0.3
|
| 1377 |
+
}
|
| 1378 |
+
},
|
| 1379 |
+
{
|
| 1380 |
+
"time": 3.3166666666666598,
|
| 1381 |
+
"blendshapes": {
|
| 1382 |
+
"eyeBlinkLeft": 0,
|
| 1383 |
+
"eyeBlinkRight": 0,
|
| 1384 |
+
"mouthSmileLeft": 0.3,
|
| 1385 |
+
"mouthSmileRight": 0.3
|
| 1386 |
+
}
|
| 1387 |
+
},
|
| 1388 |
+
{
|
| 1389 |
+
"time": 3.3333333333333264,
|
| 1390 |
+
"blendshapes": {
|
| 1391 |
+
"eyeBlinkLeft": 0,
|
| 1392 |
+
"eyeBlinkRight": 0,
|
| 1393 |
+
"mouthSmileLeft": 0.3,
|
| 1394 |
+
"mouthSmileRight": 0.3
|
| 1395 |
+
}
|
| 1396 |
+
},
|
| 1397 |
+
{
|
| 1398 |
+
"time": 3.349999999999993,
|
| 1399 |
+
"blendshapes": {
|
| 1400 |
+
"eyeBlinkLeft": 0,
|
| 1401 |
+
"eyeBlinkRight": 0,
|
| 1402 |
+
"mouthSmileLeft": 0.3,
|
| 1403 |
+
"mouthSmileRight": 0.3
|
| 1404 |
+
}
|
| 1405 |
+
},
|
| 1406 |
+
{
|
| 1407 |
+
"time": 3.3666666666666596,
|
| 1408 |
+
"blendshapes": {
|
| 1409 |
+
"eyeBlinkLeft": 0,
|
| 1410 |
+
"eyeBlinkRight": 0,
|
| 1411 |
+
"mouthSmileLeft": 0.3,
|
| 1412 |
+
"mouthSmileRight": 0.3
|
| 1413 |
+
}
|
| 1414 |
+
},
|
| 1415 |
+
{
|
| 1416 |
+
"time": 3.383333333333326,
|
| 1417 |
+
"blendshapes": {
|
| 1418 |
+
"eyeBlinkLeft": 0,
|
| 1419 |
+
"eyeBlinkRight": 0,
|
| 1420 |
+
"mouthSmileLeft": 0.3,
|
| 1421 |
+
"mouthSmileRight": 0.3
|
| 1422 |
+
}
|
| 1423 |
+
},
|
| 1424 |
+
{
|
| 1425 |
+
"time": 3.399999999999993,
|
| 1426 |
+
"blendshapes": {
|
| 1427 |
+
"eyeBlinkLeft": 0,
|
| 1428 |
+
"eyeBlinkRight": 0,
|
| 1429 |
+
"mouthSmileLeft": 0.3,
|
| 1430 |
+
"mouthSmileRight": 0.3
|
| 1431 |
+
}
|
| 1432 |
+
},
|
| 1433 |
+
{
|
| 1434 |
+
"time": 3.4166666666666594,
|
| 1435 |
+
"blendshapes": {
|
| 1436 |
+
"eyeBlinkLeft": 0,
|
| 1437 |
+
"eyeBlinkRight": 0,
|
| 1438 |
+
"mouthSmileLeft": 0.3,
|
| 1439 |
+
"mouthSmileRight": 0.3
|
| 1440 |
+
}
|
| 1441 |
+
},
|
| 1442 |
+
{
|
| 1443 |
+
"time": 3.433333333333326,
|
| 1444 |
+
"blendshapes": {
|
| 1445 |
+
"eyeBlinkLeft": 0,
|
| 1446 |
+
"eyeBlinkRight": 0,
|
| 1447 |
+
"mouthSmileLeft": 0.3,
|
| 1448 |
+
"mouthSmileRight": 0.3
|
| 1449 |
+
}
|
| 1450 |
+
},
|
| 1451 |
+
{
|
| 1452 |
+
"time": 3.4499999999999926,
|
| 1453 |
+
"blendshapes": {
|
| 1454 |
+
"eyeBlinkLeft": 0,
|
| 1455 |
+
"eyeBlinkRight": 0,
|
| 1456 |
+
"mouthSmileLeft": 0.3,
|
| 1457 |
+
"mouthSmileRight": 0.3
|
| 1458 |
+
}
|
| 1459 |
+
},
|
| 1460 |
+
{
|
| 1461 |
+
"time": 3.4666666666666592,
|
| 1462 |
+
"blendshapes": {
|
| 1463 |
+
"eyeBlinkLeft": 0,
|
| 1464 |
+
"eyeBlinkRight": 0,
|
| 1465 |
+
"mouthSmileLeft": 0.3,
|
| 1466 |
+
"mouthSmileRight": 0.3
|
| 1467 |
+
}
|
| 1468 |
+
},
|
| 1469 |
+
{
|
| 1470 |
+
"time": 3.483333333333326,
|
| 1471 |
+
"blendshapes": {
|
| 1472 |
+
"eyeBlinkLeft": 0,
|
| 1473 |
+
"eyeBlinkRight": 0,
|
| 1474 |
+
"mouthSmileLeft": 0.3,
|
| 1475 |
+
"mouthSmileRight": 0.3
|
| 1476 |
+
}
|
| 1477 |
+
},
|
| 1478 |
+
{
|
| 1479 |
+
"time": 3.4999999999999925,
|
| 1480 |
+
"blendshapes": {
|
| 1481 |
+
"eyeBlinkLeft": 0,
|
| 1482 |
+
"eyeBlinkRight": 0,
|
| 1483 |
+
"mouthSmileLeft": 0.3,
|
| 1484 |
+
"mouthSmileRight": 0.3
|
| 1485 |
+
}
|
| 1486 |
+
},
|
| 1487 |
+
{
|
| 1488 |
+
"time": 3.516666666666659,
|
| 1489 |
+
"blendshapes": {
|
| 1490 |
+
"eyeBlinkLeft": 0,
|
| 1491 |
+
"eyeBlinkRight": 0,
|
| 1492 |
+
"mouthSmileLeft": 0.3,
|
| 1493 |
+
"mouthSmileRight": 0.3
|
| 1494 |
+
}
|
| 1495 |
+
},
|
| 1496 |
+
{
|
| 1497 |
+
"time": 3.5333333333333257,
|
| 1498 |
+
"blendshapes": {
|
| 1499 |
+
"eyeBlinkLeft": 0,
|
| 1500 |
+
"eyeBlinkRight": 0,
|
| 1501 |
+
"mouthSmileLeft": 0.3,
|
| 1502 |
+
"mouthSmileRight": 0.3
|
| 1503 |
+
}
|
| 1504 |
+
},
|
| 1505 |
+
{
|
| 1506 |
+
"time": 3.5499999999999923,
|
| 1507 |
+
"blendshapes": {
|
| 1508 |
+
"eyeBlinkLeft": 0,
|
| 1509 |
+
"eyeBlinkRight": 0,
|
| 1510 |
+
"mouthSmileLeft": 0.3,
|
| 1511 |
+
"mouthSmileRight": 0.3
|
| 1512 |
+
}
|
| 1513 |
+
},
|
| 1514 |
+
{
|
| 1515 |
+
"time": 3.566666666666659,
|
| 1516 |
+
"blendshapes": {
|
| 1517 |
+
"eyeBlinkLeft": 0,
|
| 1518 |
+
"eyeBlinkRight": 0,
|
| 1519 |
+
"mouthSmileLeft": 0.3,
|
| 1520 |
+
"mouthSmileRight": 0.3
|
| 1521 |
+
}
|
| 1522 |
+
},
|
| 1523 |
+
{
|
| 1524 |
+
"time": 3.5833333333333255,
|
| 1525 |
+
"blendshapes": {
|
| 1526 |
+
"eyeBlinkLeft": 0,
|
| 1527 |
+
"eyeBlinkRight": 0,
|
| 1528 |
+
"mouthSmileLeft": 0.3,
|
| 1529 |
+
"mouthSmileRight": 0.3
|
| 1530 |
+
}
|
| 1531 |
+
},
|
| 1532 |
+
{
|
| 1533 |
+
"time": 3.599999999999992,
|
| 1534 |
+
"blendshapes": {
|
| 1535 |
+
"eyeBlinkLeft": 0,
|
| 1536 |
+
"eyeBlinkRight": 0,
|
| 1537 |
+
"mouthSmileLeft": 0.3,
|
| 1538 |
+
"mouthSmileRight": 0.3
|
| 1539 |
+
}
|
| 1540 |
+
},
|
| 1541 |
+
{
|
| 1542 |
+
"time": 3.6166666666666587,
|
| 1543 |
+
"blendshapes": {
|
| 1544 |
+
"eyeBlinkLeft": 0,
|
| 1545 |
+
"eyeBlinkRight": 0,
|
| 1546 |
+
"mouthSmileLeft": 0.3,
|
| 1547 |
+
"mouthSmileRight": 0.3
|
| 1548 |
+
}
|
| 1549 |
+
},
|
| 1550 |
+
{
|
| 1551 |
+
"time": 3.6333333333333253,
|
| 1552 |
+
"blendshapes": {
|
| 1553 |
+
"eyeBlinkLeft": 0,
|
| 1554 |
+
"eyeBlinkRight": 0,
|
| 1555 |
+
"mouthSmileLeft": 0.3,
|
| 1556 |
+
"mouthSmileRight": 0.3
|
| 1557 |
+
}
|
| 1558 |
+
},
|
| 1559 |
+
{
|
| 1560 |
+
"time": 3.649999999999992,
|
| 1561 |
+
"blendshapes": {
|
| 1562 |
+
"eyeBlinkLeft": 0,
|
| 1563 |
+
"eyeBlinkRight": 0,
|
| 1564 |
+
"mouthSmileLeft": 0.3,
|
| 1565 |
+
"mouthSmileRight": 0.3
|
| 1566 |
+
}
|
| 1567 |
+
},
|
| 1568 |
+
{
|
| 1569 |
+
"time": 3.6666666666666585,
|
| 1570 |
+
"blendshapes": {
|
| 1571 |
+
"eyeBlinkLeft": 0,
|
| 1572 |
+
"eyeBlinkRight": 0,
|
| 1573 |
+
"mouthSmileLeft": 0.3,
|
| 1574 |
+
"mouthSmileRight": 0.3
|
| 1575 |
+
}
|
| 1576 |
+
},
|
| 1577 |
+
{
|
| 1578 |
+
"time": 3.683333333333325,
|
| 1579 |
+
"blendshapes": {
|
| 1580 |
+
"eyeBlinkLeft": 0,
|
| 1581 |
+
"eyeBlinkRight": 0,
|
| 1582 |
+
"mouthSmileLeft": 0.3,
|
| 1583 |
+
"mouthSmileRight": 0.3
|
| 1584 |
+
}
|
| 1585 |
+
},
|
| 1586 |
+
{
|
| 1587 |
+
"time": 3.6999999999999917,
|
| 1588 |
+
"blendshapes": {
|
| 1589 |
+
"eyeBlinkLeft": 0,
|
| 1590 |
+
"eyeBlinkRight": 0,
|
| 1591 |
+
"mouthSmileLeft": 0.3,
|
| 1592 |
+
"mouthSmileRight": 0.3
|
| 1593 |
+
}
|
| 1594 |
+
},
|
| 1595 |
+
{
|
| 1596 |
+
"time": 3.7166666666666583,
|
| 1597 |
+
"blendshapes": {
|
| 1598 |
+
"eyeBlinkLeft": 0,
|
| 1599 |
+
"eyeBlinkRight": 0,
|
| 1600 |
+
"mouthSmileLeft": 0.3,
|
| 1601 |
+
"mouthSmileRight": 0.3
|
| 1602 |
+
}
|
| 1603 |
+
},
|
| 1604 |
+
{
|
| 1605 |
+
"time": 3.733333333333325,
|
| 1606 |
+
"blendshapes": {
|
| 1607 |
+
"eyeBlinkLeft": 0,
|
| 1608 |
+
"eyeBlinkRight": 0,
|
| 1609 |
+
"mouthSmileLeft": 0.3,
|
| 1610 |
+
"mouthSmileRight": 0.3
|
| 1611 |
+
}
|
| 1612 |
+
},
|
| 1613 |
+
{
|
| 1614 |
+
"time": 3.7499999999999916,
|
| 1615 |
+
"blendshapes": {
|
| 1616 |
+
"eyeBlinkLeft": 0,
|
| 1617 |
+
"eyeBlinkRight": 0,
|
| 1618 |
+
"mouthSmileLeft": 0.3,
|
| 1619 |
+
"mouthSmileRight": 0.3
|
| 1620 |
+
}
|
| 1621 |
+
},
|
| 1622 |
+
{
|
| 1623 |
+
"time": 3.766666666666658,
|
| 1624 |
+
"blendshapes": {
|
| 1625 |
+
"eyeBlinkLeft": 0,
|
| 1626 |
+
"eyeBlinkRight": 0,
|
| 1627 |
+
"mouthSmileLeft": 0.3,
|
| 1628 |
+
"mouthSmileRight": 0.3
|
| 1629 |
+
}
|
| 1630 |
+
},
|
| 1631 |
+
{
|
| 1632 |
+
"time": 3.7833333333333248,
|
| 1633 |
+
"blendshapes": {
|
| 1634 |
+
"eyeBlinkLeft": 0,
|
| 1635 |
+
"eyeBlinkRight": 0,
|
| 1636 |
+
"mouthSmileLeft": 0.3,
|
| 1637 |
+
"mouthSmileRight": 0.3
|
| 1638 |
+
}
|
| 1639 |
+
},
|
| 1640 |
+
{
|
| 1641 |
+
"time": 3.7999999999999914,
|
| 1642 |
+
"blendshapes": {
|
| 1643 |
+
"eyeBlinkLeft": 0,
|
| 1644 |
+
"eyeBlinkRight": 0,
|
| 1645 |
+
"mouthSmileLeft": 0.3,
|
| 1646 |
+
"mouthSmileRight": 0.3
|
| 1647 |
+
}
|
| 1648 |
+
},
|
| 1649 |
+
{
|
| 1650 |
+
"time": 3.816666666666658,
|
| 1651 |
+
"blendshapes": {
|
| 1652 |
+
"eyeBlinkLeft": 0,
|
| 1653 |
+
"eyeBlinkRight": 0,
|
| 1654 |
+
"mouthSmileLeft": 0.3,
|
| 1655 |
+
"mouthSmileRight": 0.3
|
| 1656 |
+
}
|
| 1657 |
+
},
|
| 1658 |
+
{
|
| 1659 |
+
"time": 3.8333333333333246,
|
| 1660 |
+
"blendshapes": {
|
| 1661 |
+
"eyeBlinkLeft": 0,
|
| 1662 |
+
"eyeBlinkRight": 0,
|
| 1663 |
+
"mouthSmileLeft": 0.3,
|
| 1664 |
+
"mouthSmileRight": 0.3
|
| 1665 |
+
}
|
| 1666 |
+
},
|
| 1667 |
+
{
|
| 1668 |
+
"time": 3.849999999999991,
|
| 1669 |
+
"blendshapes": {
|
| 1670 |
+
"eyeBlinkLeft": 0,
|
| 1671 |
+
"eyeBlinkRight": 0,
|
| 1672 |
+
"mouthSmileLeft": 0.3,
|
| 1673 |
+
"mouthSmileRight": 0.3
|
| 1674 |
+
}
|
| 1675 |
+
},
|
| 1676 |
+
{
|
| 1677 |
+
"time": 3.866666666666658,
|
| 1678 |
+
"blendshapes": {
|
| 1679 |
+
"eyeBlinkLeft": 0,
|
| 1680 |
+
"eyeBlinkRight": 0,
|
| 1681 |
+
"mouthSmileLeft": 0.3,
|
| 1682 |
+
"mouthSmileRight": 0.3
|
| 1683 |
+
}
|
| 1684 |
+
},
|
| 1685 |
+
{
|
| 1686 |
+
"time": 3.8833333333333244,
|
| 1687 |
+
"blendshapes": {
|
| 1688 |
+
"eyeBlinkLeft": 0,
|
| 1689 |
+
"eyeBlinkRight": 0,
|
| 1690 |
+
"mouthSmileLeft": 0.3,
|
| 1691 |
+
"mouthSmileRight": 0.3
|
| 1692 |
+
}
|
| 1693 |
+
},
|
| 1694 |
+
{
|
| 1695 |
+
"time": 3.899999999999991,
|
| 1696 |
+
"blendshapes": {
|
| 1697 |
+
"eyeBlinkLeft": 0,
|
| 1698 |
+
"eyeBlinkRight": 0,
|
| 1699 |
+
"mouthSmileLeft": 0.3,
|
| 1700 |
+
"mouthSmileRight": 0.3
|
| 1701 |
+
}
|
| 1702 |
+
},
|
| 1703 |
+
{
|
| 1704 |
+
"time": 3.9166666666666576,
|
| 1705 |
+
"blendshapes": {
|
| 1706 |
+
"eyeBlinkLeft": 0,
|
| 1707 |
+
"eyeBlinkRight": 0,
|
| 1708 |
+
"mouthSmileLeft": 0.3,
|
| 1709 |
+
"mouthSmileRight": 0.3
|
| 1710 |
+
}
|
| 1711 |
+
},
|
| 1712 |
+
{
|
| 1713 |
+
"time": 3.9333333333333242,
|
| 1714 |
+
"blendshapes": {
|
| 1715 |
+
"eyeBlinkLeft": 0,
|
| 1716 |
+
"eyeBlinkRight": 0,
|
| 1717 |
+
"mouthSmileLeft": 0.3,
|
| 1718 |
+
"mouthSmileRight": 0.3
|
| 1719 |
+
}
|
| 1720 |
+
},
|
| 1721 |
+
{
|
| 1722 |
+
"time": 3.949999999999991,
|
| 1723 |
+
"blendshapes": {
|
| 1724 |
+
"eyeBlinkLeft": 0,
|
| 1725 |
+
"eyeBlinkRight": 0,
|
| 1726 |
+
"mouthSmileLeft": 0.3,
|
| 1727 |
+
"mouthSmileRight": 0.3
|
| 1728 |
+
}
|
| 1729 |
+
},
|
| 1730 |
+
{
|
| 1731 |
+
"time": 3.9666666666666575,
|
| 1732 |
+
"blendshapes": {
|
| 1733 |
+
"eyeBlinkLeft": 0,
|
| 1734 |
+
"eyeBlinkRight": 0,
|
| 1735 |
+
"mouthSmileLeft": 0.3,
|
| 1736 |
+
"mouthSmileRight": 0.3
|
| 1737 |
+
}
|
| 1738 |
+
},
|
| 1739 |
+
{
|
| 1740 |
+
"time": 3.983333333333324,
|
| 1741 |
+
"blendshapes": {
|
| 1742 |
+
"eyeBlinkLeft": 0,
|
| 1743 |
+
"eyeBlinkRight": 0,
|
| 1744 |
+
"mouthSmileLeft": 0.3,
|
| 1745 |
+
"mouthSmileRight": 0.3
|
| 1746 |
+
}
|
| 1747 |
+
},
|
| 1748 |
+
{
|
| 1749 |
+
"time": 3.9999999999999907,
|
| 1750 |
+
"blendshapes": {
|
| 1751 |
+
"eyeBlinkLeft": 0,
|
| 1752 |
+
"eyeBlinkRight": 0,
|
| 1753 |
+
"mouthSmileLeft": 0.3,
|
| 1754 |
+
"mouthSmileRight": 0.3
|
| 1755 |
+
}
|
| 1756 |
+
},
|
| 1757 |
+
{
|
| 1758 |
+
"time": 4.016666666666658,
|
| 1759 |
+
"blendshapes": {
|
| 1760 |
+
"eyeBlinkLeft": 0,
|
| 1761 |
+
"eyeBlinkRight": 0,
|
| 1762 |
+
"mouthSmileLeft": 0.3,
|
| 1763 |
+
"mouthSmileRight": 0.3
|
| 1764 |
+
}
|
| 1765 |
+
},
|
| 1766 |
+
{
|
| 1767 |
+
"time": 4.033333333333324,
|
| 1768 |
+
"blendshapes": {
|
| 1769 |
+
"eyeBlinkLeft": 0,
|
| 1770 |
+
"eyeBlinkRight": 0,
|
| 1771 |
+
"mouthSmileLeft": 0.3,
|
| 1772 |
+
"mouthSmileRight": 0.3
|
| 1773 |
+
}
|
| 1774 |
+
},
|
| 1775 |
+
{
|
| 1776 |
+
"time": 4.049999999999991,
|
| 1777 |
+
"blendshapes": {
|
| 1778 |
+
"eyeBlinkLeft": 0,
|
| 1779 |
+
"eyeBlinkRight": 0,
|
| 1780 |
+
"mouthSmileLeft": 0.3,
|
| 1781 |
+
"mouthSmileRight": 0.3
|
| 1782 |
+
}
|
| 1783 |
+
},
|
| 1784 |
+
{
|
| 1785 |
+
"time": 4.0666666666666575,
|
| 1786 |
+
"blendshapes": {
|
| 1787 |
+
"eyeBlinkLeft": 0,
|
| 1788 |
+
"eyeBlinkRight": 0,
|
| 1789 |
+
"mouthSmileLeft": 0.3,
|
| 1790 |
+
"mouthSmileRight": 0.3
|
| 1791 |
+
}
|
| 1792 |
+
},
|
| 1793 |
+
{
|
| 1794 |
+
"time": 4.083333333333324,
|
| 1795 |
+
"blendshapes": {
|
| 1796 |
+
"eyeBlinkLeft": 0,
|
| 1797 |
+
"eyeBlinkRight": 0,
|
| 1798 |
+
"mouthSmileLeft": 0.3,
|
| 1799 |
+
"mouthSmileRight": 0.3
|
| 1800 |
+
}
|
| 1801 |
+
},
|
| 1802 |
+
{
|
| 1803 |
+
"time": 4.099999999999991,
|
| 1804 |
+
"blendshapes": {
|
| 1805 |
+
"eyeBlinkLeft": 0,
|
| 1806 |
+
"eyeBlinkRight": 0,
|
| 1807 |
+
"mouthSmileLeft": 0.3,
|
| 1808 |
+
"mouthSmileRight": 0.3
|
| 1809 |
+
}
|
| 1810 |
+
},
|
| 1811 |
+
{
|
| 1812 |
+
"time": 4.116666666666657,
|
| 1813 |
+
"blendshapes": {
|
| 1814 |
+
"eyeBlinkLeft": 0.119,
|
| 1815 |
+
"eyeBlinkRight": 0.119,
|
| 1816 |
+
"mouthSmileLeft": 0.3,
|
| 1817 |
+
"mouthSmileRight": 0.3
|
| 1818 |
+
}
|
| 1819 |
+
},
|
| 1820 |
+
{
|
| 1821 |
+
"time": 4.133333333333324,
|
| 1822 |
+
"blendshapes": {
|
| 1823 |
+
"eyeBlinkLeft": 0.283,
|
| 1824 |
+
"eyeBlinkRight": 0.283,
|
| 1825 |
+
"mouthSmileLeft": 0.3,
|
| 1826 |
+
"mouthSmileRight": 0.3
|
| 1827 |
+
}
|
| 1828 |
+
},
|
| 1829 |
+
{
|
| 1830 |
+
"time": 4.149999999999991,
|
| 1831 |
+
"blendshapes": {
|
| 1832 |
+
"eyeBlinkLeft": 0.423,
|
| 1833 |
+
"eyeBlinkRight": 0.423,
|
| 1834 |
+
"mouthSmileLeft": 0.3,
|
| 1835 |
+
"mouthSmileRight": 0.3
|
| 1836 |
+
}
|
| 1837 |
+
},
|
| 1838 |
+
{
|
| 1839 |
+
"time": 4.166666666666657,
|
| 1840 |
+
"blendshapes": {
|
| 1841 |
+
"eyeBlinkLeft": 0.502,
|
| 1842 |
+
"eyeBlinkRight": 0.502,
|
| 1843 |
+
"mouthSmileLeft": 0.3,
|
| 1844 |
+
"mouthSmileRight": 0.3
|
| 1845 |
+
}
|
| 1846 |
+
},
|
| 1847 |
+
{
|
| 1848 |
+
"time": 4.183333333333324,
|
| 1849 |
+
"blendshapes": {
|
| 1850 |
+
"eyeBlinkLeft": 0.464,
|
| 1851 |
+
"eyeBlinkRight": 0.464,
|
| 1852 |
+
"mouthSmileLeft": 0.3,
|
| 1853 |
+
"mouthSmileRight": 0.3
|
| 1854 |
+
}
|
| 1855 |
+
},
|
| 1856 |
+
{
|
| 1857 |
+
"time": 4.19999999999999,
|
| 1858 |
+
"blendshapes": {
|
| 1859 |
+
"eyeBlinkLeft": 0.35,
|
| 1860 |
+
"eyeBlinkRight": 0.35,
|
| 1861 |
+
"mouthSmileLeft": 0.3,
|
| 1862 |
+
"mouthSmileRight": 0.3
|
| 1863 |
+
}
|
| 1864 |
+
},
|
| 1865 |
+
{
|
| 1866 |
+
"time": 4.216666666666657,
|
| 1867 |
+
"blendshapes": {
|
| 1868 |
+
"eyeBlinkLeft": 0.229,
|
| 1869 |
+
"eyeBlinkRight": 0.229,
|
| 1870 |
+
"mouthSmileLeft": 0.3,
|
| 1871 |
+
"mouthSmileRight": 0.3
|
| 1872 |
+
}
|
| 1873 |
+
},
|
| 1874 |
+
{
|
| 1875 |
+
"time": 4.233333333333324,
|
| 1876 |
+
"blendshapes": {
|
| 1877 |
+
"eyeBlinkLeft": 0.142,
|
| 1878 |
+
"eyeBlinkRight": 0.143,
|
| 1879 |
+
"mouthSmileLeft": 0.3,
|
| 1880 |
+
"mouthSmileRight": 0.3
|
| 1881 |
+
}
|
| 1882 |
+
},
|
| 1883 |
+
{
|
| 1884 |
+
"time": 4.24999999999999,
|
| 1885 |
+
"blendshapes": {
|
| 1886 |
+
"eyeBlinkLeft": 0.103,
|
| 1887 |
+
"eyeBlinkRight": 0.103,
|
| 1888 |
+
"mouthSmileLeft": 0.3,
|
| 1889 |
+
"mouthSmileRight": 0.3
|
| 1890 |
+
}
|
| 1891 |
+
},
|
| 1892 |
+
{
|
| 1893 |
+
"time": 4.266666666666657,
|
| 1894 |
+
"blendshapes": {
|
| 1895 |
+
"eyeBlinkLeft": 0.072,
|
| 1896 |
+
"eyeBlinkRight": 0.072,
|
| 1897 |
+
"mouthSmileLeft": 0.3,
|
| 1898 |
+
"mouthSmileRight": 0.3
|
| 1899 |
+
}
|
| 1900 |
+
},
|
| 1901 |
+
{
|
| 1902 |
+
"time": 4.2833333333333234,
|
| 1903 |
+
"blendshapes": {
|
| 1904 |
+
"eyeBlinkLeft": 0.04,
|
| 1905 |
+
"eyeBlinkRight": 0.04,
|
| 1906 |
+
"mouthSmileLeft": 0.3,
|
| 1907 |
+
"mouthSmileRight": 0.3
|
| 1908 |
+
}
|
| 1909 |
+
},
|
| 1910 |
+
{
|
| 1911 |
+
"time": 4.29999999999999,
|
| 1912 |
+
"blendshapes": {
|
| 1913 |
+
"eyeBlinkLeft": 0.022,
|
| 1914 |
+
"eyeBlinkRight": 0.022,
|
| 1915 |
+
"mouthSmileLeft": 0.3,
|
| 1916 |
+
"mouthSmileRight": 0.3
|
| 1917 |
+
}
|
| 1918 |
+
},
|
| 1919 |
+
{
|
| 1920 |
+
"time": 4.316666666666657,
|
| 1921 |
+
"blendshapes": {
|
| 1922 |
+
"eyeBlinkLeft": 0.012,
|
| 1923 |
+
"eyeBlinkRight": 0.012,
|
| 1924 |
+
"mouthSmileLeft": 0.3,
|
| 1925 |
+
"mouthSmileRight": 0.3
|
| 1926 |
+
}
|
| 1927 |
+
},
|
| 1928 |
+
{
|
| 1929 |
+
"time": 4.333333333333323,
|
| 1930 |
+
"blendshapes": {
|
| 1931 |
+
"eyeBlinkLeft": 0.007,
|
| 1932 |
+
"eyeBlinkRight": 0.007,
|
| 1933 |
+
"mouthSmileLeft": 0.3,
|
| 1934 |
+
"mouthSmileRight": 0.3
|
| 1935 |
+
}
|
| 1936 |
+
},
|
| 1937 |
+
{
|
| 1938 |
+
"time": 4.34999999999999,
|
| 1939 |
+
"blendshapes": {
|
| 1940 |
+
"eyeBlinkLeft": 0.005,
|
| 1941 |
+
"eyeBlinkRight": 0.005,
|
| 1942 |
+
"mouthSmileLeft": 0.3,
|
| 1943 |
+
"mouthSmileRight": 0.3
|
| 1944 |
+
}
|
| 1945 |
+
},
|
| 1946 |
+
{
|
| 1947 |
+
"time": 4.3666666666666565,
|
| 1948 |
+
"blendshapes": {
|
| 1949 |
+
"eyeBlinkLeft": 0.003,
|
| 1950 |
+
"eyeBlinkRight": 0.003,
|
| 1951 |
+
"mouthSmileLeft": 0.3,
|
| 1952 |
+
"mouthSmileRight": 0.3
|
| 1953 |
+
}
|
| 1954 |
+
},
|
| 1955 |
+
{
|
| 1956 |
+
"time": 4.383333333333323,
|
| 1957 |
+
"blendshapes": {
|
| 1958 |
+
"eyeBlinkLeft": 0.002,
|
| 1959 |
+
"eyeBlinkRight": 0.002,
|
| 1960 |
+
"mouthSmileLeft": 0.3,
|
| 1961 |
+
"mouthSmileRight": 0.3
|
| 1962 |
+
}
|
| 1963 |
+
},
|
| 1964 |
+
{
|
| 1965 |
+
"time": 4.39999999999999,
|
| 1966 |
+
"blendshapes": {
|
| 1967 |
+
"eyeBlinkLeft": 0.002,
|
| 1968 |
+
"eyeBlinkRight": 0.002,
|
| 1969 |
+
"mouthSmileLeft": 0.3,
|
| 1970 |
+
"mouthSmileRight": 0.3
|
| 1971 |
+
}
|
| 1972 |
+
},
|
| 1973 |
+
{
|
| 1974 |
+
"time": 4.416666666666656,
|
| 1975 |
+
"blendshapes": {
|
| 1976 |
+
"eyeBlinkLeft": 0.001,
|
| 1977 |
+
"eyeBlinkRight": 0.001,
|
| 1978 |
+
"mouthSmileLeft": 0.3,
|
| 1979 |
+
"mouthSmileRight": 0.3
|
| 1980 |
+
}
|
| 1981 |
+
},
|
| 1982 |
+
{
|
| 1983 |
+
"time": 4.433333333333323,
|
| 1984 |
+
"blendshapes": {
|
| 1985 |
+
"eyeBlinkLeft": 0.001,
|
| 1986 |
+
"eyeBlinkRight": 0.001,
|
| 1987 |
+
"mouthSmileLeft": 0.3,
|
| 1988 |
+
"mouthSmileRight": 0.3
|
| 1989 |
+
}
|
| 1990 |
+
},
|
| 1991 |
+
{
|
| 1992 |
+
"time": 4.4499999999999895,
|
| 1993 |
+
"blendshapes": {
|
| 1994 |
+
"eyeBlinkLeft": 0.001,
|
| 1995 |
+
"eyeBlinkRight": 0.001,
|
| 1996 |
+
"mouthSmileLeft": 0.3,
|
| 1997 |
+
"mouthSmileRight": 0.3
|
| 1998 |
+
}
|
| 1999 |
+
},
|
| 2000 |
+
{
|
| 2001 |
+
"time": 4.466666666666656,
|
| 2002 |
+
"blendshapes": {
|
| 2003 |
+
"eyeBlinkLeft": 0.001,
|
| 2004 |
+
"eyeBlinkRight": 0.001,
|
| 2005 |
+
"mouthSmileLeft": 0.3,
|
| 2006 |
+
"mouthSmileRight": 0.3
|
| 2007 |
+
}
|
| 2008 |
+
},
|
| 2009 |
+
{
|
| 2010 |
+
"time": 4.483333333333323,
|
| 2011 |
+
"blendshapes": {
|
| 2012 |
+
"eyeBlinkLeft": 0.001,
|
| 2013 |
+
"eyeBlinkRight": 0.001,
|
| 2014 |
+
"mouthSmileLeft": 0.3,
|
| 2015 |
+
"mouthSmileRight": 0.3
|
| 2016 |
+
}
|
| 2017 |
+
},
|
| 2018 |
+
{
|
| 2019 |
+
"time": 4.499999999999989,
|
| 2020 |
+
"blendshapes": {
|
| 2021 |
+
"eyeBlinkLeft": 0.001,
|
| 2022 |
+
"eyeBlinkRight": 0.001,
|
| 2023 |
+
"mouthSmileLeft": 0.3,
|
| 2024 |
+
"mouthSmileRight": 0.3
|
| 2025 |
+
}
|
| 2026 |
+
},
|
| 2027 |
+
{
|
| 2028 |
+
"time": 4.516666666666656,
|
| 2029 |
+
"blendshapes": {
|
| 2030 |
+
"eyeBlinkLeft": 0.001,
|
| 2031 |
+
"eyeBlinkRight": 0.001,
|
| 2032 |
+
"mouthSmileLeft": 0.3,
|
| 2033 |
+
"mouthSmileRight": 0.3
|
| 2034 |
+
}
|
| 2035 |
+
},
|
| 2036 |
+
{
|
| 2037 |
+
"time": 4.533333333333323,
|
| 2038 |
+
"blendshapes": {
|
| 2039 |
+
"eyeBlinkLeft": 0.001,
|
| 2040 |
+
"eyeBlinkRight": 0.001,
|
| 2041 |
+
"mouthSmileLeft": 0.3,
|
| 2042 |
+
"mouthSmileRight": 0.3
|
| 2043 |
+
}
|
| 2044 |
+
},
|
| 2045 |
+
{
|
| 2046 |
+
"time": 4.549999999999989,
|
| 2047 |
+
"blendshapes": {
|
| 2048 |
+
"eyeBlinkLeft": 0.001,
|
| 2049 |
+
"eyeBlinkRight": 0.001,
|
| 2050 |
+
"mouthSmileLeft": 0.3,
|
| 2051 |
+
"mouthSmileRight": 0.3
|
| 2052 |
+
}
|
| 2053 |
+
},
|
| 2054 |
+
{
|
| 2055 |
+
"time": 4.566666666666656,
|
| 2056 |
+
"blendshapes": {
|
| 2057 |
+
"eyeBlinkLeft": 0.001,
|
| 2058 |
+
"eyeBlinkRight": 0.001,
|
| 2059 |
+
"mouthSmileLeft": 0.3,
|
| 2060 |
+
"mouthSmileRight": 0.3
|
| 2061 |
+
}
|
| 2062 |
+
},
|
| 2063 |
+
{
|
| 2064 |
+
"time": 4.583333333333322,
|
| 2065 |
+
"blendshapes": {
|
| 2066 |
+
"eyeBlinkLeft": 0.001,
|
| 2067 |
+
"eyeBlinkRight": 0.001,
|
| 2068 |
+
"mouthSmileLeft": 0.3,
|
| 2069 |
+
"mouthSmileRight": 0.3
|
| 2070 |
+
}
|
| 2071 |
+
},
|
| 2072 |
+
{
|
| 2073 |
+
"time": 4.599999999999989,
|
| 2074 |
+
"blendshapes": {
|
| 2075 |
+
"eyeBlinkLeft": 0.001,
|
| 2076 |
+
"eyeBlinkRight": 0.001,
|
| 2077 |
+
"mouthSmileLeft": 0.3,
|
| 2078 |
+
"mouthSmileRight": 0.3
|
| 2079 |
+
}
|
| 2080 |
+
},
|
| 2081 |
+
{
|
| 2082 |
+
"time": 4.616666666666656,
|
| 2083 |
+
"blendshapes": {
|
| 2084 |
+
"eyeBlinkLeft": 0,
|
| 2085 |
+
"eyeBlinkRight": 0,
|
| 2086 |
+
"mouthSmileLeft": 0.3,
|
| 2087 |
+
"mouthSmileRight": 0.3
|
| 2088 |
+
}
|
| 2089 |
+
},
|
| 2090 |
+
{
|
| 2091 |
+
"time": 4.633333333333322,
|
| 2092 |
+
"blendshapes": {
|
| 2093 |
+
"eyeBlinkLeft": 0,
|
| 2094 |
+
"eyeBlinkRight": 0,
|
| 2095 |
+
"mouthSmileLeft": 0.3,
|
| 2096 |
+
"mouthSmileRight": 0.3
|
| 2097 |
+
}
|
| 2098 |
+
},
|
| 2099 |
+
{
|
| 2100 |
+
"time": 4.649999999999989,
|
| 2101 |
+
"blendshapes": {
|
| 2102 |
+
"eyeBlinkLeft": 0,
|
| 2103 |
+
"eyeBlinkRight": 0,
|
| 2104 |
+
"mouthSmileLeft": 0.3,
|
| 2105 |
+
"mouthSmileRight": 0.3
|
| 2106 |
+
}
|
| 2107 |
+
},
|
| 2108 |
+
{
|
| 2109 |
+
"time": 4.666666666666655,
|
| 2110 |
+
"blendshapes": {
|
| 2111 |
+
"eyeBlinkLeft": 0,
|
| 2112 |
+
"eyeBlinkRight": 0,
|
| 2113 |
+
"mouthSmileLeft": 0.3,
|
| 2114 |
+
"mouthSmileRight": 0.3
|
| 2115 |
+
}
|
| 2116 |
+
},
|
| 2117 |
+
{
|
| 2118 |
+
"time": 4.683333333333322,
|
| 2119 |
+
"blendshapes": {
|
| 2120 |
+
"eyeBlinkLeft": 0,
|
| 2121 |
+
"eyeBlinkRight": 0,
|
| 2122 |
+
"mouthSmileLeft": 0.3,
|
| 2123 |
+
"mouthSmileRight": 0.3
|
| 2124 |
+
}
|
| 2125 |
+
},
|
| 2126 |
+
{
|
| 2127 |
+
"time": 4.699999999999989,
|
| 2128 |
+
"blendshapes": {
|
| 2129 |
+
"eyeBlinkLeft": 0,
|
| 2130 |
+
"eyeBlinkRight": 0,
|
| 2131 |
+
"mouthSmileLeft": 0.3,
|
| 2132 |
+
"mouthSmileRight": 0.3
|
| 2133 |
+
}
|
| 2134 |
+
},
|
| 2135 |
+
{
|
| 2136 |
+
"time": 4.716666666666655,
|
| 2137 |
+
"blendshapes": {
|
| 2138 |
+
"eyeBlinkLeft": 0,
|
| 2139 |
+
"eyeBlinkRight": 0,
|
| 2140 |
+
"mouthSmileLeft": 0.3,
|
| 2141 |
+
"mouthSmileRight": 0.3
|
| 2142 |
+
}
|
| 2143 |
+
},
|
| 2144 |
+
{
|
| 2145 |
+
"time": 4.733333333333322,
|
| 2146 |
+
"blendshapes": {
|
| 2147 |
+
"eyeBlinkLeft": 0,
|
| 2148 |
+
"eyeBlinkRight": 0,
|
| 2149 |
+
"mouthSmileLeft": 0.3,
|
| 2150 |
+
"mouthSmileRight": 0.3
|
| 2151 |
+
}
|
| 2152 |
+
},
|
| 2153 |
+
{
|
| 2154 |
+
"time": 4.7499999999999885,
|
| 2155 |
+
"blendshapes": {
|
| 2156 |
+
"eyeBlinkLeft": 0,
|
| 2157 |
+
"eyeBlinkRight": 0,
|
| 2158 |
+
"mouthSmileLeft": 0.3,
|
| 2159 |
+
"mouthSmileRight": 0.3
|
| 2160 |
+
}
|
| 2161 |
+
},
|
| 2162 |
+
{
|
| 2163 |
+
"time": 4.766666666666655,
|
| 2164 |
+
"blendshapes": {
|
| 2165 |
+
"eyeBlinkLeft": 0,
|
| 2166 |
+
"eyeBlinkRight": 0,
|
| 2167 |
+
"mouthSmileLeft": 0.3,
|
| 2168 |
+
"mouthSmileRight": 0.3
|
| 2169 |
+
}
|
| 2170 |
+
},
|
| 2171 |
+
{
|
| 2172 |
+
"time": 4.783333333333322,
|
| 2173 |
+
"blendshapes": {
|
| 2174 |
+
"eyeBlinkLeft": 0,
|
| 2175 |
+
"eyeBlinkRight": 0,
|
| 2176 |
+
"mouthSmileLeft": 0.3,
|
| 2177 |
+
"mouthSmileRight": 0.3
|
| 2178 |
+
}
|
| 2179 |
+
},
|
| 2180 |
+
{
|
| 2181 |
+
"time": 4.799999999999988,
|
| 2182 |
+
"blendshapes": {
|
| 2183 |
+
"eyeBlinkLeft": 0,
|
| 2184 |
+
"eyeBlinkRight": 0,
|
| 2185 |
+
"mouthSmileLeft": 0.3,
|
| 2186 |
+
"mouthSmileRight": 0.3
|
| 2187 |
+
}
|
| 2188 |
+
},
|
| 2189 |
+
{
|
| 2190 |
+
"time": 4.816666666666655,
|
| 2191 |
+
"blendshapes": {
|
| 2192 |
+
"eyeBlinkLeft": 0,
|
| 2193 |
+
"eyeBlinkRight": 0,
|
| 2194 |
+
"mouthSmileLeft": 0.3,
|
| 2195 |
+
"mouthSmileRight": 0.3
|
| 2196 |
+
}
|
| 2197 |
+
},
|
| 2198 |
+
{
|
| 2199 |
+
"time": 4.8333333333333215,
|
| 2200 |
+
"blendshapes": {
|
| 2201 |
+
"eyeBlinkLeft": 0,
|
| 2202 |
+
"eyeBlinkRight": 0,
|
| 2203 |
+
"mouthSmileLeft": 0.3,
|
| 2204 |
+
"mouthSmileRight": 0.3
|
| 2205 |
+
}
|
| 2206 |
+
},
|
| 2207 |
+
{
|
| 2208 |
+
"time": 4.849999999999988,
|
| 2209 |
+
"blendshapes": {
|
| 2210 |
+
"eyeBlinkLeft": 0,
|
| 2211 |
+
"eyeBlinkRight": 0,
|
| 2212 |
+
"mouthSmileLeft": 0.3,
|
| 2213 |
+
"mouthSmileRight": 0.3
|
| 2214 |
+
}
|
| 2215 |
+
},
|
| 2216 |
+
{
|
| 2217 |
+
"time": 4.866666666666655,
|
| 2218 |
+
"blendshapes": {
|
| 2219 |
+
"eyeBlinkLeft": 0,
|
| 2220 |
+
"eyeBlinkRight": 0,
|
| 2221 |
+
"mouthSmileLeft": 0.3,
|
| 2222 |
+
"mouthSmileRight": 0.3
|
| 2223 |
+
}
|
| 2224 |
+
},
|
| 2225 |
+
{
|
| 2226 |
+
"time": 4.883333333333321,
|
| 2227 |
+
"blendshapes": {
|
| 2228 |
+
"eyeBlinkLeft": 0,
|
| 2229 |
+
"eyeBlinkRight": 0,
|
| 2230 |
+
"mouthSmileLeft": 0.3,
|
| 2231 |
+
"mouthSmileRight": 0.3
|
| 2232 |
+
}
|
| 2233 |
+
},
|
| 2234 |
+
{
|
| 2235 |
+
"time": 4.899999999999988,
|
| 2236 |
+
"blendshapes": {
|
| 2237 |
+
"eyeBlinkLeft": 0,
|
| 2238 |
+
"eyeBlinkRight": 0,
|
| 2239 |
+
"mouthSmileLeft": 0.3,
|
| 2240 |
+
"mouthSmileRight": 0.3
|
| 2241 |
+
}
|
| 2242 |
+
},
|
| 2243 |
+
{
|
| 2244 |
+
"time": 4.9166666666666545,
|
| 2245 |
+
"blendshapes": {
|
| 2246 |
+
"eyeBlinkLeft": 0,
|
| 2247 |
+
"eyeBlinkRight": 0,
|
| 2248 |
+
"mouthSmileLeft": 0.3,
|
| 2249 |
+
"mouthSmileRight": 0.3
|
| 2250 |
+
}
|
| 2251 |
+
},
|
| 2252 |
+
{
|
| 2253 |
+
"time": 4.933333333333321,
|
| 2254 |
+
"blendshapes": {
|
| 2255 |
+
"eyeBlinkLeft": 0,
|
| 2256 |
+
"eyeBlinkRight": 0,
|
| 2257 |
+
"mouthSmileLeft": 0.3,
|
| 2258 |
+
"mouthSmileRight": 0.3
|
| 2259 |
+
}
|
| 2260 |
+
},
|
| 2261 |
+
{
|
| 2262 |
+
"time": 4.949999999999988,
|
| 2263 |
+
"blendshapes": {
|
| 2264 |
+
"eyeBlinkLeft": 0,
|
| 2265 |
+
"eyeBlinkRight": 0,
|
| 2266 |
+
"mouthSmileLeft": 0.3,
|
| 2267 |
+
"mouthSmileRight": 0.3
|
| 2268 |
+
}
|
| 2269 |
+
},
|
| 2270 |
+
{
|
| 2271 |
+
"time": 4.966666666666654,
|
| 2272 |
+
"blendshapes": {
|
| 2273 |
+
"eyeBlinkLeft": 0,
|
| 2274 |
+
"eyeBlinkRight": 0,
|
| 2275 |
+
"mouthSmileLeft": 0.3,
|
| 2276 |
+
"mouthSmileRight": 0.3
|
| 2277 |
+
}
|
| 2278 |
+
},
|
| 2279 |
+
{
|
| 2280 |
+
"time": 4.983333333333321,
|
| 2281 |
+
"blendshapes": {
|
| 2282 |
+
"eyeBlinkLeft": 0,
|
| 2283 |
+
"eyeBlinkRight": 0,
|
| 2284 |
+
"mouthSmileLeft": 0.3,
|
| 2285 |
+
"mouthSmileRight": 0.3
|
| 2286 |
+
}
|
| 2287 |
+
},
|
| 2288 |
+
{
|
| 2289 |
+
"time": 4.999999999999988,
|
| 2290 |
+
"blendshapes": {
|
| 2291 |
+
"eyeBlinkLeft": 0,
|
| 2292 |
+
"eyeBlinkRight": 0,
|
| 2293 |
+
"mouthSmileLeft": 0.3,
|
| 2294 |
+
"mouthSmileRight": 0.3
|
| 2295 |
+
}
|
| 2296 |
+
},
|
| 2297 |
+
{
|
| 2298 |
+
"time": 5.016666666666654,
|
| 2299 |
+
"blendshapes": {
|
| 2300 |
+
"eyeBlinkLeft": 0,
|
| 2301 |
+
"eyeBlinkRight": 0,
|
| 2302 |
+
"mouthSmileLeft": 0.3,
|
| 2303 |
+
"mouthSmileRight": 0.3
|
| 2304 |
+
}
|
| 2305 |
+
},
|
| 2306 |
+
{
|
| 2307 |
+
"time": 5.033333333333321,
|
| 2308 |
+
"blendshapes": {
|
| 2309 |
+
"eyeBlinkLeft": 0,
|
| 2310 |
+
"eyeBlinkRight": 0,
|
| 2311 |
+
"mouthSmileLeft": 0.3,
|
| 2312 |
+
"mouthSmileRight": 0.3
|
| 2313 |
+
}
|
| 2314 |
+
},
|
| 2315 |
+
{
|
| 2316 |
+
"time": 5.049999999999987,
|
| 2317 |
+
"blendshapes": {
|
| 2318 |
+
"eyeBlinkLeft": 0,
|
| 2319 |
+
"eyeBlinkRight": 0,
|
| 2320 |
+
"mouthSmileLeft": 0.3,
|
| 2321 |
+
"mouthSmileRight": 0.3
|
| 2322 |
+
}
|
| 2323 |
+
},
|
| 2324 |
+
{
|
| 2325 |
+
"time": 5.066666666666654,
|
| 2326 |
+
"blendshapes": {
|
| 2327 |
+
"eyeBlinkLeft": 0,
|
| 2328 |
+
"eyeBlinkRight": 0,
|
| 2329 |
+
"mouthSmileLeft": 0.3,
|
| 2330 |
+
"mouthSmileRight": 0.3
|
| 2331 |
+
}
|
| 2332 |
+
},
|
| 2333 |
+
{
|
| 2334 |
+
"time": 5.083333333333321,
|
| 2335 |
+
"blendshapes": {
|
| 2336 |
+
"eyeBlinkLeft": 0,
|
| 2337 |
+
"eyeBlinkRight": 0,
|
| 2338 |
+
"mouthSmileLeft": 0.3,
|
| 2339 |
+
"mouthSmileRight": 0.3
|
| 2340 |
+
}
|
| 2341 |
+
},
|
| 2342 |
+
{
|
| 2343 |
+
"time": 5.099999999999987,
|
| 2344 |
+
"blendshapes": {
|
| 2345 |
+
"eyeBlinkLeft": 0,
|
| 2346 |
+
"eyeBlinkRight": 0,
|
| 2347 |
+
"mouthSmileLeft": 0.3,
|
| 2348 |
+
"mouthSmileRight": 0.3
|
| 2349 |
+
}
|
| 2350 |
+
},
|
| 2351 |
+
{
|
| 2352 |
+
"time": 5.116666666666654,
|
| 2353 |
+
"blendshapes": {
|
| 2354 |
+
"eyeBlinkLeft": 0,
|
| 2355 |
+
"eyeBlinkRight": 0,
|
| 2356 |
+
"mouthSmileLeft": 0.3,
|
| 2357 |
+
"mouthSmileRight": 0.3
|
| 2358 |
+
}
|
| 2359 |
+
},
|
| 2360 |
+
{
|
| 2361 |
+
"time": 5.13333333333332,
|
| 2362 |
+
"blendshapes": {
|
| 2363 |
+
"eyeBlinkLeft": 0,
|
| 2364 |
+
"eyeBlinkRight": 0,
|
| 2365 |
+
"mouthSmileLeft": 0.3,
|
| 2366 |
+
"mouthSmileRight": 0.3
|
| 2367 |
+
}
|
| 2368 |
+
},
|
| 2369 |
+
{
|
| 2370 |
+
"time": 5.149999999999987,
|
| 2371 |
+
"blendshapes": {
|
| 2372 |
+
"eyeBlinkLeft": 0,
|
| 2373 |
+
"eyeBlinkRight": 0,
|
| 2374 |
+
"mouthSmileLeft": 0.3,
|
| 2375 |
+
"mouthSmileRight": 0.3
|
| 2376 |
+
}
|
| 2377 |
+
},
|
| 2378 |
+
{
|
| 2379 |
+
"time": 5.166666666666654,
|
| 2380 |
+
"blendshapes": {
|
| 2381 |
+
"eyeBlinkLeft": 0,
|
| 2382 |
+
"eyeBlinkRight": 0,
|
| 2383 |
+
"mouthSmileLeft": 0.3,
|
| 2384 |
+
"mouthSmileRight": 0.3
|
| 2385 |
+
}
|
| 2386 |
+
},
|
| 2387 |
+
{
|
| 2388 |
+
"time": 5.18333333333332,
|
| 2389 |
+
"blendshapes": {
|
| 2390 |
+
"eyeBlinkLeft": 0,
|
| 2391 |
+
"eyeBlinkRight": 0,
|
| 2392 |
+
"mouthSmileLeft": 0.3,
|
| 2393 |
+
"mouthSmileRight": 0.3
|
| 2394 |
+
}
|
| 2395 |
+
},
|
| 2396 |
+
{
|
| 2397 |
+
"time": 5.199999999999987,
|
| 2398 |
+
"blendshapes": {
|
| 2399 |
+
"eyeBlinkLeft": 0,
|
| 2400 |
+
"eyeBlinkRight": 0,
|
| 2401 |
+
"mouthSmileLeft": 0.3,
|
| 2402 |
+
"mouthSmileRight": 0.3
|
| 2403 |
+
}
|
| 2404 |
+
},
|
| 2405 |
+
{
|
| 2406 |
+
"time": 5.2166666666666535,
|
| 2407 |
+
"blendshapes": {
|
| 2408 |
+
"eyeBlinkLeft": 0,
|
| 2409 |
+
"eyeBlinkRight": 0,
|
| 2410 |
+
"mouthSmileLeft": 0.3,
|
| 2411 |
+
"mouthSmileRight": 0.3
|
| 2412 |
+
}
|
| 2413 |
+
},
|
| 2414 |
+
{
|
| 2415 |
+
"time": 5.23333333333332,
|
| 2416 |
+
"blendshapes": {
|
| 2417 |
+
"eyeBlinkLeft": 0,
|
| 2418 |
+
"eyeBlinkRight": 0,
|
| 2419 |
+
"mouthSmileLeft": 0.3,
|
| 2420 |
+
"mouthSmileRight": 0.3
|
| 2421 |
+
}
|
| 2422 |
+
},
|
| 2423 |
+
{
|
| 2424 |
+
"time": 5.249999999999987,
|
| 2425 |
+
"blendshapes": {
|
| 2426 |
+
"eyeBlinkLeft": 0,
|
| 2427 |
+
"eyeBlinkRight": 0,
|
| 2428 |
+
"mouthSmileLeft": 0.3,
|
| 2429 |
+
"mouthSmileRight": 0.3
|
| 2430 |
+
}
|
| 2431 |
+
},
|
| 2432 |
+
{
|
| 2433 |
+
"time": 5.266666666666653,
|
| 2434 |
+
"blendshapes": {
|
| 2435 |
+
"eyeBlinkLeft": 0,
|
| 2436 |
+
"eyeBlinkRight": 0,
|
| 2437 |
+
"mouthSmileLeft": 0.3,
|
| 2438 |
+
"mouthSmileRight": 0.3
|
| 2439 |
+
}
|
| 2440 |
+
},
|
| 2441 |
+
{
|
| 2442 |
+
"time": 5.28333333333332,
|
| 2443 |
+
"blendshapes": {
|
| 2444 |
+
"eyeBlinkLeft": 0,
|
| 2445 |
+
"eyeBlinkRight": 0,
|
| 2446 |
+
"mouthSmileLeft": 0.3,
|
| 2447 |
+
"mouthSmileRight": 0.3
|
| 2448 |
+
}
|
| 2449 |
+
},
|
| 2450 |
+
{
|
| 2451 |
+
"time": 5.2999999999999865,
|
| 2452 |
+
"blendshapes": {
|
| 2453 |
+
"eyeBlinkLeft": 0,
|
| 2454 |
+
"eyeBlinkRight": 0,
|
| 2455 |
+
"mouthSmileLeft": 0.3,
|
| 2456 |
+
"mouthSmileRight": 0.3
|
| 2457 |
+
}
|
| 2458 |
+
},
|
| 2459 |
+
{
|
| 2460 |
+
"time": 5.316666666666653,
|
| 2461 |
+
"blendshapes": {
|
| 2462 |
+
"eyeBlinkLeft": 0,
|
| 2463 |
+
"eyeBlinkRight": 0,
|
| 2464 |
+
"mouthSmileLeft": 0.3,
|
| 2465 |
+
"mouthSmileRight": 0.3
|
| 2466 |
+
}
|
| 2467 |
+
},
|
| 2468 |
+
{
|
| 2469 |
+
"time": 5.33333333333332,
|
| 2470 |
+
"blendshapes": {
|
| 2471 |
+
"eyeBlinkLeft": 0,
|
| 2472 |
+
"eyeBlinkRight": 0,
|
| 2473 |
+
"mouthSmileLeft": 0.3,
|
| 2474 |
+
"mouthSmileRight": 0.3
|
| 2475 |
+
}
|
| 2476 |
+
},
|
| 2477 |
+
{
|
| 2478 |
+
"time": 5.349999999999986,
|
| 2479 |
+
"blendshapes": {
|
| 2480 |
+
"eyeBlinkLeft": 0,
|
| 2481 |
+
"eyeBlinkRight": 0,
|
| 2482 |
+
"mouthSmileLeft": 0.3,
|
| 2483 |
+
"mouthSmileRight": 0.3
|
| 2484 |
+
}
|
| 2485 |
+
},
|
| 2486 |
+
{
|
| 2487 |
+
"time": 5.366666666666653,
|
| 2488 |
+
"blendshapes": {
|
| 2489 |
+
"eyeBlinkLeft": 0,
|
| 2490 |
+
"eyeBlinkRight": 0,
|
| 2491 |
+
"mouthSmileLeft": 0.3,
|
| 2492 |
+
"mouthSmileRight": 0.3
|
| 2493 |
+
}
|
| 2494 |
+
},
|
| 2495 |
+
{
|
| 2496 |
+
"time": 5.3833333333333195,
|
| 2497 |
+
"blendshapes": {
|
| 2498 |
+
"eyeBlinkLeft": 0,
|
| 2499 |
+
"eyeBlinkRight": 0,
|
| 2500 |
+
"mouthSmileLeft": 0.3,
|
| 2501 |
+
"mouthSmileRight": 0.3
|
| 2502 |
+
}
|
| 2503 |
+
},
|
| 2504 |
+
{
|
| 2505 |
+
"time": 5.399999999999986,
|
| 2506 |
+
"blendshapes": {
|
| 2507 |
+
"eyeBlinkLeft": 0,
|
| 2508 |
+
"eyeBlinkRight": 0,
|
| 2509 |
+
"mouthSmileLeft": 0.3,
|
| 2510 |
+
"mouthSmileRight": 0.3
|
| 2511 |
+
}
|
| 2512 |
+
},
|
| 2513 |
+
{
|
| 2514 |
+
"time": 5.416666666666653,
|
| 2515 |
+
"blendshapes": {
|
| 2516 |
+
"eyeBlinkLeft": 0,
|
| 2517 |
+
"eyeBlinkRight": 0,
|
| 2518 |
+
"mouthSmileLeft": 0.3,
|
| 2519 |
+
"mouthSmileRight": 0.3
|
| 2520 |
+
}
|
| 2521 |
+
},
|
| 2522 |
+
{
|
| 2523 |
+
"time": 5.433333333333319,
|
| 2524 |
+
"blendshapes": {
|
| 2525 |
+
"eyeBlinkLeft": 0,
|
| 2526 |
+
"eyeBlinkRight": 0,
|
| 2527 |
+
"mouthSmileLeft": 0.3,
|
| 2528 |
+
"mouthSmileRight": 0.3
|
| 2529 |
+
}
|
| 2530 |
+
},
|
| 2531 |
+
{
|
| 2532 |
+
"time": 5.449999999999986,
|
| 2533 |
+
"blendshapes": {
|
| 2534 |
+
"eyeBlinkLeft": 0,
|
| 2535 |
+
"eyeBlinkRight": 0,
|
| 2536 |
+
"mouthSmileLeft": 0.3,
|
| 2537 |
+
"mouthSmileRight": 0.3
|
| 2538 |
+
}
|
| 2539 |
+
},
|
| 2540 |
+
{
|
| 2541 |
+
"time": 5.466666666666653,
|
| 2542 |
+
"blendshapes": {
|
| 2543 |
+
"eyeBlinkLeft": 0,
|
| 2544 |
+
"eyeBlinkRight": 0,
|
| 2545 |
+
"mouthSmileLeft": 0.3,
|
| 2546 |
+
"mouthSmileRight": 0.3
|
| 2547 |
+
}
|
| 2548 |
+
},
|
| 2549 |
+
{
|
| 2550 |
+
"time": 5.483333333333319,
|
| 2551 |
+
"blendshapes": {
|
| 2552 |
+
"eyeBlinkLeft": 0,
|
| 2553 |
+
"eyeBlinkRight": 0,
|
| 2554 |
+
"mouthSmileLeft": 0.3,
|
| 2555 |
+
"mouthSmileRight": 0.3
|
| 2556 |
+
}
|
| 2557 |
+
},
|
| 2558 |
+
{
|
| 2559 |
+
"time": 5.499999999999986,
|
| 2560 |
+
"blendshapes": {
|
| 2561 |
+
"eyeBlinkLeft": 0,
|
| 2562 |
+
"eyeBlinkRight": 0,
|
| 2563 |
+
"mouthSmileLeft": 0.3,
|
| 2564 |
+
"mouthSmileRight": 0.3
|
| 2565 |
+
}
|
| 2566 |
+
},
|
| 2567 |
+
{
|
| 2568 |
+
"time": 5.516666666666652,
|
| 2569 |
+
"blendshapes": {
|
| 2570 |
+
"eyeBlinkLeft": 0,
|
| 2571 |
+
"eyeBlinkRight": 0,
|
| 2572 |
+
"mouthSmileLeft": 0.3,
|
| 2573 |
+
"mouthSmileRight": 0.3
|
| 2574 |
+
}
|
| 2575 |
+
},
|
| 2576 |
+
{
|
| 2577 |
+
"time": 5.533333333333319,
|
| 2578 |
+
"blendshapes": {
|
| 2579 |
+
"eyeBlinkLeft": 0,
|
| 2580 |
+
"eyeBlinkRight": 0,
|
| 2581 |
+
"mouthSmileLeft": 0.3,
|
| 2582 |
+
"mouthSmileRight": 0.3
|
| 2583 |
+
}
|
| 2584 |
+
},
|
| 2585 |
+
{
|
| 2586 |
+
"time": 5.549999999999986,
|
| 2587 |
+
"blendshapes": {
|
| 2588 |
+
"eyeBlinkLeft": 0,
|
| 2589 |
+
"eyeBlinkRight": 0,
|
| 2590 |
+
"mouthSmileLeft": 0.3,
|
| 2591 |
+
"mouthSmileRight": 0.3
|
| 2592 |
+
}
|
| 2593 |
+
},
|
| 2594 |
+
{
|
| 2595 |
+
"time": 5.566666666666652,
|
| 2596 |
+
"blendshapes": {
|
| 2597 |
+
"eyeBlinkLeft": 0,
|
| 2598 |
+
"eyeBlinkRight": 0,
|
| 2599 |
+
"mouthSmileLeft": 0.3,
|
| 2600 |
+
"mouthSmileRight": 0.3
|
| 2601 |
+
}
|
| 2602 |
+
},
|
| 2603 |
+
{
|
| 2604 |
+
"time": 5.583333333333319,
|
| 2605 |
+
"blendshapes": {
|
| 2606 |
+
"eyeBlinkLeft": 0,
|
| 2607 |
+
"eyeBlinkRight": 0,
|
| 2608 |
+
"mouthSmileLeft": 0.3,
|
| 2609 |
+
"mouthSmileRight": 0.3
|
| 2610 |
+
}
|
| 2611 |
+
},
|
| 2612 |
+
{
|
| 2613 |
+
"time": 5.599999999999985,
|
| 2614 |
+
"blendshapes": {
|
| 2615 |
+
"eyeBlinkLeft": 0,
|
| 2616 |
+
"eyeBlinkRight": 0,
|
| 2617 |
+
"mouthSmileLeft": 0.3,
|
| 2618 |
+
"mouthSmileRight": 0.3
|
| 2619 |
+
}
|
| 2620 |
+
},
|
| 2621 |
+
{
|
| 2622 |
+
"time": 5.616666666666652,
|
| 2623 |
+
"blendshapes": {
|
| 2624 |
+
"eyeBlinkLeft": 0,
|
| 2625 |
+
"eyeBlinkRight": 0,
|
| 2626 |
+
"mouthSmileLeft": 0.3,
|
| 2627 |
+
"mouthSmileRight": 0.3
|
| 2628 |
+
}
|
| 2629 |
+
},
|
| 2630 |
+
{
|
| 2631 |
+
"time": 5.633333333333319,
|
| 2632 |
+
"blendshapes": {
|
| 2633 |
+
"eyeBlinkLeft": 0,
|
| 2634 |
+
"eyeBlinkRight": 0,
|
| 2635 |
+
"mouthSmileLeft": 0.3,
|
| 2636 |
+
"mouthSmileRight": 0.3
|
| 2637 |
+
}
|
| 2638 |
+
},
|
| 2639 |
+
{
|
| 2640 |
+
"time": 5.649999999999985,
|
| 2641 |
+
"blendshapes": {
|
| 2642 |
+
"eyeBlinkLeft": 0,
|
| 2643 |
+
"eyeBlinkRight": 0,
|
| 2644 |
+
"mouthSmileLeft": 0.3,
|
| 2645 |
+
"mouthSmileRight": 0.3
|
| 2646 |
+
}
|
| 2647 |
+
},
|
| 2648 |
+
{
|
| 2649 |
+
"time": 5.666666666666652,
|
| 2650 |
+
"blendshapes": {
|
| 2651 |
+
"eyeBlinkLeft": 0,
|
| 2652 |
+
"eyeBlinkRight": 0,
|
| 2653 |
+
"mouthSmileLeft": 0.3,
|
| 2654 |
+
"mouthSmileRight": 0.3
|
| 2655 |
+
}
|
| 2656 |
+
},
|
| 2657 |
+
{
|
| 2658 |
+
"time": 5.6833333333333185,
|
| 2659 |
+
"blendshapes": {
|
| 2660 |
+
"eyeBlinkLeft": 0,
|
| 2661 |
+
"eyeBlinkRight": 0,
|
| 2662 |
+
"mouthSmileLeft": 0.3,
|
| 2663 |
+
"mouthSmileRight": 0.3
|
| 2664 |
+
}
|
| 2665 |
+
},
|
| 2666 |
+
{
|
| 2667 |
+
"time": 5.699999999999985,
|
| 2668 |
+
"blendshapes": {
|
| 2669 |
+
"eyeBlinkLeft": 0,
|
| 2670 |
+
"eyeBlinkRight": 0,
|
| 2671 |
+
"mouthSmileLeft": 0.3,
|
| 2672 |
+
"mouthSmileRight": 0.3
|
| 2673 |
+
}
|
| 2674 |
+
},
|
| 2675 |
+
{
|
| 2676 |
+
"time": 5.716666666666652,
|
| 2677 |
+
"blendshapes": {
|
| 2678 |
+
"eyeBlinkLeft": 0,
|
| 2679 |
+
"eyeBlinkRight": 0,
|
| 2680 |
+
"mouthSmileLeft": 0.3,
|
| 2681 |
+
"mouthSmileRight": 0.3
|
| 2682 |
+
}
|
| 2683 |
+
},
|
| 2684 |
+
{
|
| 2685 |
+
"time": 5.733333333333318,
|
| 2686 |
+
"blendshapes": {
|
| 2687 |
+
"eyeBlinkLeft": 0,
|
| 2688 |
+
"eyeBlinkRight": 0,
|
| 2689 |
+
"mouthSmileLeft": 0.3,
|
| 2690 |
+
"mouthSmileRight": 0.3
|
| 2691 |
+
}
|
| 2692 |
+
},
|
| 2693 |
+
{
|
| 2694 |
+
"time": 5.749999999999985,
|
| 2695 |
+
"blendshapes": {
|
| 2696 |
+
"eyeBlinkLeft": 0,
|
| 2697 |
+
"eyeBlinkRight": 0,
|
| 2698 |
+
"mouthSmileLeft": 0.3,
|
| 2699 |
+
"mouthSmileRight": 0.3
|
| 2700 |
+
}
|
| 2701 |
+
},
|
| 2702 |
+
{
|
| 2703 |
+
"time": 5.7666666666666515,
|
| 2704 |
+
"blendshapes": {
|
| 2705 |
+
"eyeBlinkLeft": 0,
|
| 2706 |
+
"eyeBlinkRight": 0,
|
| 2707 |
+
"mouthSmileLeft": 0.3,
|
| 2708 |
+
"mouthSmileRight": 0.3
|
| 2709 |
+
}
|
| 2710 |
+
},
|
| 2711 |
+
{
|
| 2712 |
+
"time": 5.783333333333318,
|
| 2713 |
+
"blendshapes": {
|
| 2714 |
+
"eyeBlinkLeft": 0,
|
| 2715 |
+
"eyeBlinkRight": 0,
|
| 2716 |
+
"mouthSmileLeft": 0.3,
|
| 2717 |
+
"mouthSmileRight": 0.3
|
| 2718 |
+
}
|
| 2719 |
+
},
|
| 2720 |
+
{
|
| 2721 |
+
"time": 5.799999999999985,
|
| 2722 |
+
"blendshapes": {
|
| 2723 |
+
"eyeBlinkLeft": 0,
|
| 2724 |
+
"eyeBlinkRight": 0,
|
| 2725 |
+
"mouthSmileLeft": 0.3,
|
| 2726 |
+
"mouthSmileRight": 0.3
|
| 2727 |
+
}
|
| 2728 |
+
},
|
| 2729 |
+
{
|
| 2730 |
+
"time": 5.816666666666651,
|
| 2731 |
+
"blendshapes": {
|
| 2732 |
+
"eyeBlinkLeft": 0,
|
| 2733 |
+
"eyeBlinkRight": 0,
|
| 2734 |
+
"mouthSmileLeft": 0.3,
|
| 2735 |
+
"mouthSmileRight": 0.3
|
| 2736 |
+
}
|
| 2737 |
+
},
|
| 2738 |
+
{
|
| 2739 |
+
"time": 5.833333333333318,
|
| 2740 |
+
"blendshapes": {
|
| 2741 |
+
"eyeBlinkLeft": 0,
|
| 2742 |
+
"eyeBlinkRight": 0,
|
| 2743 |
+
"mouthSmileLeft": 0.3,
|
| 2744 |
+
"mouthSmileRight": 0.3
|
| 2745 |
+
}
|
| 2746 |
+
},
|
| 2747 |
+
{
|
| 2748 |
+
"time": 5.8499999999999845,
|
| 2749 |
+
"blendshapes": {
|
| 2750 |
+
"eyeBlinkLeft": 0,
|
| 2751 |
+
"eyeBlinkRight": 0,
|
| 2752 |
+
"mouthSmileLeft": 0.3,
|
| 2753 |
+
"mouthSmileRight": 0.3
|
| 2754 |
+
}
|
| 2755 |
+
},
|
| 2756 |
+
{
|
| 2757 |
+
"time": 5.866666666666651,
|
| 2758 |
+
"blendshapes": {
|
| 2759 |
+
"eyeBlinkLeft": 0,
|
| 2760 |
+
"eyeBlinkRight": 0,
|
| 2761 |
+
"mouthSmileLeft": 0.3,
|
| 2762 |
+
"mouthSmileRight": 0.3
|
| 2763 |
+
}
|
| 2764 |
+
},
|
| 2765 |
+
{
|
| 2766 |
+
"time": 5.883333333333318,
|
| 2767 |
+
"blendshapes": {
|
| 2768 |
+
"eyeBlinkLeft": 0,
|
| 2769 |
+
"eyeBlinkRight": 0,
|
| 2770 |
+
"mouthSmileLeft": 0.3,
|
| 2771 |
+
"mouthSmileRight": 0.3
|
| 2772 |
+
}
|
| 2773 |
+
},
|
| 2774 |
+
{
|
| 2775 |
+
"time": 5.899999999999984,
|
| 2776 |
+
"blendshapes": {
|
| 2777 |
+
"eyeBlinkLeft": 0,
|
| 2778 |
+
"eyeBlinkRight": 0,
|
| 2779 |
+
"mouthSmileLeft": 0.3,
|
| 2780 |
+
"mouthSmileRight": 0.3
|
| 2781 |
+
}
|
| 2782 |
+
},
|
| 2783 |
+
{
|
| 2784 |
+
"time": 5.916666666666651,
|
| 2785 |
+
"blendshapes": {
|
| 2786 |
+
"eyeBlinkLeft": 0,
|
| 2787 |
+
"eyeBlinkRight": 0,
|
| 2788 |
+
"mouthSmileLeft": 0.3,
|
| 2789 |
+
"mouthSmileRight": 0.3
|
| 2790 |
+
}
|
| 2791 |
+
},
|
| 2792 |
+
{
|
| 2793 |
+
"time": 5.933333333333318,
|
| 2794 |
+
"blendshapes": {
|
| 2795 |
+
"eyeBlinkLeft": 0,
|
| 2796 |
+
"eyeBlinkRight": 0,
|
| 2797 |
+
"mouthSmileLeft": 0.3,
|
| 2798 |
+
"mouthSmileRight": 0.3
|
| 2799 |
+
}
|
| 2800 |
+
},
|
| 2801 |
+
{
|
| 2802 |
+
"time": 5.949999999999984,
|
| 2803 |
+
"blendshapes": {
|
| 2804 |
+
"eyeBlinkLeft": 0,
|
| 2805 |
+
"eyeBlinkRight": 0,
|
| 2806 |
+
"mouthSmileLeft": 0.3,
|
| 2807 |
+
"mouthSmileRight": 0.3
|
| 2808 |
+
}
|
| 2809 |
+
},
|
| 2810 |
+
{
|
| 2811 |
+
"time": 5.966666666666651,
|
| 2812 |
+
"blendshapes": {
|
| 2813 |
+
"eyeBlinkLeft": 0,
|
| 2814 |
+
"eyeBlinkRight": 0,
|
| 2815 |
+
"mouthSmileLeft": 0.3,
|
| 2816 |
+
"mouthSmileRight": 0.3
|
| 2817 |
+
}
|
| 2818 |
+
},
|
| 2819 |
+
{
|
| 2820 |
+
"time": 5.983333333333317,
|
| 2821 |
+
"blendshapes": {
|
| 2822 |
+
"eyeBlinkLeft": 0,
|
| 2823 |
+
"eyeBlinkRight": 0,
|
| 2824 |
+
"mouthSmileLeft": 0.3,
|
| 2825 |
+
"mouthSmileRight": 0.3
|
| 2826 |
+
}
|
| 2827 |
+
},
|
| 2828 |
+
{
|
| 2829 |
+
"time": 5.999999999999984,
|
| 2830 |
+
"blendshapes": {
|
| 2831 |
+
"eyeBlinkLeft": 0,
|
| 2832 |
+
"eyeBlinkRight": 0,
|
| 2833 |
+
"mouthSmileLeft": 0.3,
|
| 2834 |
+
"mouthSmileRight": 0.3
|
| 2835 |
+
}
|
| 2836 |
+
},
|
| 2837 |
+
{
|
| 2838 |
+
"time": 6.016666666666651,
|
| 2839 |
+
"blendshapes": {
|
| 2840 |
+
"eyeBlinkLeft": 0.002,
|
| 2841 |
+
"eyeBlinkRight": 0.002,
|
| 2842 |
+
"mouthSmileLeft": 0.3,
|
| 2843 |
+
"mouthSmileRight": 0.3
|
| 2844 |
+
}
|
| 2845 |
+
},
|
| 2846 |
+
{
|
| 2847 |
+
"time": 6.033333333333317,
|
| 2848 |
+
"blendshapes": {
|
| 2849 |
+
"eyeBlinkLeft": 0.158,
|
| 2850 |
+
"eyeBlinkRight": 0.158,
|
| 2851 |
+
"mouthSmileLeft": 0.3,
|
| 2852 |
+
"mouthSmileRight": 0.3
|
| 2853 |
+
}
|
| 2854 |
+
},
|
| 2855 |
+
{
|
| 2856 |
+
"time": 6.049999999999984,
|
| 2857 |
+
"blendshapes": {
|
| 2858 |
+
"eyeBlinkLeft": 0.313,
|
| 2859 |
+
"eyeBlinkRight": 0.313,
|
| 2860 |
+
"mouthSmileLeft": 0.3,
|
| 2861 |
+
"mouthSmileRight": 0.3
|
| 2862 |
+
}
|
| 2863 |
+
},
|
| 2864 |
+
{
|
| 2865 |
+
"time": 6.06666666666665,
|
| 2866 |
+
"blendshapes": {
|
| 2867 |
+
"eyeBlinkLeft": 0.461,
|
| 2868 |
+
"eyeBlinkRight": 0.461,
|
| 2869 |
+
"mouthSmileLeft": 0.3,
|
| 2870 |
+
"mouthSmileRight": 0.3
|
| 2871 |
+
}
|
| 2872 |
+
},
|
| 2873 |
+
{
|
| 2874 |
+
"time": 6.083333333333317,
|
| 2875 |
+
"blendshapes": {
|
| 2876 |
+
"eyeBlinkLeft": 0.517,
|
| 2877 |
+
"eyeBlinkRight": 0.516,
|
| 2878 |
+
"mouthSmileLeft": 0.3,
|
| 2879 |
+
"mouthSmileRight": 0.3
|
| 2880 |
+
}
|
| 2881 |
+
},
|
| 2882 |
+
{
|
| 2883 |
+
"time": 6.099999999999984,
|
| 2884 |
+
"blendshapes": {
|
| 2885 |
+
"eyeBlinkLeft": 0.441,
|
| 2886 |
+
"eyeBlinkRight": 0.441,
|
| 2887 |
+
"mouthSmileLeft": 0.3,
|
| 2888 |
+
"mouthSmileRight": 0.3
|
| 2889 |
+
}
|
| 2890 |
+
},
|
| 2891 |
+
{
|
| 2892 |
+
"time": 6.11666666666665,
|
| 2893 |
+
"blendshapes": {
|
| 2894 |
+
"eyeBlinkLeft": 0.343,
|
| 2895 |
+
"eyeBlinkRight": 0.343,
|
| 2896 |
+
"mouthSmileLeft": 0.3,
|
| 2897 |
+
"mouthSmileRight": 0.3
|
| 2898 |
+
}
|
| 2899 |
+
},
|
| 2900 |
+
{
|
| 2901 |
+
"time": 6.133333333333317,
|
| 2902 |
+
"blendshapes": {
|
| 2903 |
+
"eyeBlinkLeft": 0.246,
|
| 2904 |
+
"eyeBlinkRight": 0.246,
|
| 2905 |
+
"mouthSmileLeft": 0.3,
|
| 2906 |
+
"mouthSmileRight": 0.3
|
| 2907 |
+
}
|
| 2908 |
+
},
|
| 2909 |
+
{
|
| 2910 |
+
"time": 6.1499999999999835,
|
| 2911 |
+
"blendshapes": {
|
| 2912 |
+
"eyeBlinkLeft": 0.161,
|
| 2913 |
+
"eyeBlinkRight": 0.161,
|
| 2914 |
+
"mouthSmileLeft": 0.3,
|
| 2915 |
+
"mouthSmileRight": 0.3
|
| 2916 |
+
}
|
| 2917 |
+
},
|
| 2918 |
+
{
|
| 2919 |
+
"time": 6.16666666666665,
|
| 2920 |
+
"blendshapes": {
|
| 2921 |
+
"eyeBlinkLeft": 0.111,
|
| 2922 |
+
"eyeBlinkRight": 0.11,
|
| 2923 |
+
"mouthSmileLeft": 0.3,
|
| 2924 |
+
"mouthSmileRight": 0.3
|
| 2925 |
+
}
|
| 2926 |
+
},
|
| 2927 |
+
{
|
| 2928 |
+
"time": 6.183333333333317,
|
| 2929 |
+
"blendshapes": {
|
| 2930 |
+
"eyeBlinkLeft": 0.067,
|
| 2931 |
+
"eyeBlinkRight": 0.066,
|
| 2932 |
+
"mouthSmileLeft": 0.3,
|
| 2933 |
+
"mouthSmileRight": 0.3
|
| 2934 |
+
}
|
| 2935 |
+
},
|
| 2936 |
+
{
|
| 2937 |
+
"time": 6.199999999999983,
|
| 2938 |
+
"blendshapes": {
|
| 2939 |
+
"eyeBlinkLeft": 0.008,
|
| 2940 |
+
"eyeBlinkRight": 0.009,
|
| 2941 |
+
"mouthSmileLeft": 0.3,
|
| 2942 |
+
"mouthSmileRight": 0.3
|
| 2943 |
+
}
|
| 2944 |
+
},
|
| 2945 |
+
{
|
| 2946 |
+
"time": 6.21666666666665,
|
| 2947 |
+
"blendshapes": {
|
| 2948 |
+
"eyeBlinkLeft": 0,
|
| 2949 |
+
"eyeBlinkRight": 0,
|
| 2950 |
+
"mouthSmileLeft": 0.3,
|
| 2951 |
+
"mouthSmileRight": 0.3
|
| 2952 |
+
}
|
| 2953 |
+
},
|
| 2954 |
+
{
|
| 2955 |
+
"time": 6.2333333333333165,
|
| 2956 |
+
"blendshapes": {
|
| 2957 |
+
"eyeBlinkLeft": 0,
|
| 2958 |
+
"eyeBlinkRight": 0,
|
| 2959 |
+
"mouthSmileLeft": 0.3,
|
| 2960 |
+
"mouthSmileRight": 0.3
|
| 2961 |
+
}
|
| 2962 |
+
},
|
| 2963 |
+
{
|
| 2964 |
+
"time": 6.249999999999983,
|
| 2965 |
+
"blendshapes": {
|
| 2966 |
+
"eyeBlinkLeft": 0,
|
| 2967 |
+
"eyeBlinkRight": 0,
|
| 2968 |
+
"mouthSmileLeft": 0.3,
|
| 2969 |
+
"mouthSmileRight": 0.3
|
| 2970 |
+
}
|
| 2971 |
+
},
|
| 2972 |
+
{
|
| 2973 |
+
"time": 6.26666666666665,
|
| 2974 |
+
"blendshapes": {
|
| 2975 |
+
"eyeBlinkLeft": 0,
|
| 2976 |
+
"eyeBlinkRight": 0,
|
| 2977 |
+
"mouthSmileLeft": 0.3,
|
| 2978 |
+
"mouthSmileRight": 0.3
|
| 2979 |
+
}
|
| 2980 |
+
},
|
| 2981 |
+
{
|
| 2982 |
+
"time": 6.283333333333316,
|
| 2983 |
+
"blendshapes": {
|
| 2984 |
+
"eyeBlinkLeft": 0,
|
| 2985 |
+
"eyeBlinkRight": 0,
|
| 2986 |
+
"mouthSmileLeft": 0.3,
|
| 2987 |
+
"mouthSmileRight": 0.3
|
| 2988 |
+
}
|
| 2989 |
+
},
|
| 2990 |
+
{
|
| 2991 |
+
"time": 6.299999999999983,
|
| 2992 |
+
"blendshapes": {
|
| 2993 |
+
"eyeBlinkLeft": 0,
|
| 2994 |
+
"eyeBlinkRight": 0,
|
| 2995 |
+
"mouthSmileLeft": 0.3,
|
| 2996 |
+
"mouthSmileRight": 0.3
|
| 2997 |
+
}
|
| 2998 |
+
},
|
| 2999 |
+
{
|
| 3000 |
+
"time": 6.3166666666666496,
|
| 3001 |
+
"blendshapes": {
|
| 3002 |
+
"eyeBlinkLeft": 0,
|
| 3003 |
+
"eyeBlinkRight": 0,
|
| 3004 |
+
"mouthSmileLeft": 0.3,
|
| 3005 |
+
"mouthSmileRight": 0.3
|
| 3006 |
+
}
|
| 3007 |
+
},
|
| 3008 |
+
{
|
| 3009 |
+
"time": 6.333333333333316,
|
| 3010 |
+
"blendshapes": {
|
| 3011 |
+
"eyeBlinkLeft": 0,
|
| 3012 |
+
"eyeBlinkRight": 0,
|
| 3013 |
+
"mouthSmileLeft": 0.3,
|
| 3014 |
+
"mouthSmileRight": 0.3
|
| 3015 |
+
}
|
| 3016 |
+
},
|
| 3017 |
+
{
|
| 3018 |
+
"time": 6.349999999999983,
|
| 3019 |
+
"blendshapes": {
|
| 3020 |
+
"eyeBlinkLeft": 0,
|
| 3021 |
+
"eyeBlinkRight": 0,
|
| 3022 |
+
"mouthSmileLeft": 0.3,
|
| 3023 |
+
"mouthSmileRight": 0.3
|
| 3024 |
+
}
|
| 3025 |
+
},
|
| 3026 |
+
{
|
| 3027 |
+
"time": 6.366666666666649,
|
| 3028 |
+
"blendshapes": {
|
| 3029 |
+
"eyeBlinkLeft": 0,
|
| 3030 |
+
"eyeBlinkRight": 0,
|
| 3031 |
+
"mouthSmileLeft": 0.3,
|
| 3032 |
+
"mouthSmileRight": 0.3
|
| 3033 |
+
}
|
| 3034 |
+
},
|
| 3035 |
+
{
|
| 3036 |
+
"time": 6.383333333333316,
|
| 3037 |
+
"blendshapes": {
|
| 3038 |
+
"eyeBlinkLeft": 0,
|
| 3039 |
+
"eyeBlinkRight": 0,
|
| 3040 |
+
"mouthSmileLeft": 0.3,
|
| 3041 |
+
"mouthSmileRight": 0.3
|
| 3042 |
+
}
|
| 3043 |
+
},
|
| 3044 |
+
{
|
| 3045 |
+
"time": 6.399999999999983,
|
| 3046 |
+
"blendshapes": {
|
| 3047 |
+
"eyeBlinkLeft": 0,
|
| 3048 |
+
"eyeBlinkRight": 0,
|
| 3049 |
+
"mouthSmileLeft": 0.3,
|
| 3050 |
+
"mouthSmileRight": 0.3
|
| 3051 |
+
}
|
| 3052 |
+
},
|
| 3053 |
+
{
|
| 3054 |
+
"time": 6.416666666666649,
|
| 3055 |
+
"blendshapes": {
|
| 3056 |
+
"eyeBlinkLeft": 0,
|
| 3057 |
+
"eyeBlinkRight": 0,
|
| 3058 |
+
"mouthSmileLeft": 0.3,
|
| 3059 |
+
"mouthSmileRight": 0.3
|
| 3060 |
+
}
|
| 3061 |
+
},
|
| 3062 |
+
{
|
| 3063 |
+
"time": 6.433333333333316,
|
| 3064 |
+
"blendshapes": {
|
| 3065 |
+
"eyeBlinkLeft": 0,
|
| 3066 |
+
"eyeBlinkRight": 0,
|
| 3067 |
+
"mouthSmileLeft": 0.3,
|
| 3068 |
+
"mouthSmileRight": 0.3
|
| 3069 |
+
}
|
| 3070 |
+
},
|
| 3071 |
+
{
|
| 3072 |
+
"time": 6.449999999999982,
|
| 3073 |
+
"blendshapes": {
|
| 3074 |
+
"eyeBlinkLeft": 0,
|
| 3075 |
+
"eyeBlinkRight": 0,
|
| 3076 |
+
"mouthSmileLeft": 0.3,
|
| 3077 |
+
"mouthSmileRight": 0.3
|
| 3078 |
+
}
|
| 3079 |
+
},
|
| 3080 |
+
{
|
| 3081 |
+
"time": 6.466666666666649,
|
| 3082 |
+
"blendshapes": {
|
| 3083 |
+
"eyeBlinkLeft": 0,
|
| 3084 |
+
"eyeBlinkRight": 0,
|
| 3085 |
+
"mouthSmileLeft": 0.3,
|
| 3086 |
+
"mouthSmileRight": 0.3
|
| 3087 |
+
}
|
| 3088 |
+
},
|
| 3089 |
+
{
|
| 3090 |
+
"time": 6.483333333333316,
|
| 3091 |
+
"blendshapes": {
|
| 3092 |
+
"eyeBlinkLeft": 0,
|
| 3093 |
+
"eyeBlinkRight": 0,
|
| 3094 |
+
"mouthSmileLeft": 0.3,
|
| 3095 |
+
"mouthSmileRight": 0.3
|
| 3096 |
+
}
|
| 3097 |
+
},
|
| 3098 |
+
{
|
| 3099 |
+
"time": 6.499999999999982,
|
| 3100 |
+
"blendshapes": {
|
| 3101 |
+
"eyeBlinkLeft": 0,
|
| 3102 |
+
"eyeBlinkRight": 0,
|
| 3103 |
+
"mouthSmileLeft": 0.3,
|
| 3104 |
+
"mouthSmileRight": 0.3
|
| 3105 |
+
}
|
| 3106 |
+
},
|
| 3107 |
+
{
|
| 3108 |
+
"time": 6.516666666666649,
|
| 3109 |
+
"blendshapes": {
|
| 3110 |
+
"eyeBlinkLeft": 0,
|
| 3111 |
+
"eyeBlinkRight": 0,
|
| 3112 |
+
"mouthSmileLeft": 0.3,
|
| 3113 |
+
"mouthSmileRight": 0.3
|
| 3114 |
+
}
|
| 3115 |
+
},
|
| 3116 |
+
{
|
| 3117 |
+
"time": 6.5333333333333155,
|
| 3118 |
+
"blendshapes": {
|
| 3119 |
+
"eyeBlinkLeft": 0,
|
| 3120 |
+
"eyeBlinkRight": 0,
|
| 3121 |
+
"mouthSmileLeft": 0.3,
|
| 3122 |
+
"mouthSmileRight": 0.3
|
| 3123 |
+
}
|
| 3124 |
+
},
|
| 3125 |
+
{
|
| 3126 |
+
"time": 6.549999999999982,
|
| 3127 |
+
"blendshapes": {
|
| 3128 |
+
"eyeBlinkLeft": 0,
|
| 3129 |
+
"eyeBlinkRight": 0,
|
| 3130 |
+
"mouthSmileLeft": 0.3,
|
| 3131 |
+
"mouthSmileRight": 0.3
|
| 3132 |
+
}
|
| 3133 |
+
},
|
| 3134 |
+
{
|
| 3135 |
+
"time": 6.566666666666649,
|
| 3136 |
+
"blendshapes": {
|
| 3137 |
+
"eyeBlinkLeft": 0,
|
| 3138 |
+
"eyeBlinkRight": 0,
|
| 3139 |
+
"mouthSmileLeft": 0.3,
|
| 3140 |
+
"mouthSmileRight": 0.3
|
| 3141 |
+
}
|
| 3142 |
+
},
|
| 3143 |
+
{
|
| 3144 |
+
"time": 6.583333333333315,
|
| 3145 |
+
"blendshapes": {
|
| 3146 |
+
"eyeBlinkLeft": 0,
|
| 3147 |
+
"eyeBlinkRight": 0,
|
| 3148 |
+
"mouthSmileLeft": 0.3,
|
| 3149 |
+
"mouthSmileRight": 0.3
|
| 3150 |
+
}
|
| 3151 |
+
},
|
| 3152 |
+
{
|
| 3153 |
+
"time": 6.599999999999982,
|
| 3154 |
+
"blendshapes": {
|
| 3155 |
+
"eyeBlinkLeft": 0,
|
| 3156 |
+
"eyeBlinkRight": 0,
|
| 3157 |
+
"mouthSmileLeft": 0.3,
|
| 3158 |
+
"mouthSmileRight": 0.3
|
| 3159 |
+
}
|
| 3160 |
+
},
|
| 3161 |
+
{
|
| 3162 |
+
"time": 6.6166666666666485,
|
| 3163 |
+
"blendshapes": {
|
| 3164 |
+
"eyeBlinkLeft": 0,
|
| 3165 |
+
"eyeBlinkRight": 0,
|
| 3166 |
+
"mouthSmileLeft": 0.3,
|
| 3167 |
+
"mouthSmileRight": 0.3
|
| 3168 |
+
}
|
| 3169 |
+
},
|
| 3170 |
+
{
|
| 3171 |
+
"time": 6.633333333333315,
|
| 3172 |
+
"blendshapes": {
|
| 3173 |
+
"eyeBlinkLeft": 0,
|
| 3174 |
+
"eyeBlinkRight": 0,
|
| 3175 |
+
"mouthSmileLeft": 0.3,
|
| 3176 |
+
"mouthSmileRight": 0.3
|
| 3177 |
+
}
|
| 3178 |
+
},
|
| 3179 |
+
{
|
| 3180 |
+
"time": 6.649999999999982,
|
| 3181 |
+
"blendshapes": {
|
| 3182 |
+
"eyeBlinkLeft": 0,
|
| 3183 |
+
"eyeBlinkRight": 0,
|
| 3184 |
+
"mouthSmileLeft": 0.3,
|
| 3185 |
+
"mouthSmileRight": 0.3
|
| 3186 |
+
}
|
| 3187 |
+
},
|
| 3188 |
+
{
|
| 3189 |
+
"time": 6.666666666666648,
|
| 3190 |
+
"blendshapes": {
|
| 3191 |
+
"eyeBlinkLeft": 0,
|
| 3192 |
+
"eyeBlinkRight": 0,
|
| 3193 |
+
"mouthSmileLeft": 0.3,
|
| 3194 |
+
"mouthSmileRight": 0.3
|
| 3195 |
+
}
|
| 3196 |
+
},
|
| 3197 |
+
{
|
| 3198 |
+
"time": 6.683333333333315,
|
| 3199 |
+
"blendshapes": {
|
| 3200 |
+
"eyeBlinkLeft": 0,
|
| 3201 |
+
"eyeBlinkRight": 0,
|
| 3202 |
+
"mouthSmileLeft": 0.3,
|
| 3203 |
+
"mouthSmileRight": 0.3
|
| 3204 |
+
}
|
| 3205 |
+
},
|
| 3206 |
+
{
|
| 3207 |
+
"time": 6.6999999999999815,
|
| 3208 |
+
"blendshapes": {
|
| 3209 |
+
"eyeBlinkLeft": 0,
|
| 3210 |
+
"eyeBlinkRight": 0,
|
| 3211 |
+
"mouthSmileLeft": 0.3,
|
| 3212 |
+
"mouthSmileRight": 0.3
|
| 3213 |
+
}
|
| 3214 |
+
},
|
| 3215 |
+
{
|
| 3216 |
+
"time": 6.716666666666648,
|
| 3217 |
+
"blendshapes": {
|
| 3218 |
+
"eyeBlinkLeft": 0,
|
| 3219 |
+
"eyeBlinkRight": 0,
|
| 3220 |
+
"mouthSmileLeft": 0.3,
|
| 3221 |
+
"mouthSmileRight": 0.3
|
| 3222 |
+
}
|
| 3223 |
+
},
|
| 3224 |
+
{
|
| 3225 |
+
"time": 6.733333333333315,
|
| 3226 |
+
"blendshapes": {
|
| 3227 |
+
"eyeBlinkLeft": 0,
|
| 3228 |
+
"eyeBlinkRight": 0,
|
| 3229 |
+
"mouthSmileLeft": 0.3,
|
| 3230 |
+
"mouthSmileRight": 0.3
|
| 3231 |
+
}
|
| 3232 |
+
},
|
| 3233 |
+
{
|
| 3234 |
+
"time": 6.749999999999981,
|
| 3235 |
+
"blendshapes": {
|
| 3236 |
+
"eyeBlinkLeft": 0,
|
| 3237 |
+
"eyeBlinkRight": 0,
|
| 3238 |
+
"mouthSmileLeft": 0.3,
|
| 3239 |
+
"mouthSmileRight": 0.3
|
| 3240 |
+
}
|
| 3241 |
+
},
|
| 3242 |
+
{
|
| 3243 |
+
"time": 6.766666666666648,
|
| 3244 |
+
"blendshapes": {
|
| 3245 |
+
"eyeBlinkLeft": 0,
|
| 3246 |
+
"eyeBlinkRight": 0,
|
| 3247 |
+
"mouthSmileLeft": 0.3,
|
| 3248 |
+
"mouthSmileRight": 0.3
|
| 3249 |
+
}
|
| 3250 |
+
},
|
| 3251 |
+
{
|
| 3252 |
+
"time": 6.783333333333315,
|
| 3253 |
+
"blendshapes": {
|
| 3254 |
+
"eyeBlinkLeft": 0,
|
| 3255 |
+
"eyeBlinkRight": 0,
|
| 3256 |
+
"mouthSmileLeft": 0.3,
|
| 3257 |
+
"mouthSmileRight": 0.3
|
| 3258 |
+
}
|
| 3259 |
+
},
|
| 3260 |
+
{
|
| 3261 |
+
"time": 6.799999999999981,
|
| 3262 |
+
"blendshapes": {
|
| 3263 |
+
"eyeBlinkLeft": 0,
|
| 3264 |
+
"eyeBlinkRight": 0,
|
| 3265 |
+
"mouthSmileLeft": 0.3,
|
| 3266 |
+
"mouthSmileRight": 0.3
|
| 3267 |
+
}
|
| 3268 |
+
},
|
| 3269 |
+
{
|
| 3270 |
+
"time": 6.816666666666648,
|
| 3271 |
+
"blendshapes": {
|
| 3272 |
+
"eyeBlinkLeft": 0,
|
| 3273 |
+
"eyeBlinkRight": 0,
|
| 3274 |
+
"mouthSmileLeft": 0.3,
|
| 3275 |
+
"mouthSmileRight": 0.3
|
| 3276 |
+
}
|
| 3277 |
+
},
|
| 3278 |
+
{
|
| 3279 |
+
"time": 6.833333333333314,
|
| 3280 |
+
"blendshapes": {
|
| 3281 |
+
"eyeBlinkLeft": 0,
|
| 3282 |
+
"eyeBlinkRight": 0,
|
| 3283 |
+
"mouthSmileLeft": 0.3,
|
| 3284 |
+
"mouthSmileRight": 0.3
|
| 3285 |
+
}
|
| 3286 |
+
},
|
| 3287 |
+
{
|
| 3288 |
+
"time": 6.849999999999981,
|
| 3289 |
+
"blendshapes": {
|
| 3290 |
+
"eyeBlinkLeft": 0,
|
| 3291 |
+
"eyeBlinkRight": 0,
|
| 3292 |
+
"mouthSmileLeft": 0.3,
|
| 3293 |
+
"mouthSmileRight": 0.3
|
| 3294 |
+
}
|
| 3295 |
+
},
|
| 3296 |
+
{
|
| 3297 |
+
"time": 6.866666666666648,
|
| 3298 |
+
"blendshapes": {
|
| 3299 |
+
"eyeBlinkLeft": 0,
|
| 3300 |
+
"eyeBlinkRight": 0,
|
| 3301 |
+
"mouthSmileLeft": 0.3,
|
| 3302 |
+
"mouthSmileRight": 0.3
|
| 3303 |
+
}
|
| 3304 |
+
},
|
| 3305 |
+
{
|
| 3306 |
+
"time": 6.883333333333314,
|
| 3307 |
+
"blendshapes": {
|
| 3308 |
+
"eyeBlinkLeft": 0,
|
| 3309 |
+
"eyeBlinkRight": 0,
|
| 3310 |
+
"mouthSmileLeft": 0.3,
|
| 3311 |
+
"mouthSmileRight": 0.3
|
| 3312 |
+
}
|
| 3313 |
+
},
|
| 3314 |
+
{
|
| 3315 |
+
"time": 6.899999999999981,
|
| 3316 |
+
"blendshapes": {
|
| 3317 |
+
"eyeBlinkLeft": 0,
|
| 3318 |
+
"eyeBlinkRight": 0,
|
| 3319 |
+
"mouthSmileLeft": 0.3,
|
| 3320 |
+
"mouthSmileRight": 0.3
|
| 3321 |
+
}
|
| 3322 |
+
}
|
| 3323 |
+
]
|
frontend/3d-assets/converter_original.js
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import {
|
| 3 |
+
AnimationClip,
|
| 4 |
+
NumberKeyframeTrack
|
| 5 |
+
} from 'three';
|
| 6 |
+
|
| 7 |
+
var fps = 60
|
| 8 |
+
|
| 9 |
+
function modifiedKey(key) {
|
| 10 |
+
|
| 11 |
+
if (["eyeLookDownLeft", "eyeLookDownRight", "eyeLookInLeft", "eyeLookInRight", "eyeLookOutLeft", "eyeLookOutRight", "eyeLookUpLeft", "eyeLookUpRight"].includes(key)) {
|
| 12 |
+
return key
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
if (key.endsWith("Right")) {
|
| 16 |
+
return key.replace("Right", "_R");
|
| 17 |
+
}
|
| 18 |
+
if (key.endsWith("Left")) {
|
| 19 |
+
return key.replace("Left", "_L");
|
| 20 |
+
}
|
| 21 |
+
return key;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
function createAnimation(recordedData, morphTargetDictionary, bodyPart) {
|
| 25 |
+
|
| 26 |
+
// console.log("----morphTargetDictionary", morphTargetDictionary)
|
| 27 |
+
|
| 28 |
+
if (recordedData.length != 0) {
|
| 29 |
+
let animation = []
|
| 30 |
+
for (let i = 0; i < Object.keys(morphTargetDictionary).length; i++) {
|
| 31 |
+
animation.push([])
|
| 32 |
+
}
|
| 33 |
+
let time = []
|
| 34 |
+
let finishedFrames = 0
|
| 35 |
+
recordedData.forEach((d, i) => {
|
| 36 |
+
Object.entries(d.blendshapes).forEach(([key, value]) => {
|
| 37 |
+
|
| 38 |
+
if (!(modifiedKey(key) in morphTargetDictionary)) { return };
|
| 39 |
+
|
| 40 |
+
if (key == 'mouthShrugUpper') {
|
| 41 |
+
value += 0.4;
|
| 42 |
+
}
|
| 43 |
+
|
| 44 |
+
animation[morphTargetDictionary[modifiedKey(key)]].push(value)
|
| 45 |
+
});
|
| 46 |
+
time.push(finishedFrames / fps)
|
| 47 |
+
finishedFrames++
|
| 48 |
+
|
| 49 |
+
})
|
| 50 |
+
|
| 51 |
+
// console.log("-----animation", animation);
|
| 52 |
+
|
| 53 |
+
let tracks = []
|
| 54 |
+
|
| 55 |
+
let flag = false;
|
| 56 |
+
//create morph animation
|
| 57 |
+
Object.entries(recordedData[0].blendshapes).forEach(([key, value]) => {
|
| 58 |
+
|
| 59 |
+
if (!(modifiedKey(key) in morphTargetDictionary)) { return };
|
| 60 |
+
|
| 61 |
+
let i = morphTargetDictionary[modifiedKey(key)]
|
| 62 |
+
|
| 63 |
+
// if (bodyPart === "HG_TeethLower") {
|
| 64 |
+
|
| 65 |
+
// if (flag === true)
|
| 66 |
+
// return;
|
| 67 |
+
|
| 68 |
+
// if(key === 'jawOpen') {
|
| 69 |
+
// let track2 = new NumberKeyframeTrack(`HG_TeethLower.morphTargetInfluences[${ i }]`, time, animation[i])
|
| 70 |
+
// tracks.push(track2)
|
| 71 |
+
// flag = true
|
| 72 |
+
// }
|
| 73 |
+
// } else {
|
| 74 |
+
let track = new NumberKeyframeTrack(`${bodyPart}.morphTargetInfluences[${i}]`, time, animation[i])
|
| 75 |
+
|
| 76 |
+
tracks.push(track)
|
| 77 |
+
|
| 78 |
+
// }
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
// if (key === "jawOpen") {
|
| 82 |
+
// let track2 = new NumberKeyframeTrack(`HG_TeethLower.morphTargetInfluences[${ i }]`, time, animation[i])
|
| 83 |
+
// tracks.push(track2)
|
| 84 |
+
// console.log("----jawOpen Track", track2);
|
| 85 |
+
// }
|
| 86 |
+
});
|
| 87 |
+
|
| 88 |
+
const clip = new AnimationClip('animation', -1, tracks);
|
| 89 |
+
return clip
|
| 90 |
+
}
|
| 91 |
+
return null
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
+
export default createAnimation;
|
frontend/3d-assets/idle.fbx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c9091e668e6864ad3d5ea67c31b105e608823f18c1c3277f6335d49f423e112
|
| 3 |
+
size 1248272
|
frontend/3d-assets/images/background.jpg
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/background1.jpg
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/bg5.jpg
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/body.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/body_normal.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/body_roughness.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/body_specular.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/eyes.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/h_alpha.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/h_color.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/h_normal.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/h_roughness.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/photo_studio_loft_hall_1k.hdr
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0b468d543c312e5b620646f5ee32f5d111463380f103452384a839f8d146fd3a
|
| 3 |
+
size 524351
|
frontend/3d-assets/images/teeth_diffuse.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/teeth_normal.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/tshirt_diffuse.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/tshirt_normal.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/images/tshirt_roughness.webp
ADDED
|
Git LFS Details
|
frontend/3d-assets/model.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:96d1745804d19994218db4222a26c82baf2e36813bd57a406481f3d399ca41e1
|
| 3 |
+
size 28804184
|
frontend/3d-assets/rpm-model.glb
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* ============================================================================
|
| 2 |
+
PersonaFlow - Design System & Styles
|
| 3 |
+
Modern, clean interface with purple as primary color
|
| 4 |
+
============================================================================ */
|
| 5 |
+
|
| 6 |
+
/* ============================================================================
|
| 7 |
+
CSS Variables
|
| 8 |
+
============================================================================ */
|
| 9 |
+
:root {
|
| 10 |
+
/* Primary Colors */
|
| 11 |
+
--primary-50: #eef2ff;
|
| 12 |
+
--primary-100: #e0e7ff;
|
| 13 |
+
--primary-200: #c7d2fe;
|
| 14 |
+
--primary-300: #a5b4fc;
|
| 15 |
+
--primary-400: #818cf8;
|
| 16 |
+
--primary-500: #6366f1;
|
| 17 |
+
--primary-600: #4f46e5;
|
| 18 |
+
--primary-700: #4338ca;
|
| 19 |
+
--primary-800: #3730a3;
|
| 20 |
+
--primary-900: #312e81;
|
| 21 |
+
|
| 22 |
+
/* Gray Scale */
|
| 23 |
+
--gray-50: #f9fafb;
|
| 24 |
+
--gray-100: #f3f4f6;
|
| 25 |
+
--gray-200: #e5e7eb;
|
| 26 |
+
--gray-300: #d1d5db;
|
| 27 |
+
--gray-400: #9ca3af;
|
| 28 |
+
--gray-500: #6b7280;
|
| 29 |
+
--gray-600: #4b5563;
|
| 30 |
+
--gray-700: #374151;
|
| 31 |
+
--gray-800: #1f2937;
|
| 32 |
+
--gray-900: #111827;
|
| 33 |
+
|
| 34 |
+
/* Semantic Colors */
|
| 35 |
+
--success: #22c55e;
|
| 36 |
+
--success-light: #dcfce7;
|
| 37 |
+
--warning: #f59e0b;
|
| 38 |
+
--warning-light: #fef3c7;
|
| 39 |
+
--error: #ef4444;
|
| 40 |
+
--error-light: #fee2e2;
|
| 41 |
+
--info: #0ea5e9;
|
| 42 |
+
--info-light: #e0f2fe;
|
| 43 |
+
|
| 44 |
+
/* Sidebar */
|
| 45 |
+
--sidebar-bg: #1a1d2e;
|
| 46 |
+
--sidebar-width: 260px;
|
| 47 |
+
|
| 48 |
+
/* Cards & Surfaces */
|
| 49 |
+
--card-bg: #ffffff;
|
| 50 |
+
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
|
| 51 |
+
--card-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
| 52 |
+
|
| 53 |
+
/* Typography */
|
| 54 |
+
--font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
| 55 |
+
|
| 56 |
+
/* Borders */
|
| 57 |
+
--border-radius: 8px;
|
| 58 |
+
--border-radius-lg: 12px;
|
| 59 |
+
--border-radius-xl: 16px;
|
| 60 |
+
--border-color: var(--gray-200);
|
| 61 |
+
|
| 62 |
+
/* Transitions */
|
| 63 |
+
--transition-fast: 150ms ease;
|
| 64 |
+
--transition-normal: 250ms ease;
|
| 65 |
+
--transition-slow: 350ms ease;
|
| 66 |
+
}
|
| 67 |
+
|
| 68 |
+
/* ============================================================================
|
| 69 |
+
Dark Mode Variable Overrides
|
| 70 |
+
============================================================================ */
|
| 71 |
+
[data-theme="dark"] {
|
| 72 |
+
/* Gray Scale — Inverted */
|
| 73 |
+
--gray-50: #0f1117;
|
| 74 |
+
--gray-100: #1a1d2e;
|
| 75 |
+
--gray-200: #252836;
|
| 76 |
+
--gray-300: #363a4a;
|
| 77 |
+
--gray-400: #6b7280;
|
| 78 |
+
--gray-500: #9ca3af;
|
| 79 |
+
--gray-600: #c9cdd5;
|
| 80 |
+
--gray-700: #e0e2e7;
|
| 81 |
+
--gray-800: #edf0f4;
|
| 82 |
+
--gray-900: #f5f6f8;
|
| 83 |
+
|
| 84 |
+
/* Primary — Slightly brighter for dark bg */
|
| 85 |
+
--primary-50: #1e1b4b;
|
| 86 |
+
--primary-100: #2e2a5e;
|
| 87 |
+
--primary-200: #3b3786;
|
| 88 |
+
--primary-700: #818cf8;
|
| 89 |
+
--primary-800: #a5b4fc;
|
| 90 |
+
|
| 91 |
+
/* Semantic Lights — Dark versions */
|
| 92 |
+
--success-light: rgba(34, 197, 94, 0.12);
|
| 93 |
+
--warning-light: rgba(245, 158, 11, 0.12);
|
| 94 |
+
--error-light: rgba(239, 68, 68, 0.12);
|
| 95 |
+
--info-light: rgba(14, 165, 233, 0.12);
|
| 96 |
+
|
| 97 |
+
/* Sidebar */
|
| 98 |
+
--sidebar-bg: #0c0e18;
|
| 99 |
+
|
| 100 |
+
/* Cards & Surfaces */
|
| 101 |
+
--card-bg: #161823;
|
| 102 |
+
--card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
|
| 103 |
+
--card-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
|
| 104 |
+
|
| 105 |
+
/* Borders */
|
| 106 |
+
--border-color: rgba(255, 255, 255, 0.08);
|
| 107 |
+
|
| 108 |
+
color-scheme: dark;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
[data-theme="dark"] body {
|
| 112 |
+
background-color: #0b0d14;
|
| 113 |
+
color: var(--gray-800);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
[data-theme="dark"] .card {
|
| 117 |
+
background: var(--card-bg);
|
| 118 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 119 |
+
}
|
| 120 |
+
|
| 121 |
+
[data-theme="dark"] .card:hover {
|
| 122 |
+
border-color: rgba(99, 102, 241, 0.25);
|
| 123 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
[data-theme="dark"] .modal {
|
| 127 |
+
background: #1a1d2e;
|
| 128 |
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 129 |
+
}
|
| 130 |
+
|
| 131 |
+
[data-theme="dark"] .modal-header {
|
| 132 |
+
border-bottom-color: rgba(255, 255, 255, 0.06);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
[data-theme="dark"] .modal-footer {
|
| 136 |
+
border-top-color: rgba(255, 255, 255, 0.06);
|
| 137 |
+
}
|
| 138 |
+
|
| 139 |
+
[data-theme="dark"] .toast {
|
| 140 |
+
background: #1a1d2e;
|
| 141 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
[data-theme="dark"] .form-input,
|
| 145 |
+
[data-theme="dark"] .form-textarea,
|
| 146 |
+
[data-theme="dark"] .form-select {
|
| 147 |
+
background: rgba(255, 255, 255, 0.04);
|
| 148 |
+
border-color: rgba(255, 255, 255, 0.1);
|
| 149 |
+
color: var(--gray-900);
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
[data-theme="dark"] .form-input:focus,
|
| 153 |
+
[data-theme="dark"] .form-textarea:focus,
|
| 154 |
+
[data-theme="dark"] .form-select:focus {
|
| 155 |
+
border-color: var(--primary-500);
|
| 156 |
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
[data-theme="dark"] .form-input::placeholder,
|
| 160 |
+
[data-theme="dark"] .form-textarea::placeholder {
|
| 161 |
+
color: var(--gray-400);
|
| 162 |
+
}
|
| 163 |
+
|
| 164 |
+
[data-theme="dark"] .list-item {
|
| 165 |
+
background: rgba(255, 255, 255, 0.03);
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
[data-theme="dark"] .list-item:hover {
|
| 169 |
+
background: rgba(255, 255, 255, 0.06);
|
| 170 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 171 |
+
}
|
| 172 |
+
|
| 173 |
+
[data-theme="dark"] .chat-container {
|
| 174 |
+
background: var(--card-bg);
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
[data-theme="dark"] .message.agent .message-bubble {
|
| 178 |
+
background: rgba(255, 255, 255, 0.06);
|
| 179 |
+
}
|
| 180 |
+
|
| 181 |
+
[data-theme="dark"] .message.user .message-bubble {
|
| 182 |
+
background: var(--primary-600);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
[data-theme="dark"] .auth-card {
|
| 186 |
+
background: #161823;
|
| 187 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
[data-theme="dark"] .auth-container {
|
| 191 |
+
background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.08) 0%, #0b0d14 100%);
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
[data-theme="dark"] .btn-secondary {
|
| 195 |
+
background: rgba(255, 255, 255, 0.06);
|
| 196 |
+
color: var(--gray-800);
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
[data-theme="dark"] .btn-secondary:hover {
|
| 200 |
+
background: rgba(255, 255, 255, 0.1);
|
| 201 |
+
}
|
| 202 |
+
|
| 203 |
+
[data-theme="dark"] .btn-outline {
|
| 204 |
+
border-color: rgba(255, 255, 255, 0.12);
|
| 205 |
+
color: var(--gray-800);
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
[data-theme="dark"] .btn-outline:hover {
|
| 209 |
+
background: rgba(255, 255, 255, 0.05);
|
| 210 |
+
border-color: rgba(255, 255, 255, 0.2);
|
| 211 |
+
}
|
| 212 |
+
|
| 213 |
+
[data-theme="dark"] .toggle {
|
| 214 |
+
background: rgba(255, 255, 255, 0.12);
|
| 215 |
+
}
|
| 216 |
+
|
| 217 |
+
[data-theme="dark"] .stat-icon-wrapper.purple {
|
| 218 |
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.08));
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
[data-theme="dark"] .stat-icon-wrapper.green {
|
| 222 |
+
background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(34, 197, 94, 0.08));
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
[data-theme="dark"] .stat-icon-wrapper.blue {
|
| 226 |
+
background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(14, 165, 233, 0.08));
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
[data-theme="dark"] .stat-icon-wrapper.orange {
|
| 230 |
+
background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(245, 158, 11, 0.08));
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/* Dark mode for anchoring remote */
|
| 234 |
+
[data-theme="dark"] .anc-remote-container .anc-back-btn {
|
| 235 |
+
background: rgba(255, 255, 255, 0.05);
|
| 236 |
+
border-color: rgba(255, 255, 255, 0.1);
|
| 237 |
+
color: var(--gray-700);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
[data-theme="dark"] .anc-script-panel,
|
| 241 |
+
[data-theme="dark"] .anc-control-card {
|
| 242 |
+
background: var(--card-bg);
|
| 243 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 244 |
+
}
|
| 245 |
+
|
| 246 |
+
[data-theme="dark"] .anc-script-editor {
|
| 247 |
+
background: rgba(255, 255, 255, 0.03);
|
| 248 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 249 |
+
color: var(--gray-900);
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
[data-theme="dark"] .anc-lines-list {
|
| 253 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 254 |
+
}
|
| 255 |
+
|
| 256 |
+
[data-theme="dark"] .anc-line-item {
|
| 257 |
+
border-bottom-color: rgba(255, 255, 255, 0.04);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
[data-theme="dark"] .anc-status-badge {
|
| 261 |
+
background: var(--card-bg);
|
| 262 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 263 |
+
}
|
| 264 |
+
|
| 265 |
+
[data-theme="dark"] .anc-ctrl-btn {
|
| 266 |
+
background: rgba(255, 255, 255, 0.03);
|
| 267 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 268 |
+
color: var(--gray-700);
|
| 269 |
+
}
|
| 270 |
+
|
| 271 |
+
/* Dark mode scrollbar */
|
| 272 |
+
[data-theme="dark"] ::-webkit-scrollbar-thumb {
|
| 273 |
+
background: rgba(255, 255, 255, 0.15);
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
[data-theme="dark"] ::-webkit-scrollbar-track {
|
| 277 |
+
background: rgba(0, 0, 0, 0.2);
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
/* ============================================================================
|
| 281 |
+
Dark Mode Toggle — Sidebar
|
| 282 |
+
============================================================================ */
|
| 283 |
+
.dark-mode-row {
|
| 284 |
+
display: flex;
|
| 285 |
+
align-items: center;
|
| 286 |
+
gap: 10px;
|
| 287 |
+
padding: 10px 0;
|
| 288 |
+
margin-bottom: 12px;
|
| 289 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
.dark-mode-label {
|
| 293 |
+
display: flex;
|
| 294 |
+
align-items: center;
|
| 295 |
+
gap: 8px;
|
| 296 |
+
font-size: 0.8125rem;
|
| 297 |
+
color: rgba(255, 255, 255, 0.55);
|
| 298 |
+
flex: 1;
|
| 299 |
+
}
|
| 300 |
+
|
| 301 |
+
.dark-mode-label i {
|
| 302 |
+
font-size: 0.875rem;
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
.dark-mode-switch {
|
| 306 |
+
position: relative;
|
| 307 |
+
width: 40px;
|
| 308 |
+
height: 22px;
|
| 309 |
+
background: rgba(255, 255, 255, 0.12);
|
| 310 |
+
border-radius: 11px;
|
| 311 |
+
cursor: pointer;
|
| 312 |
+
transition: background 0.3s ease;
|
| 313 |
+
flex-shrink: 0;
|
| 314 |
+
}
|
| 315 |
+
|
| 316 |
+
.dark-mode-switch.active {
|
| 317 |
+
background: var(--primary-500);
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
.dark-mode-switch::after {
|
| 321 |
+
content: '';
|
| 322 |
+
position: absolute;
|
| 323 |
+
width: 16px;
|
| 324 |
+
height: 16px;
|
| 325 |
+
background: white;
|
| 326 |
+
border-radius: 50%;
|
| 327 |
+
top: 3px;
|
| 328 |
+
left: 3px;
|
| 329 |
+
transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 330 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
.dark-mode-switch.active::after {
|
| 334 |
+
transform: translateX(18px);
|
| 335 |
+
}
|
| 336 |
+
|
| 337 |
+
/* ============================================================================
|
| 338 |
+
Global UI Polish
|
| 339 |
+
============================================================================ */
|
| 340 |
+
|
| 341 |
+
/* Custom Scrollbar */
|
| 342 |
+
::-webkit-scrollbar {
|
| 343 |
+
width: 6px;
|
| 344 |
+
height: 6px;
|
| 345 |
+
}
|
| 346 |
+
|
| 347 |
+
::-webkit-scrollbar-track {
|
| 348 |
+
background: transparent;
|
| 349 |
+
}
|
| 350 |
+
|
| 351 |
+
::-webkit-scrollbar-thumb {
|
| 352 |
+
background: var(--gray-300);
|
| 353 |
+
border-radius: 3px;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
::-webkit-scrollbar-thumb:hover {
|
| 357 |
+
background: var(--gray-400);
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
/* Selection Color */
|
| 361 |
+
::selection {
|
| 362 |
+
background: rgba(99, 102, 241, 0.2);
|
| 363 |
+
color: inherit;
|
| 364 |
+
}
|
| 365 |
+
|
| 366 |
+
/* Smooth Transition on Theme Change */
|
| 367 |
+
body,
|
| 368 |
+
.card,
|
| 369 |
+
.sidebar,
|
| 370 |
+
.main-content,
|
| 371 |
+
.modal,
|
| 372 |
+
.toast,
|
| 373 |
+
.form-input,
|
| 374 |
+
.form-textarea,
|
| 375 |
+
.form-select,
|
| 376 |
+
.btn,
|
| 377 |
+
.badge,
|
| 378 |
+
.list-item,
|
| 379 |
+
.nav-item {
|
| 380 |
+
transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
/* ============================================================================
|
| 384 |
+
Reset & Base
|
| 385 |
+
============================================================================ */
|
| 386 |
+
*,
|
| 387 |
+
*::before,
|
| 388 |
+
*::after {
|
| 389 |
+
box-sizing: border-box;
|
| 390 |
+
margin: 0;
|
| 391 |
+
padding: 0;
|
| 392 |
+
}
|
| 393 |
+
|
| 394 |
+
html {
|
| 395 |
+
font-size: 16px;
|
| 396 |
+
scroll-behavior: smooth;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
body {
|
| 400 |
+
font-family: var(--font-family);
|
| 401 |
+
font-size: 0.9375rem;
|
| 402 |
+
line-height: 1.6;
|
| 403 |
+
color: var(--gray-800);
|
| 404 |
+
background-color: var(--gray-50);
|
| 405 |
+
min-height: 100vh;
|
| 406 |
+
-webkit-font-smoothing: antialiased;
|
| 407 |
+
}
|
| 408 |
+
|
| 409 |
+
a {
|
| 410 |
+
color: var(--primary-600);
|
| 411 |
+
text-decoration: none;
|
| 412 |
+
transition: color var(--transition-fast);
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
a:hover {
|
| 416 |
+
color: var(--primary-700);
|
| 417 |
+
}
|
| 418 |
+
|
| 419 |
+
button {
|
| 420 |
+
font-family: inherit;
|
| 421 |
+
cursor: pointer;
|
| 422 |
+
border: none;
|
| 423 |
+
background: none;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
input,
|
| 427 |
+
textarea,
|
| 428 |
+
select {
|
| 429 |
+
font-family: inherit;
|
| 430 |
+
font-size: inherit;
|
| 431 |
+
}
|
| 432 |
+
|
| 433 |
+
img {
|
| 434 |
+
max-width: 100%;
|
| 435 |
+
height: auto;
|
| 436 |
+
}
|
| 437 |
+
|
| 438 |
+
/* ============================================================================
|
| 439 |
+
Layout
|
| 440 |
+
============================================================================ */
|
| 441 |
+
#app {
|
| 442 |
+
display: flex;
|
| 443 |
+
min-height: 100vh;
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
.main-content {
|
| 447 |
+
flex: 1;
|
| 448 |
+
margin-left: var(--sidebar-width);
|
| 449 |
+
padding: 2rem;
|
| 450 |
+
transition: margin-left var(--transition-normal);
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
.main-content.full-width {
|
| 454 |
+
margin-left: 0;
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
/* ============================================================================
|
| 458 |
+
Sidebar
|
| 459 |
+
============================================================================ */
|
| 460 |
+
.sidebar {
|
| 461 |
+
position: fixed;
|
| 462 |
+
left: 0;
|
| 463 |
+
top: 0;
|
| 464 |
+
width: var(--sidebar-width);
|
| 465 |
+
height: 100vh;
|
| 466 |
+
background: var(--sidebar-bg);
|
| 467 |
+
display: flex;
|
| 468 |
+
flex-direction: column;
|
| 469 |
+
z-index: 100;
|
| 470 |
+
transition: transform var(--transition-normal);
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
.sidebar.hidden {
|
| 474 |
+
transform: translateX(-100%);
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
.sidebar-header {
|
| 478 |
+
padding: 1.25rem 1.5rem;
|
| 479 |
+
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
| 480 |
+
}
|
| 481 |
+
|
| 482 |
+
.logo {
|
| 483 |
+
display: flex;
|
| 484 |
+
align-items: center;
|
| 485 |
+
gap: 0.75rem;
|
| 486 |
+
}
|
| 487 |
+
|
| 488 |
+
.logo-icon {
|
| 489 |
+
font-size: 1.75rem;
|
| 490 |
+
}
|
| 491 |
+
|
| 492 |
+
.logo-img {
|
| 493 |
+
width: 36px;
|
| 494 |
+
height: 36px;
|
| 495 |
+
border-radius: 10px;
|
| 496 |
+
object-fit: cover;
|
| 497 |
+
}
|
| 498 |
+
|
| 499 |
+
.logo-text {
|
| 500 |
+
font-size: 1.25rem;
|
| 501 |
+
font-weight: 700;
|
| 502 |
+
color: white;
|
| 503 |
+
letter-spacing: -0.01em;
|
| 504 |
+
}
|
| 505 |
+
|
| 506 |
+
.logo-subtitle {
|
| 507 |
+
font-size: 0.6875rem;
|
| 508 |
+
color: rgba(255, 255, 255, 0.45);
|
| 509 |
+
font-weight: 400;
|
| 510 |
+
letter-spacing: 0.02em;
|
| 511 |
+
margin-top: 1px;
|
| 512 |
+
}
|
| 513 |
+
|
| 514 |
+
.sidebar-nav {
|
| 515 |
+
flex: 1;
|
| 516 |
+
padding: 1rem 0;
|
| 517 |
+
overflow-y: auto;
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
.nav-item {
|
| 521 |
+
display: flex;
|
| 522 |
+
align-items: center;
|
| 523 |
+
gap: 0.75rem;
|
| 524 |
+
padding: 0.75rem 1.5rem;
|
| 525 |
+
color: rgba(255, 255, 255, 0.55);
|
| 526 |
+
font-weight: 500;
|
| 527 |
+
transition: all var(--transition-fast);
|
| 528 |
+
border-left: 3px solid transparent;
|
| 529 |
+
position: relative;
|
| 530 |
+
margin: 0.125rem 0;
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
.nav-item:hover {
|
| 534 |
+
color: white;
|
| 535 |
+
background: rgba(255, 255, 255, 0.05);
|
| 536 |
+
}
|
| 537 |
+
|
| 538 |
+
.nav-item.active {
|
| 539 |
+
color: white;
|
| 540 |
+
background: rgba(99, 102, 241, 0.15);
|
| 541 |
+
border-left-color: var(--primary-500);
|
| 542 |
+
}
|
| 543 |
+
|
| 544 |
+
.nav-icon {
|
| 545 |
+
font-size: 1.125rem;
|
| 546 |
+
width: 22px;
|
| 547 |
+
text-align: center;
|
| 548 |
+
display: flex;
|
| 549 |
+
align-items: center;
|
| 550 |
+
justify-content: center;
|
| 551 |
+
}
|
| 552 |
+
|
| 553 |
+
.nav-label {
|
| 554 |
+
font-size: 0.9375rem;
|
| 555 |
+
flex: 1;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
.nav-chevron {
|
| 559 |
+
font-size: 0.625rem;
|
| 560 |
+
opacity: 0;
|
| 561 |
+
transition: opacity var(--transition-fast);
|
| 562 |
+
color: rgba(255, 255, 255, 0.5);
|
| 563 |
+
}
|
| 564 |
+
|
| 565 |
+
.nav-item.active .nav-chevron {
|
| 566 |
+
opacity: 1;
|
| 567 |
+
}
|
| 568 |
+
|
| 569 |
+
.sidebar-footer {
|
| 570 |
+
padding: 1rem 1.5rem;
|
| 571 |
+
border-top: 1px solid rgba(255, 255, 255, 0.08);
|
| 572 |
+
}
|
| 573 |
+
|
| 574 |
+
.user-info {
|
| 575 |
+
display: flex;
|
| 576 |
+
align-items: center;
|
| 577 |
+
gap: 0.75rem;
|
| 578 |
+
}
|
| 579 |
+
|
| 580 |
+
.user-avatar {
|
| 581 |
+
width: 40px;
|
| 582 |
+
height: 40px;
|
| 583 |
+
border-radius: 50%;
|
| 584 |
+
background: var(--primary-500);
|
| 585 |
+
display: flex;
|
| 586 |
+
align-items: center;
|
| 587 |
+
justify-content: center;
|
| 588 |
+
color: white;
|
| 589 |
+
font-weight: 600;
|
| 590 |
+
font-size: 0.875rem;
|
| 591 |
+
flex-shrink: 0;
|
| 592 |
+
}
|
| 593 |
+
|
| 594 |
+
.user-details {
|
| 595 |
+
display: flex;
|
| 596 |
+
flex-direction: column;
|
| 597 |
+
gap: 0.125rem;
|
| 598 |
+
flex: 1;
|
| 599 |
+
min-width: 0;
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
.user-name {
|
| 603 |
+
color: white;
|
| 604 |
+
font-weight: 500;
|
| 605 |
+
font-size: 0.875rem;
|
| 606 |
+
}
|
| 607 |
+
|
| 608 |
+
.user-email {
|
| 609 |
+
color: rgba(255, 255, 255, 0.4);
|
| 610 |
+
font-size: 0.75rem;
|
| 611 |
+
white-space: nowrap;
|
| 612 |
+
overflow: hidden;
|
| 613 |
+
text-overflow: ellipsis;
|
| 614 |
+
}
|
| 615 |
+
|
| 616 |
+
.logout-btn {
|
| 617 |
+
color: rgba(255, 255, 255, 0.4);
|
| 618 |
+
font-size: 1rem;
|
| 619 |
+
padding: 0.375rem;
|
| 620 |
+
transition: color var(--transition-fast);
|
| 621 |
+
flex-shrink: 0;
|
| 622 |
+
display: flex;
|
| 623 |
+
align-items: center;
|
| 624 |
+
justify-content: center;
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
.logout-btn:hover {
|
| 628 |
+
color: var(--error);
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
/* ============================================================================
|
| 632 |
+
Page Headers
|
| 633 |
+
============================================================================ */
|
| 634 |
+
.page-header {
|
| 635 |
+
display: flex;
|
| 636 |
+
align-items: center;
|
| 637 |
+
justify-content: space-between;
|
| 638 |
+
margin-bottom: 2rem;
|
| 639 |
+
}
|
| 640 |
+
|
| 641 |
+
.page-title {
|
| 642 |
+
font-size: 1.75rem;
|
| 643 |
+
font-weight: 700;
|
| 644 |
+
color: var(--gray-900);
|
| 645 |
+
}
|
| 646 |
+
|
| 647 |
+
.page-subtitle {
|
| 648 |
+
color: var(--gray-500);
|
| 649 |
+
font-size: 0.9375rem;
|
| 650 |
+
line-height: 1.5;
|
| 651 |
+
margin-top: 0.375rem;
|
| 652 |
+
font-weight: 400;
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
.auth-subtitle {
|
| 656 |
+
color: var(--gray-500);
|
| 657 |
+
font-size: 0.9375rem;
|
| 658 |
+
line-height: 1.5;
|
| 659 |
+
margin-top: 0.375rem;
|
| 660 |
+
font-weight: 400;
|
| 661 |
+
text-align: center;
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
.list-item-subtitle {
|
| 665 |
+
color: var(--gray-500);
|
| 666 |
+
font-size: 0.8125rem;
|
| 667 |
+
line-height: 1.4;
|
| 668 |
+
margin-top: 0.125rem;
|
| 669 |
+
font-weight: 400;
|
| 670 |
+
white-space: nowrap;
|
| 671 |
+
overflow: hidden;
|
| 672 |
+
text-overflow: ellipsis;
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
/* ============================================================================
|
| 676 |
+
Cards
|
| 677 |
+
============================================================================ */
|
| 678 |
+
.card {
|
| 679 |
+
background: var(--card-bg);
|
| 680 |
+
border-radius: var(--border-radius-lg);
|
| 681 |
+
box-shadow: var(--card-shadow);
|
| 682 |
+
padding: 1.5rem;
|
| 683 |
+
transition: box-shadow var(--transition-fast);
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
.card:hover {
|
| 687 |
+
box-shadow: var(--card-shadow-lg);
|
| 688 |
+
}
|
| 689 |
+
|
| 690 |
+
.card-header {
|
| 691 |
+
display: flex;
|
| 692 |
+
align-items: center;
|
| 693 |
+
justify-content: space-between;
|
| 694 |
+
margin-bottom: 1rem;
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
.card-title {
|
| 698 |
+
font-size: 1rem;
|
| 699 |
+
font-weight: 600;
|
| 700 |
+
color: var(--gray-900);
|
| 701 |
+
}
|
| 702 |
+
|
| 703 |
+
/* ============================================================================
|
| 704 |
+
Stat Cards
|
| 705 |
+
============================================================================ */
|
| 706 |
+
.stats-grid {
|
| 707 |
+
display: grid;
|
| 708 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 709 |
+
gap: 1.5rem;
|
| 710 |
+
margin-bottom: 2rem;
|
| 711 |
+
}
|
| 712 |
+
|
| 713 |
+
.stat-card {
|
| 714 |
+
display: flex;
|
| 715 |
+
align-items: center;
|
| 716 |
+
gap: 1rem;
|
| 717 |
+
}
|
| 718 |
+
|
| 719 |
+
.stat-icon {
|
| 720 |
+
width: 48px;
|
| 721 |
+
height: 48px;
|
| 722 |
+
border-radius: 12px;
|
| 723 |
+
display: flex;
|
| 724 |
+
align-items: center;
|
| 725 |
+
justify-content: center;
|
| 726 |
+
font-size: 1.5rem;
|
| 727 |
+
}
|
| 728 |
+
|
| 729 |
+
.stat-icon.purple {
|
| 730 |
+
background: var(--primary-100);
|
| 731 |
+
}
|
| 732 |
+
|
| 733 |
+
.stat-icon.green {
|
| 734 |
+
background: var(--success-light);
|
| 735 |
+
}
|
| 736 |
+
|
| 737 |
+
.stat-icon.blue {
|
| 738 |
+
background: var(--info-light);
|
| 739 |
+
}
|
| 740 |
+
|
| 741 |
+
.stat-icon.orange {
|
| 742 |
+
background: var(--warning-light);
|
| 743 |
+
}
|
| 744 |
+
|
| 745 |
+
.stat-content {
|
| 746 |
+
display: flex;
|
| 747 |
+
flex-direction: column;
|
| 748 |
+
}
|
| 749 |
+
|
| 750 |
+
.stat-value {
|
| 751 |
+
font-size: 1.5rem;
|
| 752 |
+
font-weight: 700;
|
| 753 |
+
color: var(--gray-900);
|
| 754 |
+
}
|
| 755 |
+
|
| 756 |
+
.stat-label {
|
| 757 |
+
font-size: 0.875rem;
|
| 758 |
+
color: var(--gray-500);
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
/* ============================================================================
|
| 762 |
+
Agent Cards
|
| 763 |
+
============================================================================ */
|
| 764 |
+
.agents-grid {
|
| 765 |
+
display: grid;
|
| 766 |
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
| 767 |
+
gap: 1.5rem;
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
.agent-card {
|
| 771 |
+
cursor: pointer;
|
| 772 |
+
transition: transform var(--transition-fast), box-shadow var(--transition-fast);
|
| 773 |
+
}
|
| 774 |
+
|
| 775 |
+
.agent-card:hover {
|
| 776 |
+
transform: translateY(-2px);
|
| 777 |
+
}
|
| 778 |
+
|
| 779 |
+
.agent-header {
|
| 780 |
+
display: flex;
|
| 781 |
+
align-items: flex-start;
|
| 782 |
+
gap: 1rem;
|
| 783 |
+
margin-bottom: 1rem;
|
| 784 |
+
}
|
| 785 |
+
|
| 786 |
+
.agent-icon {
|
| 787 |
+
width: 56px;
|
| 788 |
+
height: 56px;
|
| 789 |
+
border-radius: 14px;
|
| 790 |
+
display: flex;
|
| 791 |
+
align-items: center;
|
| 792 |
+
justify-content: center;
|
| 793 |
+
font-size: 1.75rem;
|
| 794 |
+
flex-shrink: 0;
|
| 795 |
+
}
|
| 796 |
+
|
| 797 |
+
.agent-info {
|
| 798 |
+
flex: 1;
|
| 799 |
+
min-width: 0;
|
| 800 |
+
}
|
| 801 |
+
|
| 802 |
+
.agent-name {
|
| 803 |
+
font-size: 1.125rem;
|
| 804 |
+
font-weight: 600;
|
| 805 |
+
color: var(--gray-900);
|
| 806 |
+
margin-bottom: 0.25rem;
|
| 807 |
+
white-space: nowrap;
|
| 808 |
+
overflow: hidden;
|
| 809 |
+
text-overflow: ellipsis;
|
| 810 |
+
}
|
| 811 |
+
|
| 812 |
+
.agent-role {
|
| 813 |
+
font-size: 0.875rem;
|
| 814 |
+
color: var(--gray-500);
|
| 815 |
+
white-space: nowrap;
|
| 816 |
+
overflow: hidden;
|
| 817 |
+
text-overflow: ellipsis;
|
| 818 |
+
}
|
| 819 |
+
|
| 820 |
+
.agent-stats {
|
| 821 |
+
display: flex;
|
| 822 |
+
gap: 1.5rem;
|
| 823 |
+
padding-top: 1rem;
|
| 824 |
+
border-top: 1px solid var(--gray-100);
|
| 825 |
+
}
|
| 826 |
+
|
| 827 |
+
.agent-stat {
|
| 828 |
+
display: flex;
|
| 829 |
+
flex-direction: column;
|
| 830 |
+
gap: 0.125rem;
|
| 831 |
+
}
|
| 832 |
+
|
| 833 |
+
.agent-stat-value {
|
| 834 |
+
font-weight: 600;
|
| 835 |
+
color: var(--gray-900);
|
| 836 |
+
}
|
| 837 |
+
|
| 838 |
+
.agent-stat-label {
|
| 839 |
+
font-size: 0.75rem;
|
| 840 |
+
color: var(--gray-500);
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
/* ============================================================================
|
| 844 |
+
Badges
|
| 845 |
+
============================================================================ */
|
| 846 |
+
.badge {
|
| 847 |
+
display: inline-flex;
|
| 848 |
+
align-items: center;
|
| 849 |
+
padding: 0.25rem 0.75rem;
|
| 850 |
+
border-radius: 9999px;
|
| 851 |
+
font-size: 0.75rem;
|
| 852 |
+
font-weight: 500;
|
| 853 |
+
}
|
| 854 |
+
|
| 855 |
+
.badge.active {
|
| 856 |
+
background: var(--success-light);
|
| 857 |
+
color: #15803d;
|
| 858 |
+
}
|
| 859 |
+
|
| 860 |
+
.badge.inactive {
|
| 861 |
+
background: var(--gray-100);
|
| 862 |
+
color: var(--gray-600);
|
| 863 |
+
}
|
| 864 |
+
|
| 865 |
+
.badge.completed {
|
| 866 |
+
background: var(--gray-100);
|
| 867 |
+
color: var(--gray-600);
|
| 868 |
+
}
|
| 869 |
+
|
| 870 |
+
.badge.protected {
|
| 871 |
+
background: var(--primary-100);
|
| 872 |
+
color: var(--primary-700);
|
| 873 |
+
}
|
| 874 |
+
|
| 875 |
+
.badge.expired {
|
| 876 |
+
background: var(--warning-light);
|
| 877 |
+
color: #b45309;
|
| 878 |
+
}
|
| 879 |
+
|
| 880 |
+
/* ============================================================================
|
| 881 |
+
Buttons
|
| 882 |
+
============================================================================ */
|
| 883 |
+
.btn {
|
| 884 |
+
display: inline-flex;
|
| 885 |
+
align-items: center;
|
| 886 |
+
justify-content: center;
|
| 887 |
+
gap: 0.5rem;
|
| 888 |
+
padding: 0.625rem 1.25rem;
|
| 889 |
+
border-radius: var(--border-radius);
|
| 890 |
+
font-weight: 500;
|
| 891 |
+
font-size: 0.9375rem;
|
| 892 |
+
transition: all var(--transition-fast);
|
| 893 |
+
}
|
| 894 |
+
|
| 895 |
+
.btn-primary {
|
| 896 |
+
background: var(--primary-600);
|
| 897 |
+
color: white;
|
| 898 |
+
}
|
| 899 |
+
|
| 900 |
+
.btn-primary:hover {
|
| 901 |
+
background: var(--primary-700);
|
| 902 |
+
color: white;
|
| 903 |
+
}
|
| 904 |
+
|
| 905 |
+
.btn-secondary {
|
| 906 |
+
background: var(--gray-100);
|
| 907 |
+
color: var(--gray-700);
|
| 908 |
+
}
|
| 909 |
+
|
| 910 |
+
.btn-secondary:hover {
|
| 911 |
+
background: var(--gray-200);
|
| 912 |
+
}
|
| 913 |
+
|
| 914 |
+
.btn-outline {
|
| 915 |
+
background: transparent;
|
| 916 |
+
border: 1px solid var(--border-color);
|
| 917 |
+
color: var(--gray-700);
|
| 918 |
+
}
|
| 919 |
+
|
| 920 |
+
.btn-outline:hover {
|
| 921 |
+
background: var(--gray-50);
|
| 922 |
+
border-color: var(--gray-300);
|
| 923 |
+
}
|
| 924 |
+
|
| 925 |
+
.btn-danger {
|
| 926 |
+
background: var(--error);
|
| 927 |
+
color: white;
|
| 928 |
+
}
|
| 929 |
+
|
| 930 |
+
.btn-danger:hover {
|
| 931 |
+
background: #dc2626;
|
| 932 |
+
}
|
| 933 |
+
|
| 934 |
+
.btn-success {
|
| 935 |
+
background: var(--success);
|
| 936 |
+
color: white;
|
| 937 |
+
}
|
| 938 |
+
|
| 939 |
+
.btn-success:hover {
|
| 940 |
+
background: #16a34a;
|
| 941 |
+
}
|
| 942 |
+
|
| 943 |
+
.btn-lg {
|
| 944 |
+
padding: 0.875rem 1.75rem;
|
| 945 |
+
font-size: 1rem;
|
| 946 |
+
}
|
| 947 |
+
|
| 948 |
+
.btn-sm {
|
| 949 |
+
padding: 0.375rem 0.875rem;
|
| 950 |
+
font-size: 0.8125rem;
|
| 951 |
+
}
|
| 952 |
+
|
| 953 |
+
.btn-icon {
|
| 954 |
+
width: 40px;
|
| 955 |
+
height: 40px;
|
| 956 |
+
padding: 0;
|
| 957 |
+
border-radius: 50%;
|
| 958 |
+
}
|
| 959 |
+
|
| 960 |
+
.btn:disabled {
|
| 961 |
+
opacity: 0.6;
|
| 962 |
+
cursor: not-allowed;
|
| 963 |
+
}
|
| 964 |
+
|
| 965 |
+
/* ============================================================================
|
| 966 |
+
Forms
|
| 967 |
+
============================================================================ */
|
| 968 |
+
.form-group {
|
| 969 |
+
margin-bottom: 1.25rem;
|
| 970 |
+
}
|
| 971 |
+
|
| 972 |
+
.form-label {
|
| 973 |
+
display: block;
|
| 974 |
+
font-size: 0.875rem;
|
| 975 |
+
font-weight: 500;
|
| 976 |
+
color: var(--gray-700);
|
| 977 |
+
margin-bottom: 0.5rem;
|
| 978 |
+
}
|
| 979 |
+
|
| 980 |
+
.form-input,
|
| 981 |
+
.form-textarea,
|
| 982 |
+
.form-select {
|
| 983 |
+
width: 100%;
|
| 984 |
+
padding: 0.625rem 0.875rem;
|
| 985 |
+
border: 1px solid var(--border-color);
|
| 986 |
+
border-radius: var(--border-radius);
|
| 987 |
+
font-size: 0.9375rem;
|
| 988 |
+
color: var(--gray-900);
|
| 989 |
+
background: white;
|
| 990 |
+
transition: all var(--transition-fast);
|
| 991 |
+
}
|
| 992 |
+
|
| 993 |
+
.form-input:focus,
|
| 994 |
+
.form-textarea:focus,
|
| 995 |
+
.form-select:focus {
|
| 996 |
+
outline: none;
|
| 997 |
+
border-color: var(--primary-500);
|
| 998 |
+
box-shadow: 0 0 0 3px var(--primary-100);
|
| 999 |
+
}
|
| 1000 |
+
|
| 1001 |
+
.form-input::placeholder,
|
| 1002 |
+
.form-textarea::placeholder {
|
| 1003 |
+
color: var(--gray-400);
|
| 1004 |
+
}
|
| 1005 |
+
|
| 1006 |
+
.form-textarea {
|
| 1007 |
+
resize: vertical;
|
| 1008 |
+
min-height: 100px;
|
| 1009 |
+
}
|
| 1010 |
+
|
| 1011 |
+
.form-error {
|
| 1012 |
+
color: var(--error);
|
| 1013 |
+
font-size: 0.8125rem;
|
| 1014 |
+
margin-top: 0.375rem;
|
| 1015 |
+
}
|
| 1016 |
+
|
| 1017 |
+
.form-help {
|
| 1018 |
+
color: var(--gray-500);
|
| 1019 |
+
font-size: 0.8125rem;
|
| 1020 |
+
margin-top: 0.375rem;
|
| 1021 |
+
}
|
| 1022 |
+
|
| 1023 |
+
/* Toggle Switch */
|
| 1024 |
+
.toggle-wrapper {
|
| 1025 |
+
display: flex;
|
| 1026 |
+
align-items: center;
|
| 1027 |
+
gap: 0.75rem;
|
| 1028 |
+
}
|
| 1029 |
+
|
| 1030 |
+
.toggle {
|
| 1031 |
+
position: relative;
|
| 1032 |
+
width: 44px;
|
| 1033 |
+
height: 24px;
|
| 1034 |
+
background: var(--gray-200);
|
| 1035 |
+
border-radius: 9999px;
|
| 1036 |
+
cursor: pointer;
|
| 1037 |
+
transition: background var(--transition-fast);
|
| 1038 |
+
}
|
| 1039 |
+
|
| 1040 |
+
.toggle.active {
|
| 1041 |
+
background: var(--primary-600);
|
| 1042 |
+
}
|
| 1043 |
+
|
| 1044 |
+
.toggle::after {
|
| 1045 |
+
content: '';
|
| 1046 |
+
position: absolute;
|
| 1047 |
+
width: 18px;
|
| 1048 |
+
height: 18px;
|
| 1049 |
+
background: white;
|
| 1050 |
+
border-radius: 50%;
|
| 1051 |
+
top: 3px;
|
| 1052 |
+
left: 3px;
|
| 1053 |
+
transition: transform var(--transition-fast);
|
| 1054 |
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
| 1055 |
+
}
|
| 1056 |
+
|
| 1057 |
+
.toggle.active::after {
|
| 1058 |
+
transform: translateX(20px);
|
| 1059 |
+
}
|
| 1060 |
+
|
| 1061 |
+
.toggle-label {
|
| 1062 |
+
font-size: 0.9375rem;
|
| 1063 |
+
color: var(--gray-700);
|
| 1064 |
+
}
|
| 1065 |
+
|
| 1066 |
+
/* ============================================================================
|
| 1067 |
+
Modal
|
| 1068 |
+
============================================================================ */
|
| 1069 |
+
.modal-container {
|
| 1070 |
+
position: fixed;
|
| 1071 |
+
inset: 0;
|
| 1072 |
+
z-index: 1000;
|
| 1073 |
+
display: flex;
|
| 1074 |
+
align-items: center;
|
| 1075 |
+
justify-content: center;
|
| 1076 |
+
padding: 1rem;
|
| 1077 |
+
}
|
| 1078 |
+
|
| 1079 |
+
.modal-container.hidden {
|
| 1080 |
+
display: none;
|
| 1081 |
+
}
|
| 1082 |
+
|
| 1083 |
+
.modal-backdrop {
|
| 1084 |
+
position: absolute;
|
| 1085 |
+
inset: 0;
|
| 1086 |
+
background: rgba(0, 0, 0, 0.5);
|
| 1087 |
+
animation: fadeIn var(--transition-fast) ease;
|
| 1088 |
+
}
|
| 1089 |
+
|
| 1090 |
+
.modal {
|
| 1091 |
+
position: relative;
|
| 1092 |
+
background: white;
|
| 1093 |
+
border-radius: var(--border-radius-xl);
|
| 1094 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
| 1095 |
+
width: 100%;
|
| 1096 |
+
max-width: 500px;
|
| 1097 |
+
max-height: 90vh;
|
| 1098 |
+
overflow: hidden;
|
| 1099 |
+
display: flex;
|
| 1100 |
+
flex-direction: column;
|
| 1101 |
+
animation: slideUp var(--transition-normal) ease;
|
| 1102 |
+
}
|
| 1103 |
+
|
| 1104 |
+
.modal-header {
|
| 1105 |
+
display: flex;
|
| 1106 |
+
align-items: center;
|
| 1107 |
+
justify-content: space-between;
|
| 1108 |
+
padding: 1.25rem 1.5rem;
|
| 1109 |
+
border-bottom: 1px solid var(--gray-100);
|
| 1110 |
+
}
|
| 1111 |
+
|
| 1112 |
+
.modal-title {
|
| 1113 |
+
font-size: 1.125rem;
|
| 1114 |
+
font-weight: 600;
|
| 1115 |
+
color: var(--gray-900);
|
| 1116 |
+
}
|
| 1117 |
+
|
| 1118 |
+
.modal-close {
|
| 1119 |
+
width: 32px;
|
| 1120 |
+
height: 32px;
|
| 1121 |
+
display: flex;
|
| 1122 |
+
align-items: center;
|
| 1123 |
+
justify-content: center;
|
| 1124 |
+
font-size: 1.5rem;
|
| 1125 |
+
color: var(--gray-400);
|
| 1126 |
+
border-radius: var(--border-radius);
|
| 1127 |
+
transition: all var(--transition-fast);
|
| 1128 |
+
}
|
| 1129 |
+
|
| 1130 |
+
.modal-close:hover {
|
| 1131 |
+
color: var(--gray-600);
|
| 1132 |
+
background: var(--gray-100);
|
| 1133 |
+
}
|
| 1134 |
+
|
| 1135 |
+
.modal-body {
|
| 1136 |
+
padding: 1.5rem;
|
| 1137 |
+
overflow-y: auto;
|
| 1138 |
+
}
|
| 1139 |
+
|
| 1140 |
+
.modal-footer {
|
| 1141 |
+
display: flex;
|
| 1142 |
+
align-items: center;
|
| 1143 |
+
justify-content: flex-end;
|
| 1144 |
+
gap: 0.75rem;
|
| 1145 |
+
padding: 1rem 1.5rem;
|
| 1146 |
+
border-top: 1px solid var(--gray-100);
|
| 1147 |
+
}
|
| 1148 |
+
|
| 1149 |
+
/* ============================================================================
|
| 1150 |
+
Toast Notifications
|
| 1151 |
+
============================================================================ */
|
| 1152 |
+
.toast-container {
|
| 1153 |
+
position: fixed;
|
| 1154 |
+
top: 1rem;
|
| 1155 |
+
right: 1rem;
|
| 1156 |
+
z-index: 2000;
|
| 1157 |
+
display: flex;
|
| 1158 |
+
flex-direction: column;
|
| 1159 |
+
gap: 0.75rem;
|
| 1160 |
+
}
|
| 1161 |
+
|
| 1162 |
+
.toast {
|
| 1163 |
+
display: flex;
|
| 1164 |
+
align-items: flex-start;
|
| 1165 |
+
gap: 0.75rem;
|
| 1166 |
+
padding: 1rem;
|
| 1167 |
+
background: white;
|
| 1168 |
+
border-radius: var(--border-radius);
|
| 1169 |
+
box-shadow: var(--card-shadow-lg);
|
| 1170 |
+
min-width: 300px;
|
| 1171 |
+
max-width: 400px;
|
| 1172 |
+
animation: slideInRight var(--transition-normal) ease;
|
| 1173 |
+
}
|
| 1174 |
+
|
| 1175 |
+
.toast.toast-success {
|
| 1176 |
+
border-left: 4px solid var(--success);
|
| 1177 |
+
}
|
| 1178 |
+
|
| 1179 |
+
|
| 1180 |
+
/* ============================================================================
|
| 1181 |
+
Premium Dashboard Styles
|
| 1182 |
+
============================================================================ */
|
| 1183 |
+
|
| 1184 |
+
/* Premium Card Construction */
|
| 1185 |
+
.card {
|
| 1186 |
+
background: #ffffff;
|
| 1187 |
+
border: 1px solid rgba(226, 232, 240, 0.8);
|
| 1188 |
+
border-radius: 16px;
|
| 1189 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
|
| 1190 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 1191 |
+
position: relative;
|
| 1192 |
+
overflow: hidden;
|
| 1193 |
+
}
|
| 1194 |
+
|
| 1195 |
+
.card:hover {
|
| 1196 |
+
transform: translateY(-2px);
|
| 1197 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
|
| 1198 |
+
border-color: rgba(99, 102, 241, 0.2);
|
| 1199 |
+
}
|
| 1200 |
+
|
| 1201 |
+
/* Glassmorphism Accents */
|
| 1202 |
+
.glass-panel {
|
| 1203 |
+
background: rgba(255, 255, 255, 0.7);
|
| 1204 |
+
backdrop-filter: blur(12px);
|
| 1205 |
+
-webkit-backdrop-filter: blur(12px);
|
| 1206 |
+
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
/* Gradient Text */
|
| 1210 |
+
.text-gradient {
|
| 1211 |
+
background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary-600) 100%);
|
| 1212 |
+
-webkit-background-clip: text;
|
| 1213 |
+
-webkit-text-fill-color: transparent;
|
| 1214 |
+
background-clip: text;
|
| 1215 |
+
}
|
| 1216 |
+
|
| 1217 |
+
/* Dashboard Header & Welcome Section */
|
| 1218 |
+
.welcome-section {
|
| 1219 |
+
position: relative;
|
| 1220 |
+
margin-bottom: 2.5rem;
|
| 1221 |
+
padding: 0.5rem 0;
|
| 1222 |
+
}
|
| 1223 |
+
|
| 1224 |
+
.welcome-title {
|
| 1225 |
+
font-size: 2rem;
|
| 1226 |
+
font-weight: 800;
|
| 1227 |
+
letter-spacing: -0.025em;
|
| 1228 |
+
margin-bottom: 0.5rem;
|
| 1229 |
+
color: var(--gray-900);
|
| 1230 |
+
}
|
| 1231 |
+
|
| 1232 |
+
.welcome-subtitle {
|
| 1233 |
+
font-size: 1.05rem;
|
| 1234 |
+
color: var(--gray-500);
|
| 1235 |
+
max-width: 600px;
|
| 1236 |
+
}
|
| 1237 |
+
|
| 1238 |
+
/* Enhanced Stats Grid */
|
| 1239 |
+
.stats-grid {
|
| 1240 |
+
display: grid;
|
| 1241 |
+
grid-template-columns: repeat(4, 1fr);
|
| 1242 |
+
gap: 1.5rem;
|
| 1243 |
+
margin-bottom: 2.5rem;
|
| 1244 |
+
}
|
| 1245 |
+
|
| 1246 |
+
@media (max-width: 1200px) {
|
| 1247 |
+
.stats-grid {
|
| 1248 |
+
grid-template-columns: repeat(2, 1fr);
|
| 1249 |
+
}
|
| 1250 |
+
}
|
| 1251 |
+
|
| 1252 |
+
@media (max-width: 640px) {
|
| 1253 |
+
.stats-grid {
|
| 1254 |
+
grid-template-columns: 1fr;
|
| 1255 |
+
}
|
| 1256 |
+
}
|
| 1257 |
+
|
| 1258 |
+
.stat-card {
|
| 1259 |
+
padding: 1.75rem;
|
| 1260 |
+
display: flex;
|
| 1261 |
+
align-items: center;
|
| 1262 |
+
justify-content: space-between;
|
| 1263 |
+
}
|
| 1264 |
+
|
| 1265 |
+
.stat-content {
|
| 1266 |
+
display: flex;
|
| 1267 |
+
flex-direction: column;
|
| 1268 |
+
gap: 0.25rem;
|
| 1269 |
+
}
|
| 1270 |
+
|
| 1271 |
+
.stat-label {
|
| 1272 |
+
font-size: 0.875rem;
|
| 1273 |
+
font-weight: 500;
|
| 1274 |
+
color: var(--gray-500);
|
| 1275 |
+
letter-spacing: 0.01em;
|
| 1276 |
+
}
|
| 1277 |
+
|
| 1278 |
+
.stat-value {
|
| 1279 |
+
font-size: 1.875rem;
|
| 1280 |
+
font-weight: 700;
|
| 1281 |
+
color: var(--gray-900);
|
| 1282 |
+
line-height: 1.2;
|
| 1283 |
+
letter-spacing: -0.02em;
|
| 1284 |
+
}
|
| 1285 |
+
|
| 1286 |
+
.stat-icon-wrapper {
|
| 1287 |
+
width: 56px;
|
| 1288 |
+
height: 56px;
|
| 1289 |
+
border-radius: 16px;
|
| 1290 |
+
display: flex;
|
| 1291 |
+
align-items: center;
|
| 1292 |
+
justify-content: center;
|
| 1293 |
+
font-size: 1.5rem;
|
| 1294 |
+
transition: transform 0.3s ease;
|
| 1295 |
+
}
|
| 1296 |
+
|
| 1297 |
+
.stat-card:hover .stat-icon-wrapper {
|
| 1298 |
+
transform: scale(1.1) rotate(5deg);
|
| 1299 |
+
}
|
| 1300 |
+
|
| 1301 |
+
.stat-icon-wrapper.purple {
|
| 1302 |
+
background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
|
| 1303 |
+
color: var(--primary-600);
|
| 1304 |
+
}
|
| 1305 |
+
|
| 1306 |
+
.stat-icon-wrapper.green {
|
| 1307 |
+
background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
|
| 1308 |
+
color: #16a34a;
|
| 1309 |
+
}
|
| 1310 |
+
|
| 1311 |
+
.stat-icon-wrapper.blue {
|
| 1312 |
+
background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
|
| 1313 |
+
color: #0284c7;
|
| 1314 |
+
}
|
| 1315 |
+
|
| 1316 |
+
.stat-icon-wrapper.orange {
|
| 1317 |
+
background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
|
| 1318 |
+
color: #ea580c;
|
| 1319 |
+
}
|
| 1320 |
+
|
| 1321 |
+
/* Section Header Styles */
|
| 1322 |
+
.section-header {
|
| 1323 |
+
display: flex;
|
| 1324 |
+
align-items: center;
|
| 1325 |
+
justify-content: space-between;
|
| 1326 |
+
margin-bottom: 1.25rem;
|
| 1327 |
+
}
|
| 1328 |
+
|
| 1329 |
+
.section-title {
|
| 1330 |
+
font-size: 1.125rem;
|
| 1331 |
+
font-weight: 700;
|
| 1332 |
+
color: var(--gray-900);
|
| 1333 |
+
display: flex;
|
| 1334 |
+
align-items: center;
|
| 1335 |
+
gap: 0.5rem;
|
| 1336 |
+
}
|
| 1337 |
+
|
| 1338 |
+
/* Recent Items List */
|
| 1339 |
+
.list-group {
|
| 1340 |
+
display: flex;
|
| 1341 |
+
flex-direction: column;
|
| 1342 |
+
gap: 0.75rem;
|
| 1343 |
+
}
|
| 1344 |
+
|
| 1345 |
+
.list-item {
|
| 1346 |
+
display: flex;
|
| 1347 |
+
align-items: center;
|
| 1348 |
+
gap: 1rem;
|
| 1349 |
+
padding: 1rem;
|
| 1350 |
+
background: var(--gray-50);
|
| 1351 |
+
border-radius: 12px;
|
| 1352 |
+
transition: all 0.2s ease;
|
| 1353 |
+
border: 1px solid transparent;
|
| 1354 |
+
}
|
| 1355 |
+
|
| 1356 |
+
.list-item:hover {
|
| 1357 |
+
background: white;
|
| 1358 |
+
border-color: var(--gray-200);
|
| 1359 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
| 1360 |
+
transform: translateX(4px);
|
| 1361 |
+
}
|
| 1362 |
+
|
| 1363 |
+
.list-item-icon {
|
| 1364 |
+
width: 48px;
|
| 1365 |
+
height: 48px;
|
| 1366 |
+
border-radius: 12px;
|
| 1367 |
+
display: flex;
|
| 1368 |
+
align-items: center;
|
| 1369 |
+
justify-content: center;
|
| 1370 |
+
font-size: 1.25rem;
|
| 1371 |
+
flex-shrink: 0;
|
| 1372 |
+
}
|
| 1373 |
+
|
| 1374 |
+
.list-item-content {
|
| 1375 |
+
flex: 1;
|
| 1376 |
+
min-width: 0;
|
| 1377 |
+
}
|
| 1378 |
+
|
| 1379 |
+
.list-item-title {
|
| 1380 |
+
font-weight: 600;
|
| 1381 |
+
color: var(--gray-900);
|
| 1382 |
+
margin-bottom: 0.125rem;
|
| 1383 |
+
white-space: nowrap;
|
| 1384 |
+
overflow: hidden;
|
| 1385 |
+
text-overflow: ellipsis;
|
| 1386 |
+
}
|
| 1387 |
+
|
| 1388 |
+
.list-item-subtitle {
|
| 1389 |
+
font-size: 0.8125rem;
|
| 1390 |
+
color: var(--gray-500);
|
| 1391 |
+
white-space: nowrap;
|
| 1392 |
+
overflow: hidden;
|
| 1393 |
+
text-overflow: ellipsis;
|
| 1394 |
+
}
|
| 1395 |
+
|
| 1396 |
+
/* Action Button Overrides */
|
| 1397 |
+
.btn-new-agent {
|
| 1398 |
+
background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 100%);
|
| 1399 |
+
box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.3);
|
| 1400 |
+
border: none;
|
| 1401 |
+
padding: 0.75rem 1.5rem;
|
| 1402 |
+
font-weight: 600;
|
| 1403 |
+
}
|
| 1404 |
+
|
| 1405 |
+
.btn-new-agent:hover {
|
| 1406 |
+
box-shadow: 0 8px 12px -1px rgba(99, 102, 241, 0.4);
|
| 1407 |
+
transform: translateY(-1px);
|
| 1408 |
+
}
|
| 1409 |
+
|
| 1410 |
+
.toast.toast-info {
|
| 1411 |
+
border-left: 4px solid var(--info);
|
| 1412 |
+
}
|
| 1413 |
+
|
| 1414 |
+
.toast.toast-warning {
|
| 1415 |
+
border-left: 4px solid var(--warning);
|
| 1416 |
+
}
|
| 1417 |
+
|
| 1418 |
+
.toast-icon {
|
| 1419 |
+
font-size: 1.25rem;
|
| 1420 |
+
flex-shrink: 0;
|
| 1421 |
+
}
|
| 1422 |
+
|
| 1423 |
+
.toast-content {
|
| 1424 |
+
flex: 1;
|
| 1425 |
+
}
|
| 1426 |
+
|
| 1427 |
+
.toast-title {
|
| 1428 |
+
font-weight: 600;
|
| 1429 |
+
color: var(--gray-900);
|
| 1430 |
+
margin-bottom: 0.125rem;
|
| 1431 |
+
}
|
| 1432 |
+
|
| 1433 |
+
.toast-message {
|
| 1434 |
+
font-size: 0.875rem;
|
| 1435 |
+
color: var(--gray-600);
|
| 1436 |
+
}
|
| 1437 |
+
|
| 1438 |
+
.toast-close {
|
| 1439 |
+
color: var(--gray-400);
|
| 1440 |
+
font-size: 1.25rem;
|
| 1441 |
+
padding: 0.25rem;
|
| 1442 |
+
transition: color var(--transition-fast);
|
| 1443 |
+
}
|
| 1444 |
+
|
| 1445 |
+
.toast-close:hover {
|
| 1446 |
+
color: var(--gray-600);
|
| 1447 |
+
}
|
| 1448 |
+
|
| 1449 |
+
/* ============================================================================
|
| 1450 |
+
Chat Interface
|
| 1451 |
+
============================================================================ */
|
| 1452 |
+
.chat-container {
|
| 1453 |
+
display: flex;
|
| 1454 |
+
flex-direction: column;
|
| 1455 |
+
height: calc(100vh - 4rem);
|
| 1456 |
+
background: white;
|
| 1457 |
+
border-radius: var(--border-radius-xl);
|
| 1458 |
+
overflow: hidden;
|
| 1459 |
+
box-shadow: var(--card-shadow);
|
| 1460 |
+
}
|
| 1461 |
+
|
| 1462 |
+
.chat-header {
|
| 1463 |
+
display: flex;
|
| 1464 |
+
align-items: center;
|
| 1465 |
+
gap: 1rem;
|
| 1466 |
+
padding: 1rem 1.5rem;
|
| 1467 |
+
border-bottom: 1px solid var(--gray-100);
|
| 1468 |
+
}
|
| 1469 |
+
|
| 1470 |
+
.chat-agent-icon {
|
| 1471 |
+
width: 44px;
|
| 1472 |
+
height: 44px;
|
| 1473 |
+
border-radius: 12px;
|
| 1474 |
+
display: flex;
|
| 1475 |
+
align-items: center;
|
| 1476 |
+
justify-content: center;
|
| 1477 |
+
font-size: 1.5rem;
|
| 1478 |
+
}
|
| 1479 |
+
|
| 1480 |
+
.chat-agent-info {
|
| 1481 |
+
flex: 1;
|
| 1482 |
+
}
|
| 1483 |
+
|
| 1484 |
+
.chat-agent-name {
|
| 1485 |
+
font-weight: 600;
|
| 1486 |
+
color: var(--gray-900);
|
| 1487 |
+
}
|
| 1488 |
+
|
| 1489 |
+
.chat-agent-status {
|
| 1490 |
+
font-size: 0.8125rem;
|
| 1491 |
+
color: var(--success);
|
| 1492 |
+
}
|
| 1493 |
+
|
| 1494 |
+
.chat-messages {
|
| 1495 |
+
flex: 1;
|
| 1496 |
+
overflow-y: auto;
|
| 1497 |
+
padding: 1.5rem;
|
| 1498 |
+
display: flex;
|
| 1499 |
+
flex-direction: column;
|
| 1500 |
+
gap: 1rem;
|
| 1501 |
+
}
|
| 1502 |
+
|
| 1503 |
+
.message {
|
| 1504 |
+
display: flex;
|
| 1505 |
+
gap: 0.75rem;
|
| 1506 |
+
max-width: 80%;
|
| 1507 |
+
animation: fadeInUp var(--transition-normal) ease;
|
| 1508 |
+
}
|
| 1509 |
+
|
| 1510 |
+
.message.user {
|
| 1511 |
+
margin-left: auto;
|
| 1512 |
+
flex-direction: row-reverse;
|
| 1513 |
+
}
|
| 1514 |
+
|
| 1515 |
+
.message-avatar {
|
| 1516 |
+
width: 36px;
|
| 1517 |
+
height: 36px;
|
| 1518 |
+
border-radius: 50%;
|
| 1519 |
+
display: flex;
|
| 1520 |
+
align-items: center;
|
| 1521 |
+
justify-content: center;
|
| 1522 |
+
font-size: 1rem;
|
| 1523 |
+
flex-shrink: 0;
|
| 1524 |
+
}
|
| 1525 |
+
|
| 1526 |
+
.message-bubble {
|
| 1527 |
+
padding: 0.75rem 1rem;
|
| 1528 |
+
border-radius: 16px;
|
| 1529 |
+
font-size: 0.9375rem;
|
| 1530 |
+
line-height: 1.5;
|
| 1531 |
+
}
|
| 1532 |
+
|
| 1533 |
+
.message.agent .message-bubble {
|
| 1534 |
+
background: var(--gray-100);
|
| 1535 |
+
color: var(--gray-900);
|
| 1536 |
+
border-bottom-left-radius: 4px;
|
| 1537 |
+
}
|
| 1538 |
+
|
| 1539 |
+
.message.user .message-bubble {
|
| 1540 |
+
background: var(--primary-600);
|
| 1541 |
+
color: white;
|
| 1542 |
+
border-bottom-right-radius: 4px;
|
| 1543 |
+
}
|
| 1544 |
+
|
| 1545 |
+
.message-time {
|
| 1546 |
+
font-size: 0.6875rem;
|
| 1547 |
+
color: var(--gray-400);
|
| 1548 |
+
margin-top: 0.375rem;
|
| 1549 |
+
}
|
| 1550 |
+
|
| 1551 |
+
.typing-indicator {
|
| 1552 |
+
display: flex;
|
| 1553 |
+
gap: 0.375rem;
|
| 1554 |
+
padding: 0.75rem 1rem;
|
| 1555 |
+
background: var(--gray-100);
|
| 1556 |
+
border-radius: 16px;
|
| 1557 |
+
width: fit-content;
|
| 1558 |
+
}
|
| 1559 |
+
|
| 1560 |
+
.typing-dot {
|
| 1561 |
+
width: 8px;
|
| 1562 |
+
height: 8px;
|
| 1563 |
+
background: var(--gray-400);
|
| 1564 |
+
border-radius: 50%;
|
| 1565 |
+
animation: typingBounce 1.4s infinite ease-in-out both;
|
| 1566 |
+
}
|
| 1567 |
+
|
| 1568 |
+
.typing-dot:nth-child(1) {
|
| 1569 |
+
animation-delay: -0.32s;
|
| 1570 |
+
}
|
| 1571 |
+
|
| 1572 |
+
.typing-dot:nth-child(2) {
|
| 1573 |
+
animation-delay: -0.16s;
|
| 1574 |
+
}
|
| 1575 |
+
|
| 1576 |
+
.chat-input-container {
|
| 1577 |
+
display: flex;
|
| 1578 |
+
align-items: center;
|
| 1579 |
+
gap: 0.75rem;
|
| 1580 |
+
padding: 1rem 1.5rem;
|
| 1581 |
+
border-top: 1px solid var(--gray-100);
|
| 1582 |
+
}
|
| 1583 |
+
|
| 1584 |
+
.chat-input {
|
| 1585 |
+
flex: 1;
|
| 1586 |
+
padding: 0.75rem 1rem;
|
| 1587 |
+
border: 1px solid var(--border-color);
|
| 1588 |
+
border-radius: 24px;
|
| 1589 |
+
font-size: 0.9375rem;
|
| 1590 |
+
transition: all var(--transition-fast);
|
| 1591 |
+
}
|
| 1592 |
+
|
| 1593 |
+
.chat-input:focus {
|
| 1594 |
+
outline: none;
|
| 1595 |
+
border-color: var(--primary-500);
|
| 1596 |
+
}
|
| 1597 |
+
|
| 1598 |
+
.chat-btn {
|
| 1599 |
+
width: 44px;
|
| 1600 |
+
height: 44px;
|
| 1601 |
+
border-radius: 50%;
|
| 1602 |
+
display: flex;
|
| 1603 |
+
align-items: center;
|
| 1604 |
+
justify-content: center;
|
| 1605 |
+
font-size: 1.25rem;
|
| 1606 |
+
transition: all var(--transition-fast);
|
| 1607 |
+
}
|
| 1608 |
+
|
| 1609 |
+
.chat-send-btn {
|
| 1610 |
+
background: var(--primary-600);
|
| 1611 |
+
color: white;
|
| 1612 |
+
}
|
| 1613 |
+
|
| 1614 |
+
.chat-send-btn:hover {
|
| 1615 |
+
background: var(--primary-700);
|
| 1616 |
+
}
|
| 1617 |
+
|
| 1618 |
+
.chat-mic-btn {
|
| 1619 |
+
background: var(--gray-100);
|
| 1620 |
+
color: var(--gray-600);
|
| 1621 |
+
}
|
| 1622 |
+
|
| 1623 |
+
.chat-mic-btn:hover {
|
| 1624 |
+
background: var(--gray-200);
|
| 1625 |
+
}
|
| 1626 |
+
|
| 1627 |
+
.chat-mic-btn.recording {
|
| 1628 |
+
background: var(--error);
|
| 1629 |
+
color: white;
|
| 1630 |
+
animation: pulse 1.5s infinite;
|
| 1631 |
+
}
|
| 1632 |
+
|
| 1633 |
+
/* ============================================================================
|
| 1634 |
+
Video Call Interface
|
| 1635 |
+
============================================================================ */
|
| 1636 |
+
.video-call-container {
|
| 1637 |
+
position: fixed;
|
| 1638 |
+
inset: 0;
|
| 1639 |
+
background: var(--gray-900);
|
| 1640 |
+
display: flex;
|
| 1641 |
+
flex-direction: column;
|
| 1642 |
+
z-index: 1000;
|
| 1643 |
+
}
|
| 1644 |
+
|
| 1645 |
+
.video-call-main {
|
| 1646 |
+
flex: 1;
|
| 1647 |
+
display: grid;
|
| 1648 |
+
grid-template-columns: 1fr 1fr;
|
| 1649 |
+
gap: 1rem;
|
| 1650 |
+
padding: 1rem;
|
| 1651 |
+
}
|
| 1652 |
+
|
| 1653 |
+
.video-panel {
|
| 1654 |
+
border-radius: var(--border-radius-xl);
|
| 1655 |
+
overflow: hidden;
|
| 1656 |
+
position: relative;
|
| 1657 |
+
background: var(--gray-800);
|
| 1658 |
+
display: flex;
|
| 1659 |
+
align-items: center;
|
| 1660 |
+
justify-content: center;
|
| 1661 |
+
}
|
| 1662 |
+
|
| 1663 |
+
.ai-avatar {
|
| 1664 |
+
display: flex;
|
| 1665 |
+
flex-direction: column;
|
| 1666 |
+
align-items: center;
|
| 1667 |
+
gap: 1.5rem;
|
| 1668 |
+
}
|
| 1669 |
+
|
| 1670 |
+
.ai-avatar-icon {
|
| 1671 |
+
font-size: 8rem;
|
| 1672 |
+
animation: float 3s ease-in-out infinite;
|
| 1673 |
+
}
|
| 1674 |
+
|
| 1675 |
+
.ai-avatar-name {
|
| 1676 |
+
font-size: 1.5rem;
|
| 1677 |
+
font-weight: 600;
|
| 1678 |
+
color: white;
|
| 1679 |
+
}
|
| 1680 |
+
|
| 1681 |
+
.user-video {
|
| 1682 |
+
width: 100%;
|
| 1683 |
+
height: 100%;
|
| 1684 |
+
object-fit: cover;
|
| 1685 |
+
transform: scaleX(-1);
|
| 1686 |
+
}
|
| 1687 |
+
|
| 1688 |
+
.video-label {
|
| 1689 |
+
position: absolute;
|
| 1690 |
+
bottom: 1rem;
|
| 1691 |
+
left: 1rem;
|
| 1692 |
+
background: rgba(0, 0, 0, 0.6);
|
| 1693 |
+
color: white;
|
| 1694 |
+
padding: 0.5rem 0.75rem;
|
| 1695 |
+
border-radius: var(--border-radius);
|
| 1696 |
+
font-size: 0.875rem;
|
| 1697 |
+
}
|
| 1698 |
+
|
| 1699 |
+
.call-timer {
|
| 1700 |
+
position: absolute;
|
| 1701 |
+
top: 1rem;
|
| 1702 |
+
right: 1rem;
|
| 1703 |
+
background: rgba(0, 0, 0, 0.6);
|
| 1704 |
+
color: white;
|
| 1705 |
+
padding: 0.5rem 0.75rem;
|
| 1706 |
+
border-radius: var(--border-radius);
|
| 1707 |
+
font-size: 0.875rem;
|
| 1708 |
+
font-family: monospace;
|
| 1709 |
+
}
|
| 1710 |
+
|
| 1711 |
+
.subtitles {
|
| 1712 |
+
position: absolute;
|
| 1713 |
+
bottom: 2rem;
|
| 1714 |
+
left: 50%;
|
| 1715 |
+
transform: translateX(-50%);
|
| 1716 |
+
background: rgba(0, 0, 0, 0.8);
|
| 1717 |
+
color: white;
|
| 1718 |
+
padding: 0.75rem 1.5rem;
|
| 1719 |
+
border-radius: var(--border-radius);
|
| 1720 |
+
max-width: 80%;
|
| 1721 |
+
text-align: center;
|
| 1722 |
+
font-size: 1.125rem;
|
| 1723 |
+
}
|
| 1724 |
+
|
| 1725 |
+
.video-controls {
|
| 1726 |
+
display: flex;
|
| 1727 |
+
align-items: center;
|
| 1728 |
+
justify-content: center;
|
| 1729 |
+
gap: 1rem;
|
| 1730 |
+
padding: 1.5rem;
|
| 1731 |
+
background: rgba(0, 0, 0, 0.3);
|
| 1732 |
+
}
|
| 1733 |
+
|
| 1734 |
+
.control-btn {
|
| 1735 |
+
width: 56px;
|
| 1736 |
+
height: 56px;
|
| 1737 |
+
border-radius: 50%;
|
| 1738 |
+
display: flex;
|
| 1739 |
+
align-items: center;
|
| 1740 |
+
justify-content: center;
|
| 1741 |
+
font-size: 1.5rem;
|
| 1742 |
+
transition: all var(--transition-fast);
|
| 1743 |
+
background: rgba(255, 255, 255, 0.1);
|
| 1744 |
+
color: white;
|
| 1745 |
+
}
|
| 1746 |
+
|
| 1747 |
+
.control-btn:hover {
|
| 1748 |
+
background: rgba(255, 255, 255, 0.2);
|
| 1749 |
+
}
|
| 1750 |
+
|
| 1751 |
+
.control-btn.active {
|
| 1752 |
+
background: var(--primary-600);
|
| 1753 |
+
}
|
| 1754 |
+
|
| 1755 |
+
.control-btn.danger {
|
| 1756 |
+
background: var(--error);
|
| 1757 |
+
}
|
| 1758 |
+
|
| 1759 |
+
.control-btn.danger:hover {
|
| 1760 |
+
background: #dc2626;
|
| 1761 |
+
}
|
| 1762 |
+
|
| 1763 |
+
/* Chat Drawer */
|
| 1764 |
+
.chat-drawer {
|
| 1765 |
+
position: fixed;
|
| 1766 |
+
right: 0;
|
| 1767 |
+
top: 0;
|
| 1768 |
+
height: 100%;
|
| 1769 |
+
width: 380px;
|
| 1770 |
+
background: white;
|
| 1771 |
+
box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2);
|
| 1772 |
+
transform: translateX(100%);
|
| 1773 |
+
transition: transform var(--transition-normal);
|
| 1774 |
+
display: flex;
|
| 1775 |
+
flex-direction: column;
|
| 1776 |
+
z-index: 1001;
|
| 1777 |
+
}
|
| 1778 |
+
|
| 1779 |
+
.chat-drawer.open {
|
| 1780 |
+
transform: translateX(0);
|
| 1781 |
+
}
|
| 1782 |
+
|
| 1783 |
+
.drawer-header {
|
| 1784 |
+
display: flex;
|
| 1785 |
+
align-items: center;
|
| 1786 |
+
justify-content: space-between;
|
| 1787 |
+
padding: 1rem;
|
| 1788 |
+
border-bottom: 1px solid var(--gray-100);
|
| 1789 |
+
}
|
| 1790 |
+
|
| 1791 |
+
.drawer-title {
|
| 1792 |
+
font-weight: 600;
|
| 1793 |
+
color: var(--gray-900);
|
| 1794 |
+
}
|
| 1795 |
+
|
| 1796 |
+
.drawer-close {
|
| 1797 |
+
width: 32px;
|
| 1798 |
+
height: 32px;
|
| 1799 |
+
display: flex;
|
| 1800 |
+
align-items: center;
|
| 1801 |
+
justify-content: center;
|
| 1802 |
+
font-size: 1.25rem;
|
| 1803 |
+
color: var(--gray-400);
|
| 1804 |
+
border-radius: var(--border-radius);
|
| 1805 |
+
}
|
| 1806 |
+
|
| 1807 |
+
.drawer-close:hover {
|
| 1808 |
+
background: var(--gray-100);
|
| 1809 |
+
color: var(--gray-600);
|
| 1810 |
+
}
|
| 1811 |
+
|
| 1812 |
+
/* ============================================================================
|
| 1813 |
+
Wizard Steps
|
| 1814 |
+
============================================================================ */
|
| 1815 |
+
.wizard-progress {
|
| 1816 |
+
display: flex;
|
| 1817 |
+
align-items: center;
|
| 1818 |
+
justify-content: center;
|
| 1819 |
+
gap: 0;
|
| 1820 |
+
margin-bottom: 2rem;
|
| 1821 |
+
}
|
| 1822 |
+
|
| 1823 |
+
.wizard-step {
|
| 1824 |
+
display: flex;
|
| 1825 |
+
align-items: center;
|
| 1826 |
+
}
|
| 1827 |
+
|
| 1828 |
+
.step-indicator {
|
| 1829 |
+
display: flex;
|
| 1830 |
+
flex-direction: column;
|
| 1831 |
+
align-items: center;
|
| 1832 |
+
gap: 0.5rem;
|
| 1833 |
+
}
|
| 1834 |
+
|
| 1835 |
+
.step-circle {
|
| 1836 |
+
width: 40px;
|
| 1837 |
+
height: 40px;
|
| 1838 |
+
border-radius: 50%;
|
| 1839 |
+
display: flex;
|
| 1840 |
+
align-items: center;
|
| 1841 |
+
justify-content: center;
|
| 1842 |
+
font-weight: 600;
|
| 1843 |
+
background: var(--gray-100);
|
| 1844 |
+
color: var(--gray-500);
|
| 1845 |
+
transition: all var(--transition-fast);
|
| 1846 |
+
}
|
| 1847 |
+
|
| 1848 |
+
.step-indicator.active .step-circle,
|
| 1849 |
+
.step-indicator.completed .step-circle {
|
| 1850 |
+
background: var(--primary-600);
|
| 1851 |
+
color: white;
|
| 1852 |
+
}
|
| 1853 |
+
|
| 1854 |
+
.step-indicator.completed .step-circle::after {
|
| 1855 |
+
content: '✓';
|
| 1856 |
+
}
|
| 1857 |
+
|
| 1858 |
+
.step-label {
|
| 1859 |
+
font-size: 0.75rem;
|
| 1860 |
+
font-weight: 500;
|
| 1861 |
+
color: var(--gray-500);
|
| 1862 |
+
}
|
| 1863 |
+
|
| 1864 |
+
.step-indicator.active .step-label {
|
| 1865 |
+
color: var(--primary-600);
|
| 1866 |
+
}
|
| 1867 |
+
|
| 1868 |
+
.step-connector {
|
| 1869 |
+
width: 60px;
|
| 1870 |
+
height: 2px;
|
| 1871 |
+
background: var(--gray-200);
|
| 1872 |
+
margin: 0 0.5rem;
|
| 1873 |
+
margin-bottom: 1.5rem;
|
| 1874 |
+
}
|
| 1875 |
+
|
| 1876 |
+
.step-connector.completed {
|
| 1877 |
+
background: var(--primary-600);
|
| 1878 |
+
}
|
| 1879 |
+
|
| 1880 |
+
/* ============================================================================
|
| 1881 |
+
Auth Pages
|
| 1882 |
+
============================================================================ */
|
| 1883 |
+
.auth-container {
|
| 1884 |
+
min-height: 100vh;
|
| 1885 |
+
display: flex;
|
| 1886 |
+
align-items: center;
|
| 1887 |
+
justify-content: center;
|
| 1888 |
+
padding: 2rem;
|
| 1889 |
+
background: #f0f2f5;
|
| 1890 |
+
}
|
| 1891 |
+
|
| 1892 |
+
.auth-card {
|
| 1893 |
+
width: 100%;
|
| 1894 |
+
max-width: 440px;
|
| 1895 |
+
background: white;
|
| 1896 |
+
border-radius: 20px;
|
| 1897 |
+
padding: 2.5rem 2.5rem 2rem;
|
| 1898 |
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
|
| 1899 |
+
animation: fadeInUp var(--transition-normal) ease;
|
| 1900 |
+
}
|
| 1901 |
+
|
| 1902 |
+
/* Logo Avatar Circle */
|
| 1903 |
+
.auth-logo {
|
| 1904 |
+
display: flex;
|
| 1905 |
+
flex-direction: column;
|
| 1906 |
+
align-items: center;
|
| 1907 |
+
justify-content: center;
|
| 1908 |
+
gap: 0;
|
| 1909 |
+
margin-bottom: 1.25rem;
|
| 1910 |
+
}
|
| 1911 |
+
|
| 1912 |
+
.auth-logo-avatar {
|
| 1913 |
+
width: 88px;
|
| 1914 |
+
height: 88px;
|
| 1915 |
+
border-radius: 50%;
|
| 1916 |
+
display: flex;
|
| 1917 |
+
align-items: center;
|
| 1918 |
+
justify-content: center;
|
| 1919 |
+
margin-bottom: 1.25rem;
|
| 1920 |
+
overflow: hidden;
|
| 1921 |
+
}
|
| 1922 |
+
|
| 1923 |
+
.auth-logo-avatar img {
|
| 1924 |
+
width: 100%;
|
| 1925 |
+
height: 100%;
|
| 1926 |
+
object-fit: cover;
|
| 1927 |
+
}
|
| 1928 |
+
|
| 1929 |
+
.auth-logo-icon {
|
| 1930 |
+
font-size: 2.5rem;
|
| 1931 |
+
display: none;
|
| 1932 |
+
}
|
| 1933 |
+
|
| 1934 |
+
.auth-logo-text {
|
| 1935 |
+
font-size: 1.75rem;
|
| 1936 |
+
font-weight: 700;
|
| 1937 |
+
color: var(--gray-900);
|
| 1938 |
+
display: none;
|
| 1939 |
+
}
|
| 1940 |
+
|
| 1941 |
+
.auth-title {
|
| 1942 |
+
text-align: center;
|
| 1943 |
+
font-size: 1.5rem;
|
| 1944 |
+
font-weight: 700;
|
| 1945 |
+
color: #1a1a2e;
|
| 1946 |
+
margin-bottom: 0.375rem;
|
| 1947 |
+
letter-spacing: -0.02em;
|
| 1948 |
+
}
|
| 1949 |
+
|
| 1950 |
+
.auth-subtitle {
|
| 1951 |
+
text-align: center;
|
| 1952 |
+
font-size: 0.9375rem;
|
| 1953 |
+
color: var(--gray-500);
|
| 1954 |
+
margin-bottom: 1.75rem;
|
| 1955 |
+
}
|
| 1956 |
+
|
| 1957 |
+
/* Social Login Buttons */
|
| 1958 |
+
.auth-social-row {
|
| 1959 |
+
display: flex;
|
| 1960 |
+
align-items: center;
|
| 1961 |
+
justify-content: center;
|
| 1962 |
+
gap: 0.75rem;
|
| 1963 |
+
margin-bottom: 1.75rem;
|
| 1964 |
+
}
|
| 1965 |
+
|
| 1966 |
+
.social-btn {
|
| 1967 |
+
display: flex;
|
| 1968 |
+
align-items: center;
|
| 1969 |
+
justify-content: center;
|
| 1970 |
+
width: 52px;
|
| 1971 |
+
height: 44px;
|
| 1972 |
+
border-radius: 10px;
|
| 1973 |
+
border: 1px solid var(--gray-200);
|
| 1974 |
+
background: white;
|
| 1975 |
+
cursor: pointer;
|
| 1976 |
+
transition: all var(--transition-fast);
|
| 1977 |
+
}
|
| 1978 |
+
|
| 1979 |
+
.social-btn:hover {
|
| 1980 |
+
border-color: var(--gray-300);
|
| 1981 |
+
background: var(--gray-50);
|
| 1982 |
+
transform: translateY(-1px);
|
| 1983 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
| 1984 |
+
}
|
| 1985 |
+
|
| 1986 |
+
.social-btn svg {
|
| 1987 |
+
width: 20px;
|
| 1988 |
+
height: 20px;
|
| 1989 |
+
}
|
| 1990 |
+
|
| 1991 |
+
/* Auth Divider */
|
| 1992 |
+
.auth-divider {
|
| 1993 |
+
display: flex;
|
| 1994 |
+
align-items: center;
|
| 1995 |
+
gap: 1rem;
|
| 1996 |
+
margin-bottom: 1.5rem;
|
| 1997 |
+
}
|
| 1998 |
+
|
| 1999 |
+
.auth-divider::before,
|
| 2000 |
+
.auth-divider::after {
|
| 2001 |
+
content: '';
|
| 2002 |
+
flex: 1;
|
| 2003 |
+
height: 1px;
|
| 2004 |
+
background: var(--gray-200);
|
| 2005 |
+
}
|
| 2006 |
+
|
| 2007 |
+
.auth-divider span {
|
| 2008 |
+
font-size: 0.8125rem;
|
| 2009 |
+
color: var(--gray-400);
|
| 2010 |
+
font-weight: 500;
|
| 2011 |
+
}
|
| 2012 |
+
|
| 2013 |
+
/* Auth Form Fields */
|
| 2014 |
+
.auth-card .form-group {
|
| 2015 |
+
margin-bottom: 1rem;
|
| 2016 |
+
}
|
| 2017 |
+
|
| 2018 |
+
.auth-card .form-label {
|
| 2019 |
+
font-size: 0.8125rem;
|
| 2020 |
+
font-weight: 500;
|
| 2021 |
+
color: var(--gray-600);
|
| 2022 |
+
margin-bottom: 0.375rem;
|
| 2023 |
+
}
|
| 2024 |
+
|
| 2025 |
+
.auth-input-wrapper {
|
| 2026 |
+
position: relative;
|
| 2027 |
+
}
|
| 2028 |
+
|
| 2029 |
+
.auth-input-wrapper .form-input {
|
| 2030 |
+
padding-left: 2.75rem;
|
| 2031 |
+
height: 46px;
|
| 2032 |
+
border-radius: 10px;
|
| 2033 |
+
border: 1.5px solid var(--gray-200);
|
| 2034 |
+
font-size: 0.9375rem;
|
| 2035 |
+
transition: all var(--transition-fast);
|
| 2036 |
+
}
|
| 2037 |
+
|
| 2038 |
+
.auth-input-wrapper .form-input:focus {
|
| 2039 |
+
border-color: #1a1a2e;
|
| 2040 |
+
box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.08);
|
| 2041 |
+
}
|
| 2042 |
+
|
| 2043 |
+
.auth-input-icon {
|
| 2044 |
+
position: absolute;
|
| 2045 |
+
left: 0.875rem;
|
| 2046 |
+
top: 50%;
|
| 2047 |
+
transform: translateY(-50%);
|
| 2048 |
+
color: var(--gray-400);
|
| 2049 |
+
display: flex;
|
| 2050 |
+
align-items: center;
|
| 2051 |
+
pointer-events: none;
|
| 2052 |
+
}
|
| 2053 |
+
|
| 2054 |
+
.auth-input-icon svg {
|
| 2055 |
+
width: 18px;
|
| 2056 |
+
height: 18px;
|
| 2057 |
+
}
|
| 2058 |
+
|
| 2059 |
+
/* Dark Login Button */
|
| 2060 |
+
.btn-auth-primary {
|
| 2061 |
+
width: 100%;
|
| 2062 |
+
padding: 0.875rem 1.75rem;
|
| 2063 |
+
border-radius: 10px;
|
| 2064 |
+
background: #1a1a2e;
|
| 2065 |
+
color: white;
|
| 2066 |
+
font-size: 0.9375rem;
|
| 2067 |
+
font-weight: 600;
|
| 2068 |
+
cursor: pointer;
|
| 2069 |
+
transition: all var(--transition-fast);
|
| 2070 |
+
display: flex;
|
| 2071 |
+
align-items: center;
|
| 2072 |
+
justify-content: center;
|
| 2073 |
+
gap: 0.5rem;
|
| 2074 |
+
border: none;
|
| 2075 |
+
margin-top: 0.5rem;
|
| 2076 |
+
}
|
| 2077 |
+
|
| 2078 |
+
.btn-auth-primary:hover {
|
| 2079 |
+
background: #16213e;
|
| 2080 |
+
transform: translateY(-1px);
|
| 2081 |
+
box-shadow: 0 4px 12px rgba(26, 26, 46, 0.2);
|
| 2082 |
+
}
|
| 2083 |
+
|
| 2084 |
+
.btn-auth-primary:active {
|
| 2085 |
+
transform: translateY(0);
|
| 2086 |
+
}
|
| 2087 |
+
|
| 2088 |
+
.btn-auth-primary:disabled {
|
| 2089 |
+
opacity: 0.6;
|
| 2090 |
+
cursor: not-allowed;
|
| 2091 |
+
transform: none;
|
| 2092 |
+
box-shadow: none;
|
| 2093 |
+
}
|
| 2094 |
+
|
| 2095 |
+
/* Auth Footer */
|
| 2096 |
+
.auth-footer {
|
| 2097 |
+
text-align: center;
|
| 2098 |
+
margin-top: 1.5rem;
|
| 2099 |
+
font-size: 0.9375rem;
|
| 2100 |
+
color: var(--gray-500);
|
| 2101 |
+
}
|
| 2102 |
+
|
| 2103 |
+
.auth-footer a {
|
| 2104 |
+
color: #1a1a2e;
|
| 2105 |
+
font-weight: 600;
|
| 2106 |
+
text-decoration: none;
|
| 2107 |
+
transition: color var(--transition-fast);
|
| 2108 |
+
}
|
| 2109 |
+
|
| 2110 |
+
.auth-footer a:hover {
|
| 2111 |
+
color: var(--primary-600);
|
| 2112 |
+
}
|
| 2113 |
+
|
| 2114 |
+
/* Forgot password link */
|
| 2115 |
+
.auth-forgot-link {
|
| 2116 |
+
display: block;
|
| 2117 |
+
text-align: right;
|
| 2118 |
+
font-size: 0.8125rem;
|
| 2119 |
+
color: var(--gray-500);
|
| 2120 |
+
margin-top: -0.25rem;
|
| 2121 |
+
margin-bottom: 0.75rem;
|
| 2122 |
+
transition: color var(--transition-fast);
|
| 2123 |
+
}
|
| 2124 |
+
|
| 2125 |
+
.auth-forgot-link:hover {
|
| 2126 |
+
color: #1a1a2e;
|
| 2127 |
+
}
|
| 2128 |
+
|
| 2129 |
+
/* ============================================================================
|
| 2130 |
+
Tables
|
| 2131 |
+
============================================================================ */
|
| 2132 |
+
.table-container {
|
| 2133 |
+
overflow-x: auto;
|
| 2134 |
+
}
|
| 2135 |
+
|
| 2136 |
+
table {
|
| 2137 |
+
width: 100%;
|
| 2138 |
+
border-collapse: collapse;
|
| 2139 |
+
}
|
| 2140 |
+
|
| 2141 |
+
th,
|
| 2142 |
+
td {
|
| 2143 |
+
padding: 1rem;
|
| 2144 |
+
text-align: left;
|
| 2145 |
+
border-bottom: 1px solid var(--gray-100);
|
| 2146 |
+
}
|
| 2147 |
+
|
| 2148 |
+
th {
|
| 2149 |
+
font-weight: 600;
|
| 2150 |
+
color: var(--gray-700);
|
| 2151 |
+
background: var(--gray-50);
|
| 2152 |
+
}
|
| 2153 |
+
|
| 2154 |
+
tr:hover td {
|
| 2155 |
+
background: var(--gray-50);
|
| 2156 |
+
}
|
| 2157 |
+
|
| 2158 |
+
/* ============================================================================
|
| 2159 |
+
Tabs
|
| 2160 |
+
============================================================================ */
|
| 2161 |
+
.tabs {
|
| 2162 |
+
display: flex;
|
| 2163 |
+
gap: 0;
|
| 2164 |
+
border-bottom: 2px solid var(--gray-100);
|
| 2165 |
+
margin-bottom: 1.5rem;
|
| 2166 |
+
}
|
| 2167 |
+
|
| 2168 |
+
.tab {
|
| 2169 |
+
padding: 0.75rem 1.25rem;
|
| 2170 |
+
font-weight: 500;
|
| 2171 |
+
color: var(--gray-500);
|
| 2172 |
+
border-bottom: 2px solid transparent;
|
| 2173 |
+
margin-bottom: -2px;
|
| 2174 |
+
transition: all var(--transition-fast);
|
| 2175 |
+
}
|
| 2176 |
+
|
| 2177 |
+
.tab:hover {
|
| 2178 |
+
color: var(--gray-700);
|
| 2179 |
+
}
|
| 2180 |
+
|
| 2181 |
+
.tab.active {
|
| 2182 |
+
color: var(--primary-600);
|
| 2183 |
+
border-bottom-color: var(--primary-600);
|
| 2184 |
+
}
|
| 2185 |
+
|
| 2186 |
+
.tab-content {
|
| 2187 |
+
display: none;
|
| 2188 |
+
}
|
| 2189 |
+
|
| 2190 |
+
.tab-content.active {
|
| 2191 |
+
display: block;
|
| 2192 |
+
}
|
| 2193 |
+
|
| 2194 |
+
/* ============================================================================
|
| 2195 |
+
Empty States
|
| 2196 |
+
============================================================================ */
|
| 2197 |
+
.empty-state {
|
| 2198 |
+
display: flex;
|
| 2199 |
+
flex-direction: column;
|
| 2200 |
+
align-items: center;
|
| 2201 |
+
justify-content: center;
|
| 2202 |
+
padding: 3rem;
|
| 2203 |
+
text-align: center;
|
| 2204 |
+
}
|
| 2205 |
+
|
| 2206 |
+
.empty-icon {
|
| 2207 |
+
font-size: 4rem;
|
| 2208 |
+
margin-bottom: 1rem;
|
| 2209 |
+
opacity: 0.5;
|
| 2210 |
+
}
|
| 2211 |
+
|
| 2212 |
+
.empty-title {
|
| 2213 |
+
font-size: 1.25rem;
|
| 2214 |
+
font-weight: 600;
|
| 2215 |
+
color: var(--gray-900);
|
| 2216 |
+
margin-bottom: 0.5rem;
|
| 2217 |
+
}
|
| 2218 |
+
|
| 2219 |
+
.empty-message {
|
| 2220 |
+
color: var(--gray-500);
|
| 2221 |
+
margin-bottom: 1.5rem;
|
| 2222 |
+
}
|
| 2223 |
+
|
| 2224 |
+
/* ============================================================================
|
| 2225 |
+
Loading Spinner
|
| 2226 |
+
============================================================================ */
|
| 2227 |
+
.spinner {
|
| 2228 |
+
width: 40px;
|
| 2229 |
+
height: 40px;
|
| 2230 |
+
border: 3px solid var(--gray-200);
|
| 2231 |
+
border-top-color: var(--primary-600);
|
| 2232 |
+
border-radius: 50%;
|
| 2233 |
+
animation: spin 1s linear infinite;
|
| 2234 |
+
}
|
| 2235 |
+
|
| 2236 |
+
.loading-overlay {
|
| 2237 |
+
position: fixed;
|
| 2238 |
+
inset: 0;
|
| 2239 |
+
background: rgba(255, 255, 255, 0.8);
|
| 2240 |
+
display: flex;
|
| 2241 |
+
align-items: center;
|
| 2242 |
+
justify-content: center;
|
| 2243 |
+
z-index: 3000;
|
| 2244 |
+
}
|
| 2245 |
+
|
| 2246 |
+
/* ============================================================================
|
| 2247 |
+
Score Display
|
| 2248 |
+
============================================================================ */
|
| 2249 |
+
.score-circle {
|
| 2250 |
+
width: 100px;
|
| 2251 |
+
height: 100px;
|
| 2252 |
+
border-radius: 50%;
|
| 2253 |
+
display: flex;
|
| 2254 |
+
flex-direction: column;
|
| 2255 |
+
align-items: center;
|
| 2256 |
+
justify-content: center;
|
| 2257 |
+
background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
|
| 2258 |
+
color: white;
|
| 2259 |
+
}
|
| 2260 |
+
|
| 2261 |
+
.score-value {
|
| 2262 |
+
font-size: 2rem;
|
| 2263 |
+
font-weight: 700;
|
| 2264 |
+
}
|
| 2265 |
+
|
| 2266 |
+
.score-label {
|
| 2267 |
+
font-size: 0.75rem;
|
| 2268 |
+
opacity: 0.8;
|
| 2269 |
+
}
|
| 2270 |
+
|
| 2271 |
+
.criteria-score {
|
| 2272 |
+
display: flex;
|
| 2273 |
+
align-items: center;
|
| 2274 |
+
gap: 1rem;
|
| 2275 |
+
margin-bottom: 0.75rem;
|
| 2276 |
+
}
|
| 2277 |
+
|
| 2278 |
+
.criteria-name {
|
| 2279 |
+
flex: 1;
|
| 2280 |
+
font-size: 0.9375rem;
|
| 2281 |
+
color: var(--gray-700);
|
| 2282 |
+
}
|
| 2283 |
+
|
| 2284 |
+
.criteria-bar {
|
| 2285 |
+
flex: 1;
|
| 2286 |
+
height: 8px;
|
| 2287 |
+
background: var(--gray-200);
|
| 2288 |
+
border-radius: 4px;
|
| 2289 |
+
overflow: hidden;
|
| 2290 |
+
}
|
| 2291 |
+
|
| 2292 |
+
.criteria-fill {
|
| 2293 |
+
height: 100%;
|
| 2294 |
+
background: var(--primary-500);
|
| 2295 |
+
border-radius: 4px;
|
| 2296 |
+
transition: width var(--transition-slow) ease;
|
| 2297 |
+
}
|
| 2298 |
+
|
| 2299 |
+
.criteria-value {
|
| 2300 |
+
width: 40px;
|
| 2301 |
+
text-align: right;
|
| 2302 |
+
font-weight: 600;
|
| 2303 |
+
color: var(--gray-900);
|
| 2304 |
+
}
|
| 2305 |
+
|
| 2306 |
+
/* ============================================================================
|
| 2307 |
+
Animations
|
| 2308 |
+
============================================================================ */
|
| 2309 |
+
@keyframes fadeIn {
|
| 2310 |
+
from {
|
| 2311 |
+
opacity: 0;
|
| 2312 |
+
}
|
| 2313 |
+
|
| 2314 |
+
to {
|
| 2315 |
+
opacity: 1;
|
| 2316 |
+
}
|
| 2317 |
+
}
|
| 2318 |
+
|
| 2319 |
+
@keyframes fadeInUp {
|
| 2320 |
+
from {
|
| 2321 |
+
opacity: 0;
|
| 2322 |
+
transform: translateY(10px);
|
| 2323 |
+
}
|
| 2324 |
+
|
| 2325 |
+
to {
|
| 2326 |
+
opacity: 1;
|
| 2327 |
+
transform: translateY(0);
|
| 2328 |
+
}
|
| 2329 |
+
}
|
| 2330 |
+
|
| 2331 |
+
@keyframes slideUp {
|
| 2332 |
+
from {
|
| 2333 |
+
opacity: 0;
|
| 2334 |
+
transform: translateY(20px);
|
| 2335 |
+
}
|
| 2336 |
+
|
| 2337 |
+
to {
|
| 2338 |
+
opacity: 1;
|
| 2339 |
+
transform: translateY(0);
|
| 2340 |
+
}
|
| 2341 |
+
}
|
| 2342 |
+
|
| 2343 |
+
@keyframes slideInRight {
|
| 2344 |
+
from {
|
| 2345 |
+
opacity: 0;
|
| 2346 |
+
transform: translateX(20px);
|
| 2347 |
+
}
|
| 2348 |
+
|
| 2349 |
+
to {
|
| 2350 |
+
opacity: 1;
|
| 2351 |
+
transform: translateX(0);
|
| 2352 |
+
}
|
| 2353 |
+
}
|
| 2354 |
+
|
| 2355 |
+
@keyframes spin {
|
| 2356 |
+
to {
|
| 2357 |
+
transform: rotate(360deg);
|
| 2358 |
+
}
|
| 2359 |
+
}
|
| 2360 |
+
|
| 2361 |
+
@keyframes typingBounce {
|
| 2362 |
+
|
| 2363 |
+
0%,
|
| 2364 |
+
80%,
|
| 2365 |
+
100% {
|
| 2366 |
+
transform: scale(0.8);
|
| 2367 |
+
}
|
| 2368 |
+
|
| 2369 |
+
40% {
|
| 2370 |
+
transform: scale(1.2);
|
| 2371 |
+
}
|
| 2372 |
+
}
|
| 2373 |
+
|
| 2374 |
+
@keyframes float {
|
| 2375 |
+
|
| 2376 |
+
0%,
|
| 2377 |
+
100% {
|
| 2378 |
+
transform: translateY(0);
|
| 2379 |
+
}
|
| 2380 |
+
|
| 2381 |
+
50% {
|
| 2382 |
+
transform: translateY(-10px);
|
| 2383 |
+
}
|
| 2384 |
+
}
|
| 2385 |
+
|
| 2386 |
+
@keyframes pulse {
|
| 2387 |
+
|
| 2388 |
+
0%,
|
| 2389 |
+
100% {
|
| 2390 |
+
opacity: 1;
|
| 2391 |
+
}
|
| 2392 |
+
|
| 2393 |
+
50% {
|
| 2394 |
+
opacity: 0.7;
|
| 2395 |
+
}
|
| 2396 |
+
}
|
| 2397 |
+
|
| 2398 |
+
/* ============================================================================
|
| 2399 |
+
Utilities
|
| 2400 |
+
============================================================================ */
|
| 2401 |
+
.hidden {
|
| 2402 |
+
display: none !important;
|
| 2403 |
+
}
|
| 2404 |
+
|
| 2405 |
+
.flex {
|
| 2406 |
+
display: flex;
|
| 2407 |
+
}
|
| 2408 |
+
|
| 2409 |
+
.flex-col {
|
| 2410 |
+
flex-direction: column;
|
| 2411 |
+
}
|
| 2412 |
+
|
| 2413 |
+
.items-center {
|
| 2414 |
+
align-items: center;
|
| 2415 |
+
}
|
| 2416 |
+
|
| 2417 |
+
.justify-center {
|
| 2418 |
+
justify-content: center;
|
| 2419 |
+
}
|
| 2420 |
+
|
| 2421 |
+
.justify-between {
|
| 2422 |
+
justify-content: space-between;
|
| 2423 |
+
}
|
| 2424 |
+
|
| 2425 |
+
.gap-1 {
|
| 2426 |
+
gap: 0.25rem;
|
| 2427 |
+
}
|
| 2428 |
+
|
| 2429 |
+
.gap-2 {
|
| 2430 |
+
gap: 0.5rem;
|
| 2431 |
+
}
|
| 2432 |
+
|
| 2433 |
+
.gap-3 {
|
| 2434 |
+
gap: 0.75rem;
|
| 2435 |
+
}
|
| 2436 |
+
|
| 2437 |
+
.gap-4 {
|
| 2438 |
+
gap: 1rem;
|
| 2439 |
+
}
|
| 2440 |
+
|
| 2441 |
+
.text-center {
|
| 2442 |
+
text-align: center;
|
| 2443 |
+
}
|
| 2444 |
+
|
| 2445 |
+
.mb-0 {
|
| 2446 |
+
margin-bottom: 0;
|
| 2447 |
+
}
|
| 2448 |
+
|
| 2449 |
+
.mb-1 {
|
| 2450 |
+
margin-bottom: 0.25rem;
|
| 2451 |
+
}
|
| 2452 |
+
|
| 2453 |
+
.mb-2 {
|
| 2454 |
+
margin-bottom: 0.5rem;
|
| 2455 |
+
}
|
| 2456 |
+
|
| 2457 |
+
.mb-3 {
|
| 2458 |
+
margin-bottom: 0.75rem;
|
| 2459 |
+
}
|
| 2460 |
+
|
| 2461 |
+
.mb-4 {
|
| 2462 |
+
margin-bottom: 1rem;
|
| 2463 |
+
}
|
| 2464 |
+
|
| 2465 |
+
.mt-auto {
|
| 2466 |
+
margin-top: auto;
|
| 2467 |
+
}
|
| 2468 |
+
|
| 2469 |
+
.w-full {
|
| 2470 |
+
width: 100%;
|
| 2471 |
+
}
|
| 2472 |
+
|
| 2473 |
+
/* ============================================================================
|
| 2474 |
+
Responsive
|
| 2475 |
+
============================================================================ */
|
| 2476 |
+
@media (max-width: 1024px) {
|
| 2477 |
+
.video-call-main {
|
| 2478 |
+
grid-template-columns: 1fr;
|
| 2479 |
+
}
|
| 2480 |
+
}
|
| 2481 |
+
|
| 2482 |
+
@media (max-width: 768px) {
|
| 2483 |
+
:root {
|
| 2484 |
+
--sidebar-width: 0px;
|
| 2485 |
+
}
|
| 2486 |
+
|
| 2487 |
+
.sidebar {
|
| 2488 |
+
width: 260px;
|
| 2489 |
+
}
|
| 2490 |
+
|
| 2491 |
+
.main-content {
|
| 2492 |
+
margin-left: 0;
|
| 2493 |
+
padding: 1rem;
|
| 2494 |
+
}
|
| 2495 |
+
|
| 2496 |
+
.stats-grid {
|
| 2497 |
+
grid-template-columns: repeat(2, 1fr);
|
| 2498 |
+
}
|
| 2499 |
+
|
| 2500 |
+
.agents-grid {
|
| 2501 |
+
grid-template-columns: 1fr;
|
| 2502 |
+
}
|
| 2503 |
+
|
| 2504 |
+
.message {
|
| 2505 |
+
max-width: 90%;
|
| 2506 |
+
}
|
| 2507 |
+
|
| 2508 |
+
.chat-drawer {
|
| 2509 |
+
width: 100%;
|
| 2510 |
+
}
|
| 2511 |
+
}
|
| 2512 |
+
|
| 2513 |
+
/* Sidebar Updates */
|
| 2514 |
+
.logo {
|
| 2515 |
+
align-items: flex-start !important;
|
| 2516 |
+
}
|
| 2517 |
+
|
| 2518 |
+
.logo-subtitle {
|
| 2519 |
+
font-size: 0.65rem;
|
| 2520 |
+
color: var(--gray-400);
|
| 2521 |
+
line-height: 1.2;
|
| 2522 |
+
margin-top: 2px;
|
| 2523 |
+
max-width: 140px;
|
| 2524 |
+
}
|
| 2525 |
+
|
| 2526 |
+
/* Report Redesign */
|
| 2527 |
+
.report-modal-card {
|
| 2528 |
+
background: white;
|
| 2529 |
+
border-radius: 24px;
|
| 2530 |
+
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
| 2531 |
+
max-width: 800px;
|
| 2532 |
+
margin: 2rem auto;
|
| 2533 |
+
overflow: hidden;
|
| 2534 |
+
animation: slideUp 0.4s ease-out;
|
| 2535 |
+
}
|
| 2536 |
+
|
| 2537 |
+
@keyframes slideUp {
|
| 2538 |
+
from {
|
| 2539 |
+
opacity: 0;
|
| 2540 |
+
transform: translateY(20px);
|
| 2541 |
+
}
|
| 2542 |
+
|
| 2543 |
+
to {
|
| 2544 |
+
opacity: 1;
|
| 2545 |
+
transform: translateY(0);
|
| 2546 |
+
}
|
| 2547 |
+
}
|
| 2548 |
+
|
| 2549 |
+
.report-header {
|
| 2550 |
+
display: flex;
|
| 2551 |
+
justify-content: space-between;
|
| 2552 |
+
align-items: center;
|
| 2553 |
+
padding: 1.5rem 2rem;
|
| 2554 |
+
border-bottom: 1px solid var(--gray-100);
|
| 2555 |
+
}
|
| 2556 |
+
|
| 2557 |
+
.report-download-btn {
|
| 2558 |
+
display: flex;
|
| 2559 |
+
align-items: center;
|
| 2560 |
+
gap: 0.5rem;
|
| 2561 |
+
padding: 0.5rem 1rem;
|
| 2562 |
+
border: 1px solid var(--gray-200);
|
| 2563 |
+
border-radius: 8px;
|
| 2564 |
+
background: white;
|
| 2565 |
+
color: var(--gray-600);
|
| 2566 |
+
font-size: 0.875rem;
|
| 2567 |
+
cursor: pointer;
|
| 2568 |
+
transition: all 0.2s;
|
| 2569 |
+
}
|
| 2570 |
+
|
| 2571 |
+
.report-download-btn:hover {
|
| 2572 |
+
background: var(--gray-50);
|
| 2573 |
+
border-color: var(--gray-300);
|
| 2574 |
+
}
|
| 2575 |
+
|
| 2576 |
+
.report-score-section {
|
| 2577 |
+
background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
|
| 2578 |
+
padding: 2rem;
|
| 2579 |
+
text-align: center;
|
| 2580 |
+
border-bottom: 1px solid var(--gray-100);
|
| 2581 |
+
}
|
| 2582 |
+
|
| 2583 |
+
.report-score-large {
|
| 2584 |
+
font-size: 3.5rem;
|
| 2585 |
+
font-weight: 700;
|
| 2586 |
+
color: #d97706;
|
| 2587 |
+
line-height: 1;
|
| 2588 |
+
margin-bottom: 0.5rem;
|
| 2589 |
+
}
|
| 2590 |
+
|
| 2591 |
+
.report-score-label {
|
| 2592 |
+
font-size: 1.125rem;
|
| 2593 |
+
color: var(--gray-500);
|
| 2594 |
+
}
|
| 2595 |
+
|
| 2596 |
+
.report-section {
|
| 2597 |
+
padding: 1.5rem 2rem;
|
| 2598 |
+
border-bottom: 1px solid var(--gray-100);
|
| 2599 |
+
}
|
| 2600 |
+
|
| 2601 |
+
.report-section:last-child {
|
| 2602 |
+
border-bottom: none;
|
| 2603 |
+
}
|
| 2604 |
+
|
| 2605 |
+
.report-section-title {
|
| 2606 |
+
font-size: 1rem;
|
| 2607 |
+
font-weight: 600;
|
| 2608 |
+
color: var(--gray-900);
|
| 2609 |
+
margin-bottom: 1rem;
|
| 2610 |
+
}
|
| 2611 |
+
|
| 2612 |
+
.report-text {
|
| 2613 |
+
color: var(--gray-600);
|
| 2614 |
+
line-height: 1.6;
|
| 2615 |
+
font-size: 0.9375rem;
|
| 2616 |
+
}
|
| 2617 |
+
|
| 2618 |
+
.strength-list,
|
| 2619 |
+
.improvement-list {
|
| 2620 |
+
list-style: none;
|
| 2621 |
+
padding: 0;
|
| 2622 |
+
margin: 0;
|
| 2623 |
+
}
|
| 2624 |
+
|
| 2625 |
+
.strength-list li,
|
| 2626 |
+
.improvement-list li {
|
| 2627 |
+
display: flex;
|
| 2628 |
+
gap: 0.75rem;
|
| 2629 |
+
margin-bottom: 0.75rem;
|
| 2630 |
+
font-size: 0.9375rem;
|
| 2631 |
+
color: var(--gray-700);
|
| 2632 |
+
line-height: 1.5;
|
| 2633 |
+
}
|
| 2634 |
+
|
| 2635 |
+
.strength-list li::before {
|
| 2636 |
+
content: "✓";
|
| 2637 |
+
color: #10b981;
|
| 2638 |
+
font-weight: bold;
|
| 2639 |
+
}
|
| 2640 |
+
|
| 2641 |
+
.improvement-list li::before {
|
| 2642 |
+
content: "→";
|
| 2643 |
+
color: #f59e0b;
|
| 2644 |
+
font-weight: bold;
|
| 2645 |
+
}
|
| 2646 |
+
|
| 2647 |
+
.key-insights-list {
|
| 2648 |
+
list-style: none;
|
| 2649 |
+
padding: 0;
|
| 2650 |
+
margin: 0;
|
| 2651 |
+
}
|
| 2652 |
+
|
| 2653 |
+
.key-insights-list li {
|
| 2654 |
+
position: relative;
|
| 2655 |
+
padding-left: 1.25rem;
|
| 2656 |
+
margin-bottom: 0.75rem;
|
| 2657 |
+
font-size: 0.9375rem;
|
| 2658 |
+
color: var(--gray-700);
|
| 2659 |
+
line-height: 1.5;
|
| 2660 |
+
}
|
| 2661 |
+
|
| 2662 |
+
.key-insights-list li::before {
|
| 2663 |
+
content: "•";
|
| 2664 |
+
color: #6366f1;
|
| 2665 |
+
font-weight: bold;
|
| 2666 |
+
position: absolute;
|
| 2667 |
+
left: 0;
|
| 2668 |
+
font-size: 1.25rem;
|
| 2669 |
+
line-height: 1;
|
| 2670 |
+
top: -2px;
|
| 2671 |
+
}
|
| 2672 |
+
|
| 2673 |
+
.report-footer {
|
| 2674 |
+
padding: 1.5rem 2rem;
|
| 2675 |
+
background: var(--gray-50);
|
| 2676 |
+
color: var(--gray-400);
|
| 2677 |
+
font-size: 0.8125rem;
|
| 2678 |
+
text-align: center;
|
| 2679 |
+
}
|
| 2680 |
+
|
| 2681 |
+
/* ============================================================================
|
| 2682 |
+
Conversations List Styles
|
| 2683 |
+
============================================================================ */
|
| 2684 |
+
.conv-list-container {
|
| 2685 |
+
display: flex;
|
| 2686 |
+
flex-direction: column;
|
| 2687 |
+
gap: 0;
|
| 2688 |
+
}
|
| 2689 |
+
|
| 2690 |
+
.conv-list-item {
|
| 2691 |
+
display: flex;
|
| 2692 |
+
align-items: center;
|
| 2693 |
+
gap: 1rem;
|
| 2694 |
+
padding: 1rem 1.5rem;
|
| 2695 |
+
background: white;
|
| 2696 |
+
border: 1px solid var(--gray-100);
|
| 2697 |
+
border-bottom: none;
|
| 2698 |
+
transition: background 0.2s, box-shadow 0.2s;
|
| 2699 |
+
}
|
| 2700 |
+
|
| 2701 |
+
.conv-list-item:first-child {
|
| 2702 |
+
border-radius: 12px 12px 0 0;
|
| 2703 |
+
}
|
| 2704 |
+
|
| 2705 |
+
.conv-list-item:last-child {
|
| 2706 |
+
border-bottom: 1px solid var(--gray-100);
|
| 2707 |
+
border-radius: 0 0 12px 12px;
|
| 2708 |
+
}
|
| 2709 |
+
|
| 2710 |
+
.conv-list-item:only-child {
|
| 2711 |
+
border-radius: 12px;
|
| 2712 |
+
border-bottom: 1px solid var(--gray-100);
|
| 2713 |
+
}
|
| 2714 |
+
|
| 2715 |
+
.conv-list-item:hover {
|
| 2716 |
+
background: var(--gray-50);
|
| 2717 |
+
}
|
| 2718 |
+
|
| 2719 |
+
.conv-avatar {
|
| 2720 |
+
width: 48px;
|
| 2721 |
+
height: 48px;
|
| 2722 |
+
border-radius: 50%;
|
| 2723 |
+
display: flex;
|
| 2724 |
+
align-items: center;
|
| 2725 |
+
justify-content: center;
|
| 2726 |
+
color: white;
|
| 2727 |
+
font-weight: 600;
|
| 2728 |
+
font-size: 1.125rem;
|
| 2729 |
+
flex-shrink: 0;
|
| 2730 |
+
}
|
| 2731 |
+
|
| 2732 |
+
.conv-info {
|
| 2733 |
+
flex: 1;
|
| 2734 |
+
min-width: 0;
|
| 2735 |
+
}
|
| 2736 |
+
|
| 2737 |
+
.conv-name {
|
| 2738 |
+
font-weight: 600;
|
| 2739 |
+
color: var(--gray-900);
|
| 2740 |
+
font-size: 0.9375rem;
|
| 2741 |
+
display: flex;
|
| 2742 |
+
align-items: center;
|
| 2743 |
+
margin-bottom: 0.25rem;
|
| 2744 |
+
}
|
| 2745 |
+
|
| 2746 |
+
.conv-meta {
|
| 2747 |
+
font-size: 0.8125rem;
|
| 2748 |
+
color: var(--gray-500);
|
| 2749 |
+
display: flex;
|
| 2750 |
+
align-items: center;
|
| 2751 |
+
gap: 0.375rem;
|
| 2752 |
+
}
|
| 2753 |
+
|
| 2754 |
+
.conv-date {
|
| 2755 |
+
text-align: right;
|
| 2756 |
+
min-width: 100px;
|
| 2757 |
+
}
|
| 2758 |
+
|
| 2759 |
+
.conv-view-btn {
|
| 2760 |
+
min-width: 60px;
|
| 2761 |
+
text-align: center;
|
| 2762 |
+
font-size: 0.8125rem !important;
|
| 2763 |
+
}
|
| 2764 |
+
|
| 2765 |
+
.conv-menu-wrapper {
|
| 2766 |
+
position: relative;
|
| 2767 |
+
}
|
| 2768 |
+
|
| 2769 |
+
.conv-menu-btn {
|
| 2770 |
+
width: 32px;
|
| 2771 |
+
height: 32px;
|
| 2772 |
+
display: flex;
|
| 2773 |
+
align-items: center;
|
| 2774 |
+
justify-content: center;
|
| 2775 |
+
border-radius: 6px;
|
| 2776 |
+
color: var(--gray-400);
|
| 2777 |
+
transition: all 0.2s;
|
| 2778 |
+
cursor: pointer;
|
| 2779 |
+
}
|
| 2780 |
+
|
| 2781 |
+
.conv-menu-btn:hover {
|
| 2782 |
+
background: var(--gray-100);
|
| 2783 |
+
color: var(--gray-600);
|
| 2784 |
+
}
|
| 2785 |
+
|
| 2786 |
+
.conv-dropdown-menu {
|
| 2787 |
+
position: absolute;
|
| 2788 |
+
right: 0;
|
| 2789 |
+
top: 100%;
|
| 2790 |
+
background: white;
|
| 2791 |
+
border: 1px solid var(--gray-200);
|
| 2792 |
+
border-radius: 8px;
|
| 2793 |
+
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
| 2794 |
+
min-width: 180px;
|
| 2795 |
+
z-index: 50;
|
| 2796 |
+
display: none;
|
| 2797 |
+
overflow: hidden;
|
| 2798 |
+
}
|
| 2799 |
+
|
| 2800 |
+
.conv-dropdown-menu.open {
|
| 2801 |
+
display: block;
|
| 2802 |
+
animation: fadeInUp 0.15s ease;
|
| 2803 |
+
}
|
| 2804 |
+
|
| 2805 |
+
.conv-dropdown-item {
|
| 2806 |
+
display: flex;
|
| 2807 |
+
align-items: center;
|
| 2808 |
+
gap: 0.625rem;
|
| 2809 |
+
width: 100%;
|
| 2810 |
+
padding: 0.625rem 1rem;
|
| 2811 |
+
font-size: 0.875rem;
|
| 2812 |
+
color: var(--gray-700);
|
| 2813 |
+
transition: background 0.15s;
|
| 2814 |
+
cursor: pointer;
|
| 2815 |
+
text-align: left;
|
| 2816 |
+
}
|
| 2817 |
+
|
| 2818 |
+
.conv-dropdown-item:hover {
|
| 2819 |
+
background: var(--gray-50);
|
| 2820 |
+
}
|
| 2821 |
+
|
| 2822 |
+
.conv-dropdown-item.danger {
|
| 2823 |
+
color: var(--error);
|
| 2824 |
+
}
|
| 2825 |
+
|
| 2826 |
+
.conv-dropdown-item.danger:hover {
|
| 2827 |
+
background: var(--error-light);
|
| 2828 |
+
}
|
| 2829 |
+
|
| 2830 |
+
/* ============================================================================
|
| 2831 |
+
Reports Grid & Cards
|
| 2832 |
+
============================================================================ */
|
| 2833 |
+
.reports-grid {
|
| 2834 |
+
display: grid;
|
| 2835 |
+
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
| 2836 |
+
gap: 1.5rem;
|
| 2837 |
+
}
|
| 2838 |
+
|
| 2839 |
+
.report-card {
|
| 2840 |
+
cursor: pointer;
|
| 2841 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 2842 |
+
padding: 1.5rem;
|
| 2843 |
+
}
|
| 2844 |
+
|
| 2845 |
+
.report-card:hover {
|
| 2846 |
+
transform: translateY(-2px);
|
| 2847 |
+
}
|
| 2848 |
+
|
| 2849 |
+
.report-card-icon {
|
| 2850 |
+
width: 48px;
|
| 2851 |
+
height: 48px;
|
| 2852 |
+
border-radius: 12px;
|
| 2853 |
+
display: flex;
|
| 2854 |
+
align-items: center;
|
| 2855 |
+
justify-content: center;
|
| 2856 |
+
font-size: 1.5rem;
|
| 2857 |
+
margin-bottom: 1rem;
|
| 2858 |
+
}
|
| 2859 |
+
|
| 2860 |
+
.report-card-title {
|
| 2861 |
+
font-size: 1rem;
|
| 2862 |
+
font-weight: 600;
|
| 2863 |
+
color: var(--gray-900);
|
| 2864 |
+
margin-bottom: 0.5rem;
|
| 2865 |
+
line-height: 1.4;
|
| 2866 |
+
}
|
| 2867 |
+
|
| 2868 |
+
.report-card-participant {
|
| 2869 |
+
display: flex;
|
| 2870 |
+
align-items: center;
|
| 2871 |
+
gap: 0.375rem;
|
| 2872 |
+
font-size: 0.8125rem;
|
| 2873 |
+
color: var(--gray-500);
|
| 2874 |
+
margin-bottom: 0.75rem;
|
| 2875 |
+
}
|
| 2876 |
+
|
| 2877 |
+
.report-card-score {
|
| 2878 |
+
display: flex;
|
| 2879 |
+
align-items: center;
|
| 2880 |
+
gap: 0.375rem;
|
| 2881 |
+
margin-bottom: 0.75rem;
|
| 2882 |
+
}
|
| 2883 |
+
|
| 2884 |
+
.report-score-num {
|
| 2885 |
+
font-size: 1.5rem;
|
| 2886 |
+
font-weight: 700;
|
| 2887 |
+
color: var(--gray-900);
|
| 2888 |
+
line-height: 1;
|
| 2889 |
+
}
|
| 2890 |
+
|
| 2891 |
+
.report-score-max {
|
| 2892 |
+
font-size: 0.875rem;
|
| 2893 |
+
color: var(--gray-400);
|
| 2894 |
+
font-weight: 400;
|
| 2895 |
+
}
|
| 2896 |
+
|
| 2897 |
+
.report-card-desc {
|
| 2898 |
+
font-size: 0.8125rem;
|
| 2899 |
+
color: var(--gray-500);
|
| 2900 |
+
line-height: 1.5;
|
| 2901 |
+
overflow: hidden;
|
| 2902 |
+
display: -webkit-box;
|
| 2903 |
+
-webkit-line-clamp: 3;
|
| 2904 |
+
-webkit-box-orient: vertical;
|
| 2905 |
+
margin-bottom: 1rem;
|
| 2906 |
+
}
|
| 2907 |
+
|
| 2908 |
+
.report-card-bottom {
|
| 2909 |
+
display: flex;
|
| 2910 |
+
align-items: center;
|
| 2911 |
+
justify-content: space-between;
|
| 2912 |
+
padding-top: 0.75rem;
|
| 2913 |
+
border-top: 1px solid var(--gray-100);
|
| 2914 |
+
}
|
| 2915 |
+
|
| 2916 |
+
.badge-full {
|
| 2917 |
+
display: inline-flex;
|
| 2918 |
+
align-items: center;
|
| 2919 |
+
padding: 0.2rem 0.625rem;
|
| 2920 |
+
border-radius: 4px;
|
| 2921 |
+
font-size: 0.6875rem;
|
| 2922 |
+
font-weight: 600;
|
| 2923 |
+
background: var(--primary-100);
|
| 2924 |
+
color: var(--primary-700);
|
| 2925 |
+
text-transform: lowercase;
|
| 2926 |
+
}
|
| 2927 |
+
|
| 2928 |
+
.report-card-date {
|
| 2929 |
+
font-size: 0.75rem;
|
| 2930 |
+
color: var(--gray-400);
|
| 2931 |
+
}
|
| 2932 |
+
|
| 2933 |
+
/* ============================================================================
|
| 2934 |
+
Enhanced Agent Cards
|
| 2935 |
+
============================================================================ */
|
| 2936 |
+
.agent-card-top {
|
| 2937 |
+
margin-bottom: 1rem;
|
| 2938 |
+
}
|
| 2939 |
+
|
| 2940 |
+
.agent-card-body {
|
| 2941 |
+
margin-bottom: 1rem;
|
| 2942 |
+
}
|
| 2943 |
+
|
| 2944 |
+
.agent-card-body .agent-name {
|
| 2945 |
+
margin-bottom: 0.125rem;
|
| 2946 |
+
}
|
| 2947 |
+
|
| 2948 |
+
.agent-card-body .agent-role {
|
| 2949 |
+
margin-bottom: 0.5rem;
|
| 2950 |
+
}
|
| 2951 |
+
|
| 2952 |
+
.agent-description {
|
| 2953 |
+
font-size: 0.8125rem;
|
| 2954 |
+
color: var(--gray-500);
|
| 2955 |
+
line-height: 1.5;
|
| 2956 |
+
overflow: hidden;
|
| 2957 |
+
display: -webkit-box;
|
| 2958 |
+
-webkit-line-clamp: 2;
|
| 2959 |
+
-webkit-box-orient: vertical;
|
| 2960 |
+
}
|
| 2961 |
+
|
| 2962 |
+
.agent-card-footer {
|
| 2963 |
+
padding-top: 0.75rem;
|
| 2964 |
+
border-top: 1px solid var(--gray-100);
|
| 2965 |
+
}
|
| 2966 |
+
|
| 2967 |
+
.agent-card-meta {
|
| 2968 |
+
display: flex;
|
| 2969 |
+
align-items: center;
|
| 2970 |
+
justify-content: space-between;
|
| 2971 |
+
margin-bottom: 0.375rem;
|
| 2972 |
+
}
|
| 2973 |
+
|
| 2974 |
+
.agent-meta-item {
|
| 2975 |
+
display: flex;
|
| 2976 |
+
align-items: center;
|
| 2977 |
+
gap: 0.375rem;
|
| 2978 |
+
font-size: 0.8125rem;
|
| 2979 |
+
color: var(--gray-500);
|
| 2980 |
+
}
|
| 2981 |
+
|
| 2982 |
+
.agent-meta-item i {
|
| 2983 |
+
font-size: 0.75rem;
|
| 2984 |
+
}
|
| 2985 |
+
|
| 2986 |
+
.agent-card-date {
|
| 2987 |
+
font-size: 0.75rem;
|
| 2988 |
+
color: var(--gray-400);
|
| 2989 |
+
}
|
| 2990 |
+
|
| 2991 |
+
/* ============================================================================
|
| 2992 |
+
View Toggle Buttons
|
| 2993 |
+
============================================================================ */
|
| 2994 |
+
.btn-view-toggle {
|
| 2995 |
+
width: 36px;
|
| 2996 |
+
height: 36px;
|
| 2997 |
+
display: flex;
|
| 2998 |
+
align-items: center;
|
| 2999 |
+
justify-content: center;
|
| 3000 |
+
border-radius: 8px;
|
| 3001 |
+
color: var(--gray-400);
|
| 3002 |
+
background: transparent;
|
| 3003 |
+
border: 1px solid var(--gray-200);
|
| 3004 |
+
transition: all 0.2s;
|
| 3005 |
+
cursor: pointer;
|
| 3006 |
+
font-size: 0.875rem;
|
| 3007 |
+
}
|
| 3008 |
+
|
| 3009 |
+
.btn-view-toggle:hover {
|
| 3010 |
+
color: var(--gray-600);
|
| 3011 |
+
border-color: var(--gray-300);
|
| 3012 |
+
}
|
| 3013 |
+
|
| 3014 |
+
.btn-view-toggle.active {
|
| 3015 |
+
color: var(--primary-600);
|
| 3016 |
+
background: var(--primary-50);
|
| 3017 |
+
border-color: var(--primary-200);
|
| 3018 |
+
}
|
| 3019 |
+
|
| 3020 |
+
/* Agents list view */
|
| 3021 |
+
.agents-list-view {
|
| 3022 |
+
display: flex;
|
| 3023 |
+
flex-direction: column;
|
| 3024 |
+
gap: 0.75rem;
|
| 3025 |
+
}
|
| 3026 |
+
|
| 3027 |
+
.agents-list-view .agent-card {
|
| 3028 |
+
display: flex;
|
| 3029 |
+
align-items: center;
|
| 3030 |
+
gap: 1.5rem;
|
| 3031 |
+
}
|
| 3032 |
+
|
| 3033 |
+
.agents-list-view .agent-card-top {
|
| 3034 |
+
margin-bottom: 0;
|
| 3035 |
+
}
|
| 3036 |
+
|
| 3037 |
+
.agents-list-view .agent-card-body {
|
| 3038 |
+
flex: 1;
|
| 3039 |
+
margin-bottom: 0;
|
| 3040 |
+
}
|
| 3041 |
+
|
| 3042 |
+
.agents-list-view .agent-card-footer {
|
| 3043 |
+
border-top: none;
|
| 3044 |
+
padding-top: 0;
|
| 3045 |
+
min-width: 120px;
|
| 3046 |
+
text-align: right;
|
| 3047 |
+
}
|
| 3048 |
+
|
| 3049 |
+
/* ============================================================================
|
| 3050 |
+
Utility Overrides
|
| 3051 |
+
============================================================================ */
|
| 3052 |
+
.mb-4 {
|
| 3053 |
+
margin-bottom: 1.5rem;
|
| 3054 |
+
}
|
| 3055 |
+
|
| 3056 |
+
.flex {
|
| 3057 |
+
display: flex;
|
| 3058 |
+
}
|
| 3059 |
+
|
| 3060 |
+
.items-center {
|
| 3061 |
+
align-items: center;
|
| 3062 |
+
}
|
| 3063 |
+
|
| 3064 |
+
.gap-2 {
|
| 3065 |
+
gap: 0.5rem;
|
| 3066 |
+
}
|
| 3067 |
+
|
| 3068 |
+
.gap-3 {
|
| 3069 |
+
gap: 0.75rem;
|
| 3070 |
+
}
|
| 3071 |
+
|
| 3072 |
+
.gap-4 {
|
| 3073 |
+
gap: 1rem;
|
| 3074 |
+
}
|
| 3075 |
+
|
| 3076 |
+
.mb-3 {
|
| 3077 |
+
margin-bottom: 0.75rem;
|
| 3078 |
+
}
|
| 3079 |
+
|
| 3080 |
+
/* Search input with icon */
|
| 3081 |
+
.search-input-wrapper .form-input {
|
| 3082 |
+
padding-left: 36px;
|
| 3083 |
+
}
|
| 3084 |
+
|
| 3085 |
+
/* Button link style */
|
| 3086 |
+
.btn-link {
|
| 3087 |
+
color: var(--primary-600);
|
| 3088 |
+
font-weight: 500;
|
| 3089 |
+
font-size: 0.875rem;
|
| 3090 |
+
transition: color 0.2s;
|
| 3091 |
+
display: flex;
|
| 3092 |
+
align-items: center;
|
| 3093 |
+
gap: 0.25rem;
|
| 3094 |
+
}
|
| 3095 |
+
|
| 3096 |
+
.btn-link:hover {
|
| 3097 |
+
color: var(--primary-700);
|
| 3098 |
+
}
|
| 3099 |
+
|
| 3100 |
+
/* ============================================================================
|
| 3101 |
+
Anchoring Remote Control Styles — Premium Edition
|
| 3102 |
+
============================================================================ */
|
| 3103 |
+
|
| 3104 |
+
.anc-remote-container {
|
| 3105 |
+
max-width: 1400px;
|
| 3106 |
+
margin: 0 auto;
|
| 3107 |
+
padding: 2rem 2.5rem;
|
| 3108 |
+
}
|
| 3109 |
+
|
| 3110 |
+
.anc-remote-header {
|
| 3111 |
+
display: flex;
|
| 3112 |
+
align-items: center;
|
| 3113 |
+
justify-content: space-between;
|
| 3114 |
+
margin-bottom: 2.5rem;
|
| 3115 |
+
gap: 1rem;
|
| 3116 |
+
}
|
| 3117 |
+
|
| 3118 |
+
.anc-back-btn {
|
| 3119 |
+
display: flex;
|
| 3120 |
+
align-items: center;
|
| 3121 |
+
gap: 8px;
|
| 3122 |
+
padding: 10px 18px;
|
| 3123 |
+
background: var(--gray-50);
|
| 3124 |
+
border: 1px solid var(--gray-200);
|
| 3125 |
+
border-radius: 12px;
|
| 3126 |
+
color: var(--gray-600);
|
| 3127 |
+
font-size: 0.875rem;
|
| 3128 |
+
font-weight: 500;
|
| 3129 |
+
cursor: pointer;
|
| 3130 |
+
transition: all 0.25s ease;
|
| 3131 |
+
}
|
| 3132 |
+
|
| 3133 |
+
.anc-back-btn:hover {
|
| 3134 |
+
background: var(--gray-100);
|
| 3135 |
+
border-color: var(--gray-300);
|
| 3136 |
+
transform: translateX(-2px);
|
| 3137 |
+
}
|
| 3138 |
+
|
| 3139 |
+
.anc-remote-title {
|
| 3140 |
+
display: flex;
|
| 3141 |
+
align-items: center;
|
| 3142 |
+
gap: 16px;
|
| 3143 |
+
flex: 1;
|
| 3144 |
+
}
|
| 3145 |
+
|
| 3146 |
+
.anc-remote-title h1 {
|
| 3147 |
+
font-size: 1.5rem;
|
| 3148 |
+
font-weight: 700;
|
| 3149 |
+
color: var(--gray-900);
|
| 3150 |
+
margin: 0;
|
| 3151 |
+
letter-spacing: -0.3px;
|
| 3152 |
+
}
|
| 3153 |
+
|
| 3154 |
+
.anc-remote-icon {
|
| 3155 |
+
font-size: 40px;
|
| 3156 |
+
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
|
| 3157 |
+
}
|
| 3158 |
+
|
| 3159 |
+
.anc-badge-system {
|
| 3160 |
+
display: inline-flex;
|
| 3161 |
+
align-items: center;
|
| 3162 |
+
gap: 4px;
|
| 3163 |
+
padding: 5px 14px;
|
| 3164 |
+
background: linear-gradient(135deg, #6366f1, #a855f7);
|
| 3165 |
+
color: white;
|
| 3166 |
+
border-radius: 20px;
|
| 3167 |
+
font-size: 0.75rem;
|
| 3168 |
+
font-weight: 600;
|
| 3169 |
+
letter-spacing: 0.3px;
|
| 3170 |
+
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
|
| 3171 |
+
}
|
| 3172 |
+
|
| 3173 |
+
.anc-status-badge {
|
| 3174 |
+
display: flex;
|
| 3175 |
+
align-items: center;
|
| 3176 |
+
gap: 10px;
|
| 3177 |
+
padding: 10px 20px;
|
| 3178 |
+
background: white;
|
| 3179 |
+
border: 1px solid var(--gray-200);
|
| 3180 |
+
border-radius: 50px;
|
| 3181 |
+
font-size: 0.875rem;
|
| 3182 |
+
font-weight: 600;
|
| 3183 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
| 3184 |
+
transition: all 0.3s ease;
|
| 3185 |
+
}
|
| 3186 |
+
|
| 3187 |
+
.anc-status-dot {
|
| 3188 |
+
width: 10px;
|
| 3189 |
+
height: 10px;
|
| 3190 |
+
border-radius: 50%;
|
| 3191 |
+
display: inline-block;
|
| 3192 |
+
transition: all 0.3s ease;
|
| 3193 |
+
}
|
| 3194 |
+
|
| 3195 |
+
.anc-status-dot.playing {
|
| 3196 |
+
background: #22c55e;
|
| 3197 |
+
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15), 0 0 10px rgba(34, 197, 94, 0.3);
|
| 3198 |
+
animation: pulse-status 2s infinite;
|
| 3199 |
+
}
|
| 3200 |
+
|
| 3201 |
+
.anc-status-dot.paused {
|
| 3202 |
+
background: #f59e0b;
|
| 3203 |
+
box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15), 0 0 10px rgba(245, 158, 11, 0.3);
|
| 3204 |
+
}
|
| 3205 |
+
|
| 3206 |
+
.anc-status-dot.stopped {
|
| 3207 |
+
background: #ef4444;
|
| 3208 |
+
box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
|
| 3209 |
+
}
|
| 3210 |
+
|
| 3211 |
+
@keyframes pulse-status {
|
| 3212 |
+
|
| 3213 |
+
0%,
|
| 3214 |
+
100% {
|
| 3215 |
+
box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15), 0 0 10px rgba(34, 197, 94, 0.3);
|
| 3216 |
+
}
|
| 3217 |
+
|
| 3218 |
+
50% {
|
| 3219 |
+
box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.1), 0 0 16px rgba(34, 197, 94, 0.2);
|
| 3220 |
+
}
|
| 3221 |
+
}
|
| 3222 |
+
|
| 3223 |
+
.anc-remote-body {
|
| 3224 |
+
display: grid;
|
| 3225 |
+
grid-template-columns: 1fr 420px;
|
| 3226 |
+
gap: 2rem;
|
| 3227 |
+
}
|
| 3228 |
+
|
| 3229 |
+
/* Script Panel */
|
| 3230 |
+
.anc-script-panel {
|
| 3231 |
+
background: white;
|
| 3232 |
+
border: 1px solid var(--gray-200);
|
| 3233 |
+
border-radius: 20px;
|
| 3234 |
+
padding: 28px;
|
| 3235 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
| 3236 |
+
}
|
| 3237 |
+
|
| 3238 |
+
.anc-panel-header {
|
| 3239 |
+
display: flex;
|
| 3240 |
+
align-items: center;
|
| 3241 |
+
justify-content: space-between;
|
| 3242 |
+
margin-bottom: 1.25rem;
|
| 3243 |
+
}
|
| 3244 |
+
|
| 3245 |
+
.anc-panel-header h3 {
|
| 3246 |
+
font-size: 1.125rem;
|
| 3247 |
+
font-weight: 700;
|
| 3248 |
+
color: var(--gray-900);
|
| 3249 |
+
margin: 0;
|
| 3250 |
+
letter-spacing: -0.2px;
|
| 3251 |
+
}
|
| 3252 |
+
|
| 3253 |
+
.anc-save-btn {
|
| 3254 |
+
display: flex;
|
| 3255 |
+
align-items: center;
|
| 3256 |
+
gap: 8px;
|
| 3257 |
+
padding: 10px 20px;
|
| 3258 |
+
background: linear-gradient(135deg, #6366f1, #4f46e5);
|
| 3259 |
+
color: white;
|
| 3260 |
+
border: none;
|
| 3261 |
+
border-radius: 12px;
|
| 3262 |
+
font-size: 0.875rem;
|
| 3263 |
+
font-weight: 600;
|
| 3264 |
+
cursor: pointer;
|
| 3265 |
+
transition: all 0.25s ease;
|
| 3266 |
+
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
|
| 3267 |
+
}
|
| 3268 |
+
|
| 3269 |
+
.anc-save-btn:hover {
|
| 3270 |
+
transform: translateY(-2px);
|
| 3271 |
+
box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
|
| 3272 |
+
}
|
| 3273 |
+
|
| 3274 |
+
.anc-script-editor {
|
| 3275 |
+
width: 100%;
|
| 3276 |
+
min-height: 220px;
|
| 3277 |
+
padding: 18px;
|
| 3278 |
+
border: 1px solid var(--gray-200);
|
| 3279 |
+
border-radius: 14px;
|
| 3280 |
+
font-family: 'JetBrains Mono', 'Courier New', monospace;
|
| 3281 |
+
font-size: 0.875rem;
|
| 3282 |
+
line-height: 1.8;
|
| 3283 |
+
resize: vertical;
|
| 3284 |
+
background: var(--gray-50);
|
| 3285 |
+
color: var(--gray-900);
|
| 3286 |
+
transition: all 0.3s ease;
|
| 3287 |
+
}
|
| 3288 |
+
|
| 3289 |
+
.anc-script-editor:focus {
|
| 3290 |
+
outline: none;
|
| 3291 |
+
border-color: #6366f1;
|
| 3292 |
+
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
|
| 3293 |
+
background: white;
|
| 3294 |
+
}
|
| 3295 |
+
|
| 3296 |
+
.anc-script-preview {
|
| 3297 |
+
margin-top: 1.5rem;
|
| 3298 |
+
}
|
| 3299 |
+
|
| 3300 |
+
.anc-script-preview h4 {
|
| 3301 |
+
font-size: 0.8125rem;
|
| 3302 |
+
font-weight: 600;
|
| 3303 |
+
color: var(--gray-500);
|
| 3304 |
+
margin-bottom: 0.75rem;
|
| 3305 |
+
text-transform: uppercase;
|
| 3306 |
+
letter-spacing: 0.5px;
|
| 3307 |
+
}
|
| 3308 |
+
|
| 3309 |
+
.anc-lines-list {
|
| 3310 |
+
border: 1px solid var(--gray-200);
|
| 3311 |
+
border-radius: 14px;
|
| 3312 |
+
overflow: hidden;
|
| 3313 |
+
max-height: 300px;
|
| 3314 |
+
overflow-y: auto;
|
| 3315 |
+
}
|
| 3316 |
+
|
| 3317 |
+
.anc-lines-list::-webkit-scrollbar {
|
| 3318 |
+
width: 6px;
|
| 3319 |
+
}
|
| 3320 |
+
|
| 3321 |
+
.anc-lines-list::-webkit-scrollbar-thumb {
|
| 3322 |
+
background: var(--gray-300);
|
| 3323 |
+
border-radius: 3px;
|
| 3324 |
+
}
|
| 3325 |
+
|
| 3326 |
+
.anc-line-item {
|
| 3327 |
+
display: flex;
|
| 3328 |
+
align-items: center;
|
| 3329 |
+
gap: 12px;
|
| 3330 |
+
padding: 12px 16px;
|
| 3331 |
+
border-bottom: 1px solid var(--gray-100);
|
| 3332 |
+
cursor: pointer;
|
| 3333 |
+
transition: all 0.2s ease;
|
| 3334 |
+
}
|
| 3335 |
+
|
| 3336 |
+
.anc-line-item:last-child {
|
| 3337 |
+
border-bottom: none;
|
| 3338 |
+
}
|
| 3339 |
+
|
| 3340 |
+
.anc-line-item:hover {
|
| 3341 |
+
background: var(--gray-50);
|
| 3342 |
+
}
|
| 3343 |
+
|
| 3344 |
+
.anc-line-item.active {
|
| 3345 |
+
background: linear-gradient(90deg, rgba(99, 102, 241, 0.08), rgba(168, 85, 247, 0.04));
|
| 3346 |
+
border-left: 3px solid #6366f1;
|
| 3347 |
+
}
|
| 3348 |
+
|
| 3349 |
+
.anc-line-item.done {
|
| 3350 |
+
background: rgba(34, 197, 94, 0.04);
|
| 3351 |
+
}
|
| 3352 |
+
|
| 3353 |
+
.anc-line-item.done .anc-line-text {
|
| 3354 |
+
color: var(--gray-400);
|
| 3355 |
+
text-decoration: line-through;
|
| 3356 |
+
text-decoration-color: rgba(34, 197, 94, 0.3);
|
| 3357 |
+
}
|
| 3358 |
+
|
| 3359 |
+
.anc-line-num {
|
| 3360 |
+
width: 30px;
|
| 3361 |
+
height: 30px;
|
| 3362 |
+
display: flex;
|
| 3363 |
+
align-items: center;
|
| 3364 |
+
justify-content: center;
|
| 3365 |
+
background: var(--gray-100);
|
| 3366 |
+
border-radius: 8px;
|
| 3367 |
+
font-size: 0.75rem;
|
| 3368 |
+
font-weight: 700;
|
| 3369 |
+
color: var(--gray-500);
|
| 3370 |
+
flex-shrink: 0;
|
| 3371 |
+
transition: all 0.2s ease;
|
| 3372 |
+
}
|
| 3373 |
+
|
| 3374 |
+
.anc-line-item.active .anc-line-num {
|
| 3375 |
+
background: linear-gradient(135deg, #6366f1, #a855f7);
|
| 3376 |
+
color: white;
|
| 3377 |
+
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
|
| 3378 |
+
}
|
| 3379 |
+
|
| 3380 |
+
.anc-line-text {
|
| 3381 |
+
font-size: 0.875rem;
|
| 3382 |
+
color: var(--gray-800);
|
| 3383 |
+
line-height: 1.5;
|
| 3384 |
+
}
|
| 3385 |
+
|
| 3386 |
+
/* Controls Panel */
|
| 3387 |
+
.anc-control-card {
|
| 3388 |
+
background: white;
|
| 3389 |
+
border: 1px solid var(--gray-200);
|
| 3390 |
+
border-radius: 20px;
|
| 3391 |
+
padding: 28px;
|
| 3392 |
+
margin-bottom: 1.25rem;
|
| 3393 |
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
|
| 3394 |
+
transition: box-shadow 0.3s ease;
|
| 3395 |
+
}
|
| 3396 |
+
|
| 3397 |
+
.anc-control-card:hover {
|
| 3398 |
+
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
|
| 3399 |
+
}
|
| 3400 |
+
|
| 3401 |
+
.anc-control-card h3 {
|
| 3402 |
+
font-size: 1.125rem;
|
| 3403 |
+
font-weight: 700;
|
| 3404 |
+
color: var(--gray-900);
|
| 3405 |
+
margin: 0 0 4px;
|
| 3406 |
+
letter-spacing: -0.2px;
|
| 3407 |
+
}
|
| 3408 |
+
|
| 3409 |
+
.anc-control-subtitle {
|
| 3410 |
+
font-size: 0.8125rem;
|
| 3411 |
+
color: var(--gray-500);
|
| 3412 |
+
margin-bottom: 1.5rem;
|
| 3413 |
+
line-height: 1.5;
|
| 3414 |
+
}
|
| 3415 |
+
|
| 3416 |
+
.anc-progress-info {
|
| 3417 |
+
margin-bottom: 1.5rem;
|
| 3418 |
+
}
|
| 3419 |
+
|
| 3420 |
+
.anc-progress-bar-container {
|
| 3421 |
+
height: 6px;
|
| 3422 |
+
background: var(--gray-100);
|
| 3423 |
+
border-radius: 4px;
|
| 3424 |
+
overflow: hidden;
|
| 3425 |
+
margin-bottom: 10px;
|
| 3426 |
+
}
|
| 3427 |
+
|
| 3428 |
+
.anc-progress-bar {
|
| 3429 |
+
height: 100%;
|
| 3430 |
+
background: linear-gradient(90deg, #6366f1, #ec4899, #f59e0b);
|
| 3431 |
+
border-radius: 4px;
|
| 3432 |
+
transition: width 0.3s linear;
|
| 3433 |
+
position: relative;
|
| 3434 |
+
}
|
| 3435 |
+
|
| 3436 |
+
.anc-progress-text {
|
| 3437 |
+
font-size: 0.75rem;
|
| 3438 |
+
color: var(--gray-500);
|
| 3439 |
+
font-weight: 600;
|
| 3440 |
+
letter-spacing: 0.3px;
|
| 3441 |
+
}
|
| 3442 |
+
|
| 3443 |
+
.anc-current-line-card {
|
| 3444 |
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(168, 85, 247, 0.03));
|
| 3445 |
+
border: 1px solid rgba(99, 102, 241, 0.12);
|
| 3446 |
+
border-radius: 14px;
|
| 3447 |
+
padding: 18px;
|
| 3448 |
+
margin-bottom: 1.5rem;
|
| 3449 |
+
transition: background 0.3s ease;
|
| 3450 |
+
}
|
| 3451 |
+
|
| 3452 |
+
.anc-current-label {
|
| 3453 |
+
font-size: 0.6875rem;
|
| 3454 |
+
font-weight: 700;
|
| 3455 |
+
color: #6366f1;
|
| 3456 |
+
text-transform: uppercase;
|
| 3457 |
+
letter-spacing: 1px;
|
| 3458 |
+
margin-bottom: 8px;
|
| 3459 |
+
}
|
| 3460 |
+
|
| 3461 |
+
.anc-current-text {
|
| 3462 |
+
font-size: 1rem;
|
| 3463 |
+
font-weight: 500;
|
| 3464 |
+
color: var(--gray-900);
|
| 3465 |
+
line-height: 1.5;
|
| 3466 |
+
}
|
| 3467 |
+
|
| 3468 |
+
.anc-controls-grid {
|
| 3469 |
+
display: grid;
|
| 3470 |
+
grid-template-columns: 1fr 1fr;
|
| 3471 |
+
gap: 10px;
|
| 3472 |
+
margin-bottom: 1rem;
|
| 3473 |
+
}
|
| 3474 |
+
|
| 3475 |
+
.anc-ctrl-btn {
|
| 3476 |
+
display: flex;
|
| 3477 |
+
flex-direction: column;
|
| 3478 |
+
align-items: center;
|
| 3479 |
+
justify-content: center;
|
| 3480 |
+
gap: 8px;
|
| 3481 |
+
padding: 18px 16px;
|
| 3482 |
+
border: 1px solid var(--gray-200);
|
| 3483 |
+
border-radius: 14px;
|
| 3484 |
+
background: white;
|
| 3485 |
+
color: var(--gray-600);
|
| 3486 |
+
font-size: 0.75rem;
|
| 3487 |
+
font-weight: 700;
|
| 3488 |
+
cursor: pointer;
|
| 3489 |
+
transition: all 0.25s ease;
|
| 3490 |
+
letter-spacing: 0.3px;
|
| 3491 |
+
text-transform: uppercase;
|
| 3492 |
+
}
|
| 3493 |
+
|
| 3494 |
+
.anc-ctrl-btn:hover {
|
| 3495 |
+
transform: translateY(-2px);
|
| 3496 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
|
| 3497 |
+
}
|
| 3498 |
+
|
| 3499 |
+
.anc-ctrl-btn.play:hover,
|
| 3500 |
+
.anc-ctrl-btn.play.active-ctrl {
|
| 3501 |
+
background: rgba(34, 197, 94, 0.06);
|
| 3502 |
+
border-color: #22c55e;
|
| 3503 |
+
color: #16a34a;
|
| 3504 |
+
box-shadow: 0 4px 12px rgba(34, 197, 94, 0.12);
|
| 3505 |
+
}
|
| 3506 |
+
|
| 3507 |
+
.anc-ctrl-btn.pause:hover,
|
| 3508 |
+
.anc-ctrl-btn.pause.active-ctrl {
|
| 3509 |
+
background: rgba(245, 158, 11, 0.06);
|
| 3510 |
+
border-color: #f59e0b;
|
| 3511 |
+
color: #d97706;
|
| 3512 |
+
box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
|
| 3513 |
+
}
|
| 3514 |
+
|
| 3515 |
+
.anc-ctrl-btn.stop:hover {
|
| 3516 |
+
background: rgba(239, 68, 68, 0.06);
|
| 3517 |
+
border-color: #ef4444;
|
| 3518 |
+
color: #dc2626;
|
| 3519 |
+
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.12);
|
| 3520 |
+
}
|
| 3521 |
+
|
| 3522 |
+
.anc-ctrl-btn.restart:hover {
|
| 3523 |
+
background: rgba(99, 102, 241, 0.06);
|
| 3524 |
+
border-color: #6366f1;
|
| 3525 |
+
color: #4f46e5;
|
| 3526 |
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.12);
|
| 3527 |
+
}
|
| 3528 |
+
|
| 3529 |
+
.anc-next-btn {
|
| 3530 |
+
width: 100%;
|
| 3531 |
+
padding: 16px;
|
| 3532 |
+
background: linear-gradient(135deg, #6366f1, #4f46e5);
|
| 3533 |
+
color: white;
|
| 3534 |
+
border: none;
|
| 3535 |
+
border-radius: 14px;
|
| 3536 |
+
font-size: 1rem;
|
| 3537 |
+
font-weight: 700;
|
| 3538 |
+
cursor: pointer;
|
| 3539 |
+
transition: all 0.25s ease;
|
| 3540 |
+
letter-spacing: 0.3px;
|
| 3541 |
+
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
|
| 3542 |
+
}
|
| 3543 |
+
|
| 3544 |
+
.anc-next-btn:hover {
|
| 3545 |
+
transform: translateY(-2px);
|
| 3546 |
+
box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
|
| 3547 |
+
}
|
| 3548 |
+
|
| 3549 |
+
.anc-share-card {
|
| 3550 |
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.03), rgba(168, 85, 247, 0.02));
|
| 3551 |
+
border-color: rgba(99, 102, 241, 0.12);
|
| 3552 |
+
}
|
| 3553 |
+
|
| 3554 |
+
.anc-share-card .anc-share-btn {
|
| 3555 |
+
width: 100%;
|
| 3556 |
+
padding: 14px;
|
| 3557 |
+
background: white;
|
| 3558 |
+
border: 1px solid var(--gray-200);
|
| 3559 |
+
border-radius: 12px;
|
| 3560 |
+
color: var(--gray-700);
|
| 3561 |
+
font-size: 0.875rem;
|
| 3562 |
+
font-weight: 600;
|
| 3563 |
+
cursor: pointer;
|
| 3564 |
+
transition: all 0.25s ease;
|
| 3565 |
+
}
|
| 3566 |
+
|
| 3567 |
+
.anc-share-card .anc-share-btn:hover {
|
| 3568 |
+
background: var(--gray-50);
|
| 3569 |
+
border-color: #6366f1;
|
| 3570 |
+
color: #6366f1;
|
| 3571 |
+
transform: translateY(-1px);
|
| 3572 |
+
}
|
| 3573 |
+
|
| 3574 |
+
/* Agent card relative positioning for badges */
|
| 3575 |
+
.agent-card-top {
|
| 3576 |
+
position: relative;
|
| 3577 |
+
}
|
| 3578 |
+
|
| 3579 |
+
@media (max-width: 1024px) {
|
| 3580 |
+
.anc-remote-body {
|
| 3581 |
+
grid-template-columns: 1fr;
|
| 3582 |
+
}
|
| 3583 |
+
|
| 3584 |
+
.anc-remote-header {
|
| 3585 |
+
flex-wrap: wrap;
|
| 3586 |
+
}
|
| 3587 |
+
|
| 3588 |
+
.anc-script-panel {
|
| 3589 |
+
padding: 20px;
|
| 3590 |
+
}
|
| 3591 |
+
|
| 3592 |
+
.anc-control-card {
|
| 3593 |
+
padding: 20px;
|
| 3594 |
+
}
|
| 3595 |
+
}
|
| 3596 |
+
|
| 3597 |
+
/* ============================================================================
|
| 3598 |
+
Premium UI Polish — Global Enhancements
|
| 3599 |
+
============================================================================ */
|
| 3600 |
+
|
| 3601 |
+
/* --- Sidebar Premium Polish --- */
|
| 3602 |
+
.sidebar {
|
| 3603 |
+
background: linear-gradient(180deg, #1a1d2e 0%, #141625 100%);
|
| 3604 |
+
}
|
| 3605 |
+
|
| 3606 |
+
.sidebar-header {
|
| 3607 |
+
padding: 1.5rem 1.5rem;
|
| 3608 |
+
}
|
| 3609 |
+
|
| 3610 |
+
.logo-img {
|
| 3611 |
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
| 3612 |
+
}
|
| 3613 |
+
|
| 3614 |
+
.nav-item {
|
| 3615 |
+
border-radius: 0 8px 8px 0;
|
| 3616 |
+
margin-right: 12px;
|
| 3617 |
+
}
|
| 3618 |
+
|
| 3619 |
+
.nav-item:hover {
|
| 3620 |
+
background: rgba(255, 255, 255, 0.06);
|
| 3621 |
+
padding-left: 1.625rem;
|
| 3622 |
+
}
|
| 3623 |
+
|
| 3624 |
+
.nav-item.active {
|
| 3625 |
+
background: linear-gradient(90deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.05));
|
| 3626 |
+
box-shadow: inset 3px 0 0 var(--primary-400);
|
| 3627 |
+
border-left-color: transparent;
|
| 3628 |
+
}
|
| 3629 |
+
|
| 3630 |
+
.nav-item.active .nav-icon {
|
| 3631 |
+
color: var(--primary-400);
|
| 3632 |
+
}
|
| 3633 |
+
|
| 3634 |
+
.nav-item:hover .nav-chevron {
|
| 3635 |
+
opacity: 0.6;
|
| 3636 |
+
}
|
| 3637 |
+
|
| 3638 |
+
/* --- Page Header Premium --- */
|
| 3639 |
+
.page-title {
|
| 3640 |
+
font-size: 1.875rem;
|
| 3641 |
+
font-weight: 800;
|
| 3642 |
+
letter-spacing: -0.025em;
|
| 3643 |
+
background: linear-gradient(135deg, var(--gray-900) 0%, var(--primary-600) 100%);
|
| 3644 |
+
-webkit-background-clip: text;
|
| 3645 |
+
-webkit-text-fill-color: transparent;
|
| 3646 |
+
background-clip: text;
|
| 3647 |
+
}
|
| 3648 |
+
|
| 3649 |
+
.page-subtitle {
|
| 3650 |
+
font-size: 0.9375rem;
|
| 3651 |
+
letter-spacing: 0.01em;
|
| 3652 |
+
color: var(--gray-500);
|
| 3653 |
+
-webkit-text-fill-color: var(--gray-500);
|
| 3654 |
+
line-height: 1.5;
|
| 3655 |
+
margin-top: 0.5rem;
|
| 3656 |
+
transition: none;
|
| 3657 |
+
opacity: 1;
|
| 3658 |
+
}
|
| 3659 |
+
|
| 3660 |
+
.auth-subtitle {
|
| 3661 |
+
-webkit-text-fill-color: var(--gray-500);
|
| 3662 |
+
transition: none;
|
| 3663 |
+
opacity: 1;
|
| 3664 |
+
}
|
| 3665 |
+
|
| 3666 |
+
.list-item-subtitle {
|
| 3667 |
+
-webkit-text-fill-color: var(--gray-500);
|
| 3668 |
+
transition: none;
|
| 3669 |
+
opacity: 1;
|
| 3670 |
+
}
|
| 3671 |
+
|
| 3672 |
+
.page-header {
|
| 3673 |
+
margin-bottom: 2.5rem;
|
| 3674 |
+
}
|
| 3675 |
+
|
| 3676 |
+
/* --- Button Premium --- */
|
| 3677 |
+
.btn {
|
| 3678 |
+
border-radius: 10px;
|
| 3679 |
+
font-weight: 600;
|
| 3680 |
+
letter-spacing: 0.01em;
|
| 3681 |
+
}
|
| 3682 |
+
|
| 3683 |
+
.btn-primary {
|
| 3684 |
+
background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
|
| 3685 |
+
box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
|
| 3686 |
+
}
|
| 3687 |
+
|
| 3688 |
+
.btn-primary:hover {
|
| 3689 |
+
background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
|
| 3690 |
+
transform: translateY(-1px);
|
| 3691 |
+
box-shadow: 0 6px 16px rgba(99, 102, 241, 0.3);
|
| 3692 |
+
}
|
| 3693 |
+
|
| 3694 |
+
.btn-primary:active {
|
| 3695 |
+
transform: translateY(0);
|
| 3696 |
+
box-shadow: 0 1px 4px rgba(99, 102, 241, 0.2);
|
| 3697 |
+
}
|
| 3698 |
+
|
| 3699 |
+
.btn-danger {
|
| 3700 |
+
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
|
| 3701 |
+
}
|
| 3702 |
+
|
| 3703 |
+
.btn-danger:hover {
|
| 3704 |
+
transform: translateY(-1px);
|
| 3705 |
+
box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
|
| 3706 |
+
}
|
| 3707 |
+
|
| 3708 |
+
.btn-success {
|
| 3709 |
+
box-shadow: 0 2px 8px rgba(34, 197, 94, 0.2);
|
| 3710 |
+
}
|
| 3711 |
+
|
| 3712 |
+
.btn-success:hover {
|
| 3713 |
+
transform: translateY(-1px);
|
| 3714 |
+
box-shadow: 0 6px 16px rgba(34, 197, 94, 0.3);
|
| 3715 |
+
}
|
| 3716 |
+
|
| 3717 |
+
.btn-outline {
|
| 3718 |
+
border-radius: 10px;
|
| 3719 |
+
}
|
| 3720 |
+
|
| 3721 |
+
.btn-outline:hover {
|
| 3722 |
+
transform: translateY(-1px);
|
| 3723 |
+
}
|
| 3724 |
+
|
| 3725 |
+
/* --- Badge Premium --- */
|
| 3726 |
+
.badge {
|
| 3727 |
+
font-weight: 600;
|
| 3728 |
+
letter-spacing: 0.02em;
|
| 3729 |
+
font-size: 0.6875rem;
|
| 3730 |
+
text-transform: uppercase;
|
| 3731 |
+
}
|
| 3732 |
+
|
| 3733 |
+
.badge.active {
|
| 3734 |
+
box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.1);
|
| 3735 |
+
}
|
| 3736 |
+
|
| 3737 |
+
.badge.inactive {
|
| 3738 |
+
box-shadow: 0 0 0 2px rgba(107, 114, 128, 0.08);
|
| 3739 |
+
}
|
| 3740 |
+
|
| 3741 |
+
/* --- Card Premium --- */
|
| 3742 |
+
.card {
|
| 3743 |
+
border-radius: 16px;
|
| 3744 |
+
}
|
| 3745 |
+
|
| 3746 |
+
/* --- Stats Card --- */
|
| 3747 |
+
.stat-card {
|
| 3748 |
+
position: relative;
|
| 3749 |
+
overflow: hidden;
|
| 3750 |
+
}
|
| 3751 |
+
|
| 3752 |
+
.stat-card::before {
|
| 3753 |
+
content: '';
|
| 3754 |
+
position: absolute;
|
| 3755 |
+
top: 0;
|
| 3756 |
+
left: 0;
|
| 3757 |
+
right: 0;
|
| 3758 |
+
height: 3px;
|
| 3759 |
+
background: linear-gradient(90deg, var(--primary-500), transparent);
|
| 3760 |
+
opacity: 0;
|
| 3761 |
+
transition: opacity 0.3s ease;
|
| 3762 |
+
}
|
| 3763 |
+
|
| 3764 |
+
.stat-card:hover::before {
|
| 3765 |
+
opacity: 1;
|
| 3766 |
+
}
|
| 3767 |
+
|
| 3768 |
+
.stat-value {
|
| 3769 |
+
font-size: 2rem;
|
| 3770 |
+
letter-spacing: -0.03em;
|
| 3771 |
+
}
|
| 3772 |
+
|
| 3773 |
+
/* --- Form Premium --- */
|
| 3774 |
+
.form-input,
|
| 3775 |
+
.form-textarea,
|
| 3776 |
+
.form-select {
|
| 3777 |
+
border-radius: 10px;
|
| 3778 |
+
padding: 0.75rem 1rem;
|
| 3779 |
+
}
|
| 3780 |
+
|
| 3781 |
+
.form-input:focus,
|
| 3782 |
+
.form-textarea:focus,
|
| 3783 |
+
.form-select:focus {
|
| 3784 |
+
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
|
| 3785 |
+
}
|
| 3786 |
+
|
| 3787 |
+
.form-label {
|
| 3788 |
+
font-weight: 600;
|
| 3789 |
+
letter-spacing: 0.01em;
|
| 3790 |
+
color: var(--gray-800);
|
| 3791 |
+
}
|
| 3792 |
+
|
| 3793 |
+
/* --- Toggle Premium --- */
|
| 3794 |
+
.toggle {
|
| 3795 |
+
width: 46px;
|
| 3796 |
+
height: 26px;
|
| 3797 |
+
}
|
| 3798 |
+
|
| 3799 |
+
.toggle::after {
|
| 3800 |
+
width: 20px;
|
| 3801 |
+
height: 20px;
|
| 3802 |
+
}
|
| 3803 |
+
|
| 3804 |
+
.toggle.active::after {
|
| 3805 |
+
transform: translateX(20px);
|
| 3806 |
+
}
|
| 3807 |
+
|
| 3808 |
+
/* --- List Item Premium --- */
|
| 3809 |
+
.list-item {
|
| 3810 |
+
border-radius: 14px;
|
| 3811 |
+
padding: 1rem 1.25rem;
|
| 3812 |
+
}
|
| 3813 |
+
|
| 3814 |
+
.list-item:hover {
|
| 3815 |
+
transform: translateX(3px);
|
| 3816 |
+
box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.06);
|
| 3817 |
+
}
|
| 3818 |
+
|
| 3819 |
+
.list-item-icon {
|
| 3820 |
+
border-radius: 14px;
|
| 3821 |
+
}
|
| 3822 |
+
|
| 3823 |
+
.list-item-title {
|
| 3824 |
+
font-size: 0.9375rem;
|
| 3825 |
+
font-weight: 700;
|
| 3826 |
+
letter-spacing: -0.01em;
|
| 3827 |
+
}
|
| 3828 |
+
|
| 3829 |
+
/* --- Agent Card Premium --- */
|
| 3830 |
+
.agent-card {
|
| 3831 |
+
border-radius: 18px;
|
| 3832 |
+
overflow: hidden;
|
| 3833 |
+
}
|
| 3834 |
+
|
| 3835 |
+
.agent-card:hover {
|
| 3836 |
+
transform: translateY(-4px);
|
| 3837 |
+
box-shadow: 0 16px 30px -8px rgba(0, 0, 0, 0.1);
|
| 3838 |
+
}
|
| 3839 |
+
|
| 3840 |
+
.agent-icon {
|
| 3841 |
+
border-radius: 16px;
|
| 3842 |
+
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
|
| 3843 |
+
}
|
| 3844 |
+
|
| 3845 |
+
.agent-name {
|
| 3846 |
+
font-size: 1.125rem;
|
| 3847 |
+
font-weight: 700;
|
| 3848 |
+
letter-spacing: -0.01em;
|
| 3849 |
+
}
|
| 3850 |
+
|
| 3851 |
+
.agent-card-footer {
|
| 3852 |
+
border-top: 1px solid var(--gray-100);
|
| 3853 |
+
padding-top: 1rem;
|
| 3854 |
+
margin-top: 1rem;
|
| 3855 |
+
}
|
| 3856 |
+
|
| 3857 |
+
.agent-card-date {
|
| 3858 |
+
font-size: 0.75rem;
|
| 3859 |
+
color: var(--gray-400);
|
| 3860 |
+
margin-top: 0.375rem;
|
| 3861 |
+
}
|
| 3862 |
+
|
| 3863 |
+
.agent-card-meta {
|
| 3864 |
+
display: flex;
|
| 3865 |
+
align-items: center;
|
| 3866 |
+
justify-content: space-between;
|
| 3867 |
+
}
|
| 3868 |
+
|
| 3869 |
+
.agent-meta-item {
|
| 3870 |
+
display: flex;
|
| 3871 |
+
align-items: center;
|
| 3872 |
+
gap: 4px;
|
| 3873 |
+
font-size: 0.8125rem;
|
| 3874 |
+
color: var(--gray-500);
|
| 3875 |
+
}
|
| 3876 |
+
|
| 3877 |
+
.agent-card-body {
|
| 3878 |
+
padding: 0.25rem 0;
|
| 3879 |
+
}
|
| 3880 |
+
|
| 3881 |
+
.agent-description {
|
| 3882 |
+
font-size: 0.8125rem;
|
| 3883 |
+
color: var(--gray-500);
|
| 3884 |
+
line-height: 1.5;
|
| 3885 |
+
margin-top: 0.5rem;
|
| 3886 |
+
}
|
| 3887 |
+
|
| 3888 |
+
/* --- Empty State Premium --- */
|
| 3889 |
+
.empty-state {
|
| 3890 |
+
text-align: center;
|
| 3891 |
+
padding: 3rem 2rem;
|
| 3892 |
+
}
|
| 3893 |
+
|
| 3894 |
+
.empty-icon {
|
| 3895 |
+
font-size: 3rem;
|
| 3896 |
+
margin-bottom: 1rem;
|
| 3897 |
+
filter: grayscale(0.2);
|
| 3898 |
+
}
|
| 3899 |
+
|
| 3900 |
+
.empty-title {
|
| 3901 |
+
font-size: 1.25rem;
|
| 3902 |
+
font-weight: 700;
|
| 3903 |
+
color: var(--gray-900);
|
| 3904 |
+
margin-bottom: 0.5rem;
|
| 3905 |
+
}
|
| 3906 |
+
|
| 3907 |
+
.empty-message {
|
| 3908 |
+
color: var(--gray-500);
|
| 3909 |
+
margin-bottom: 1.5rem;
|
| 3910 |
+
max-width: 300px;
|
| 3911 |
+
margin-left: auto;
|
| 3912 |
+
margin-right: auto;
|
| 3913 |
+
}
|
| 3914 |
+
|
| 3915 |
+
/* --- Chat Premium --- */
|
| 3916 |
+
.chat-container {
|
| 3917 |
+
border-radius: 20px;
|
| 3918 |
+
border: 1px solid var(--gray-200);
|
| 3919 |
+
}
|
| 3920 |
+
|
| 3921 |
+
.chat-header {
|
| 3922 |
+
padding: 1.125rem 1.5rem;
|
| 3923 |
+
border-bottom-color: var(--gray-100);
|
| 3924 |
+
}
|
| 3925 |
+
|
| 3926 |
+
.chat-agent-name {
|
| 3927 |
+
font-weight: 700;
|
| 3928 |
+
letter-spacing: -0.01em;
|
| 3929 |
+
}
|
| 3930 |
+
|
| 3931 |
+
.message-bubble {
|
| 3932 |
+
border-radius: 18px;
|
| 3933 |
+
padding: 0.875rem 1.125rem;
|
| 3934 |
+
}
|
| 3935 |
+
|
| 3936 |
+
.message.user .message-bubble {
|
| 3937 |
+
border-bottom-right-radius: 4px;
|
| 3938 |
+
}
|
| 3939 |
+
|
| 3940 |
+
.message.agent .message-bubble {
|
| 3941 |
+
border-bottom-left-radius: 4px;
|
| 3942 |
+
}
|
| 3943 |
+
|
| 3944 |
+
/* --- Toast Premium --- */
|
| 3945 |
+
.toast {
|
| 3946 |
+
border-radius: 14px;
|
| 3947 |
+
padding: 1.125rem;
|
| 3948 |
+
border-left-width: 4px;
|
| 3949 |
+
box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.12);
|
| 3950 |
+
}
|
| 3951 |
+
|
| 3952 |
+
.toast-title {
|
| 3953 |
+
font-weight: 700;
|
| 3954 |
+
letter-spacing: -0.01em;
|
| 3955 |
+
}
|
| 3956 |
+
|
| 3957 |
+
/* --- Modal Premium --- */
|
| 3958 |
+
.modal {
|
| 3959 |
+
border-radius: 20px;
|
| 3960 |
+
}
|
| 3961 |
+
|
| 3962 |
+
.modal-header {
|
| 3963 |
+
padding: 1.375rem 1.5rem;
|
| 3964 |
+
}
|
| 3965 |
+
|
| 3966 |
+
.modal-title {
|
| 3967 |
+
font-size: 1.25rem;
|
| 3968 |
+
font-weight: 700;
|
| 3969 |
+
letter-spacing: -0.01em;
|
| 3970 |
+
}
|
| 3971 |
+
|
| 3972 |
+
/* --- Auth Pages Premium --- */
|
| 3973 |
+
.auth-container {
|
| 3974 |
+
background: linear-gradient(135deg, #f8f9ff 0%, #e8ecff 50%, #f0f4ff 100%);
|
| 3975 |
+
}
|
| 3976 |
+
|
| 3977 |
+
.auth-card {
|
| 3978 |
+
border-radius: 24px;
|
| 3979 |
+
box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
|
| 3980 |
+
padding: 2.5rem;
|
| 3981 |
+
max-width: 420px;
|
| 3982 |
+
}
|
| 3983 |
+
|
| 3984 |
+
.auth-logo-avatar {
|
| 3985 |
+
box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
|
| 3986 |
+
}
|
| 3987 |
+
|
| 3988 |
+
.auth-title {
|
| 3989 |
+
font-weight: 800;
|
| 3990 |
+
letter-spacing: -0.025em;
|
| 3991 |
+
}
|
| 3992 |
+
|
| 3993 |
+
.btn-auth-primary {
|
| 3994 |
+
border-radius: 12px;
|
| 3995 |
+
font-weight: 700;
|
| 3996 |
+
padding: 0.875rem;
|
| 3997 |
+
font-size: 1rem;
|
| 3998 |
+
background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
|
| 3999 |
+
box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
|
| 4000 |
+
transition: all 0.25s ease;
|
| 4001 |
+
}
|
| 4002 |
+
|
| 4003 |
+
.btn-auth-primary:hover {
|
| 4004 |
+
transform: translateY(-1px);
|
| 4005 |
+
box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
|
| 4006 |
+
}
|
| 4007 |
+
|
| 4008 |
+
.social-btn {
|
| 4009 |
+
border-radius: 12px;
|
| 4010 |
+
transition: all 0.25s ease;
|
| 4011 |
+
}
|
| 4012 |
+
|
| 4013 |
+
.social-btn:hover {
|
| 4014 |
+
transform: translateY(-2px);
|
| 4015 |
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
|
| 4016 |
+
}
|
| 4017 |
+
|
| 4018 |
+
/* --- Spinner Premium --- */
|
| 4019 |
+
.spinner {
|
| 4020 |
+
width: 36px;
|
| 4021 |
+
height: 36px;
|
| 4022 |
+
border: 3px solid var(--gray-200);
|
| 4023 |
+
border-top-color: var(--primary-500);
|
| 4024 |
+
border-radius: 50%;
|
| 4025 |
+
animation: spin 0.8s linear infinite;
|
| 4026 |
+
margin: 0 auto;
|
| 4027 |
+
}
|
| 4028 |
+
|
| 4029 |
+
@keyframes spin {
|
| 4030 |
+
to {
|
| 4031 |
+
transform: rotate(360deg);
|
| 4032 |
+
}
|
| 4033 |
+
}
|
| 4034 |
+
|
| 4035 |
+
/* --- View Toggle Buttons --- */
|
| 4036 |
+
.btn-view-toggle {
|
| 4037 |
+
width: 36px;
|
| 4038 |
+
height: 36px;
|
| 4039 |
+
display: flex;
|
| 4040 |
+
align-items: center;
|
| 4041 |
+
justify-content: center;
|
| 4042 |
+
border-radius: 8px;
|
| 4043 |
+
color: var(--gray-400);
|
| 4044 |
+
transition: all 0.2s ease;
|
| 4045 |
+
}
|
| 4046 |
+
|
| 4047 |
+
.btn-view-toggle.active {
|
| 4048 |
+
background: var(--primary-100);
|
| 4049 |
+
color: var(--primary-600);
|
| 4050 |
+
}
|
| 4051 |
+
|
| 4052 |
+
.btn-view-toggle:hover:not(.active) {
|
| 4053 |
+
background: var(--gray-100);
|
| 4054 |
+
color: var(--gray-600);
|
| 4055 |
+
}
|
| 4056 |
+
|
| 4057 |
+
/* --- Link Buttons --- */
|
| 4058 |
+
.btn-link {
|
| 4059 |
+
font-size: 0.875rem;
|
| 4060 |
+
font-weight: 600;
|
| 4061 |
+
color: var(--primary-600);
|
| 4062 |
+
transition: all 0.2s ease;
|
| 4063 |
+
}
|
| 4064 |
+
|
| 4065 |
+
.btn-link:hover {
|
| 4066 |
+
color: var(--primary-700);
|
| 4067 |
+
transform: translateX(2px);
|
| 4068 |
+
}
|
| 4069 |
+
|
| 4070 |
+
/* --- Section Title --- */
|
| 4071 |
+
.section-title {
|
| 4072 |
+
font-weight: 800;
|
| 4073 |
+
letter-spacing: -0.01em;
|
| 4074 |
+
}
|
| 4075 |
+
|
| 4076 |
+
/* --- Responsive Polish --- */
|
| 4077 |
+
@media (max-width: 768px) {
|
| 4078 |
+
.page-title {
|
| 4079 |
+
font-size: 1.5rem;
|
| 4080 |
+
}
|
| 4081 |
+
|
| 4082 |
+
.page-header {
|
| 4083 |
+
flex-direction: column;
|
| 4084 |
+
align-items: flex-start;
|
| 4085 |
+
gap: 1rem;
|
| 4086 |
+
}
|
| 4087 |
+
|
| 4088 |
+
.main-content {
|
| 4089 |
+
padding: 1.25rem;
|
| 4090 |
+
}
|
| 4091 |
+
|
| 4092 |
+
.stats-grid {
|
| 4093 |
+
grid-template-columns: 1fr 1fr;
|
| 4094 |
+
gap: 1rem;
|
| 4095 |
+
}
|
| 4096 |
+
|
| 4097 |
+
.auth-card {
|
| 4098 |
+
padding: 1.75rem;
|
| 4099 |
+
border-radius: 20px;
|
| 4100 |
+
}
|
| 4101 |
+
}
|
| 4102 |
+
|
| 4103 |
+
/* ============================================================================
|
| 4104 |
+
Templates / Marketplace Page
|
| 4105 |
+
============================================================================ */
|
| 4106 |
+
.templates-grid {
|
| 4107 |
+
display: grid;
|
| 4108 |
+
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
| 4109 |
+
gap: 1.5rem;
|
| 4110 |
+
}
|
| 4111 |
+
|
| 4112 |
+
.template-card {
|
| 4113 |
+
background: var(--card-bg);
|
| 4114 |
+
border-radius: var(--border-radius-lg);
|
| 4115 |
+
box-shadow: var(--card-shadow);
|
| 4116 |
+
border: 1px solid var(--border-color);
|
| 4117 |
+
overflow: hidden;
|
| 4118 |
+
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
|
| 4119 |
+
display: flex;
|
| 4120 |
+
flex-direction: column;
|
| 4121 |
+
}
|
| 4122 |
+
|
| 4123 |
+
.template-card:hover {
|
| 4124 |
+
transform: translateY(-3px);
|
| 4125 |
+
box-shadow: var(--card-shadow-lg);
|
| 4126 |
+
border-color: var(--primary-300);
|
| 4127 |
+
}
|
| 4128 |
+
|
| 4129 |
+
.template-card-header {
|
| 4130 |
+
display: flex;
|
| 4131 |
+
align-items: center;
|
| 4132 |
+
gap: 0.875rem;
|
| 4133 |
+
padding: 1.25rem;
|
| 4134 |
+
border-bottom: 1px solid var(--border-color);
|
| 4135 |
+
}
|
| 4136 |
+
|
| 4137 |
+
.template-icon {
|
| 4138 |
+
width: 48px;
|
| 4139 |
+
height: 48px;
|
| 4140 |
+
border-radius: 12px;
|
| 4141 |
+
display: flex;
|
| 4142 |
+
align-items: center;
|
| 4143 |
+
justify-content: center;
|
| 4144 |
+
font-size: 1.5rem;
|
| 4145 |
+
flex-shrink: 0;
|
| 4146 |
+
}
|
| 4147 |
+
|
| 4148 |
+
.template-name {
|
| 4149 |
+
font-weight: 700;
|
| 4150 |
+
font-size: 1rem;
|
| 4151 |
+
color: var(--gray-900);
|
| 4152 |
+
line-height: 1.2;
|
| 4153 |
+
}
|
| 4154 |
+
|
| 4155 |
+
.template-role {
|
| 4156 |
+
font-size: 0.8rem;
|
| 4157 |
+
color: var(--gray-500);
|
| 4158 |
+
margin-top: 0.2rem;
|
| 4159 |
+
}
|
| 4160 |
+
|
| 4161 |
+
.template-badge {
|
| 4162 |
+
margin-left: auto;
|
| 4163 |
+
font-size: 0.7rem;
|
| 4164 |
+
font-weight: 600;
|
| 4165 |
+
background: var(--primary-100);
|
| 4166 |
+
color: var(--primary-700);
|
| 4167 |
+
border-radius: 20px;
|
| 4168 |
+
padding: 0.25rem 0.6rem;
|
| 4169 |
+
flex-shrink: 0;
|
| 4170 |
+
white-space: nowrap;
|
| 4171 |
+
}
|
| 4172 |
+
|
| 4173 |
+
.template-card-body {
|
| 4174 |
+
padding: 1rem 1.25rem;
|
| 4175 |
+
flex: 1;
|
| 4176 |
+
}
|
| 4177 |
+
|
| 4178 |
+
.template-description {
|
| 4179 |
+
font-size: 0.875rem;
|
| 4180 |
+
color: var(--gray-600);
|
| 4181 |
+
line-height: 1.55;
|
| 4182 |
+
margin-bottom: 0.75rem;
|
| 4183 |
+
}
|
| 4184 |
+
|
| 4185 |
+
.template-tags {
|
| 4186 |
+
display: flex;
|
| 4187 |
+
gap: 0.4rem;
|
| 4188 |
+
flex-wrap: wrap;
|
| 4189 |
+
}
|
| 4190 |
+
|
| 4191 |
+
.template-tag {
|
| 4192 |
+
font-size: 0.7rem;
|
| 4193 |
+
background: var(--gray-100);
|
| 4194 |
+
color: var(--gray-600);
|
| 4195 |
+
border-radius: 20px;
|
| 4196 |
+
padding: 0.2rem 0.55rem;
|
| 4197 |
+
text-transform: capitalize;
|
| 4198 |
+
}
|
| 4199 |
+
|
| 4200 |
+
.template-card-footer {
|
| 4201 |
+
padding: 0.875rem 1.25rem;
|
| 4202 |
+
border-top: 1px solid var(--border-color);
|
| 4203 |
+
display: flex;
|
| 4204 |
+
gap: 0.5rem;
|
| 4205 |
+
justify-content: flex-end;
|
| 4206 |
+
}
|
| 4207 |
+
|
| 4208 |
+
/* Category filter buttons */
|
| 4209 |
+
.template-cat-btn {
|
| 4210 |
+
padding: 0.4rem 1rem;
|
| 4211 |
+
border-radius: 20px;
|
| 4212 |
+
font-size: 0.85rem;
|
| 4213 |
+
font-weight: 500;
|
| 4214 |
+
border: 1px solid var(--border-color);
|
| 4215 |
+
background: var(--card-bg);
|
| 4216 |
+
color: var(--gray-600);
|
| 4217 |
+
cursor: pointer;
|
| 4218 |
+
transition: all 0.15s ease;
|
| 4219 |
+
}
|
| 4220 |
+
|
| 4221 |
+
.template-cat-btn:hover {
|
| 4222 |
+
border-color: var(--primary-400);
|
| 4223 |
+
color: var(--primary-600);
|
| 4224 |
+
}
|
| 4225 |
+
|
| 4226 |
+
.template-cat-btn.active {
|
| 4227 |
+
background: var(--primary-500);
|
| 4228 |
+
border-color: var(--primary-500);
|
| 4229 |
+
color: white;
|
| 4230 |
+
}
|
| 4231 |
+
|
| 4232 |
+
/* ============================================================================
|
| 4233 |
+
Status Badges — Draft & Archived
|
| 4234 |
+
============================================================================ */
|
| 4235 |
+
.badge.draft {
|
| 4236 |
+
background: rgba(245, 158, 11, 0.12);
|
| 4237 |
+
color: #b45309;
|
| 4238 |
+
border: 1px solid rgba(245, 158, 11, 0.3);
|
| 4239 |
+
}
|
| 4240 |
+
|
| 4241 |
+
.badge.archived {
|
| 4242 |
+
background: rgba(107, 114, 128, 0.1);
|
| 4243 |
+
color: var(--gray-500);
|
| 4244 |
+
border: 1px solid rgba(107, 114, 128, 0.2);
|
| 4245 |
+
}
|
| 4246 |
+
|
| 4247 |
+
/* ============================================================================
|
| 4248 |
+
Onboarding Modal Animations
|
| 4249 |
+
============================================================================ */
|
| 4250 |
+
@keyframes fadeIn {
|
| 4251 |
+
from {
|
| 4252 |
+
opacity: 0;
|
| 4253 |
+
}
|
| 4254 |
+
|
| 4255 |
+
to {
|
| 4256 |
+
opacity: 1;
|
| 4257 |
+
}
|
| 4258 |
+
}
|
| 4259 |
+
|
| 4260 |
+
@keyframes fadeOut {
|
| 4261 |
+
from {
|
| 4262 |
+
opacity: 1;
|
| 4263 |
+
}
|
| 4264 |
+
|
| 4265 |
+
to {
|
| 4266 |
+
opacity: 0;
|
| 4267 |
+
}
|
| 4268 |
+
}
|
| 4269 |
+
|
| 4270 |
+
@keyframes slideUp {
|
| 4271 |
+
from {
|
| 4272 |
+
opacity: 0;
|
| 4273 |
+
transform: translateY(24px);
|
| 4274 |
+
}
|
| 4275 |
+
|
| 4276 |
+
to {
|
| 4277 |
+
opacity: 1;
|
| 4278 |
+
transform: translateY(0);
|
| 4279 |
+
}
|
| 4280 |
+
}
|
| 4281 |
+
|
| 4282 |
+
/* ============================================================================
|
| 4283 |
+
STT Recording State
|
| 4284 |
+
============================================================================ */
|
| 4285 |
+
.chat-mic-btn.recording {
|
| 4286 |
+
background: rgba(239, 68, 68, 0.15) !important;
|
| 4287 |
+
color: #ef4444 !important;
|
| 4288 |
+
border-color: rgba(239, 68, 68, 0.4) !important;
|
| 4289 |
+
animation: pulseRec 1.5s ease infinite;
|
| 4290 |
+
}
|
| 4291 |
+
|
| 4292 |
+
@keyframes pulseRec {
|
| 4293 |
+
|
| 4294 |
+
0%,
|
| 4295 |
+
100% {
|
| 4296 |
+
box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
|
| 4297 |
+
}
|
| 4298 |
+
|
| 4299 |
+
50% {
|
| 4300 |
+
box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
|
| 4301 |
+
}
|
| 4302 |
+
}
|
| 4303 |
+
|
| 4304 |
+
/* ============================================================================
|
| 4305 |
+
Sidebar Header — flex for notification bell
|
| 4306 |
+
============================================================================ */
|
| 4307 |
+
.sidebar-header {
|
| 4308 |
+
display: flex;
|
| 4309 |
+
align-items: center;
|
| 4310 |
+
}
|
| 4311 |
+
|
| 4312 |
+
.sidebar-header .logo {
|
| 4313 |
+
flex: 1;
|
| 4314 |
+
}
|
| 4315 |
+
|
| 4316 |
+
/* Dark mode support for new components */
|
| 4317 |
+
[data-theme="dark"] .template-card {
|
| 4318 |
+
background: var(--card-bg);
|
| 4319 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 4320 |
+
}
|
| 4321 |
+
|
| 4322 |
+
[data-theme="dark"] .template-card:hover {
|
| 4323 |
+
border-color: rgba(99, 102, 241, 0.35);
|
| 4324 |
+
}
|
| 4325 |
+
|
| 4326 |
+
[data-theme="dark"] .template-cat-btn {
|
| 4327 |
+
background: rgba(255, 255, 255, 0.04);
|
| 4328 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 4329 |
+
color: var(--gray-600);
|
| 4330 |
+
}
|
| 4331 |
+
|
| 4332 |
+
[data-theme="dark"] .template-cat-btn.active {
|
| 4333 |
+
background: var(--primary-500);
|
| 4334 |
+
border-color: var(--primary-500);
|
| 4335 |
+
color: white;
|
| 4336 |
+
}
|
| 4337 |
+
|
| 4338 |
+
[data-theme="dark"] .template-tag {
|
| 4339 |
+
background: rgba(255, 255, 255, 0.06);
|
| 4340 |
+
color: var(--gray-500);
|
| 4341 |
+
}
|
| 4342 |
+
|
| 4343 |
+
[data-theme="dark"] #notif-panel {
|
| 4344 |
+
background: var(--card-bg);
|
| 4345 |
+
border-color: rgba(255, 255, 255, 0.08);
|
| 4346 |
+
}
|
| 4347 |
+
|
| 4348 |
+
/* ============================================================================
|
| 4349 |
+
Agent Creation — Choice Screen
|
| 4350 |
+
============================================================================ */
|
| 4351 |
+
.choice-screen-wrapper {
|
| 4352 |
+
max-width: 800px;
|
| 4353 |
+
margin: 0 auto;
|
| 4354 |
+
padding-top: 1rem;
|
| 4355 |
+
}
|
| 4356 |
+
|
| 4357 |
+
.choice-options {
|
| 4358 |
+
display: flex;
|
| 4359 |
+
align-items: stretch;
|
| 4360 |
+
gap: 0;
|
| 4361 |
+
background: var(--card-bg);
|
| 4362 |
+
border: 1px solid var(--border-color);
|
| 4363 |
+
border-radius: 20px;
|
| 4364 |
+
overflow: hidden;
|
| 4365 |
+
box-shadow: var(--card-shadow-lg);
|
| 4366 |
+
}
|
| 4367 |
+
|
| 4368 |
+
.choice-option {
|
| 4369 |
+
flex: 1;
|
| 4370 |
+
display: flex;
|
| 4371 |
+
flex-direction: column;
|
| 4372 |
+
align-items: center;
|
| 4373 |
+
justify-content: center;
|
| 4374 |
+
gap: 1rem;
|
| 4375 |
+
padding: 3rem 2.5rem;
|
| 4376 |
+
text-align: center;
|
| 4377 |
+
transition: background 0.2s ease;
|
| 4378 |
+
}
|
| 4379 |
+
|
| 4380 |
+
.choice-option:hover {
|
| 4381 |
+
background: var(--gray-50);
|
| 4382 |
+
}
|
| 4383 |
+
|
| 4384 |
+
.choice-option-icon {
|
| 4385 |
+
font-size: 3.5rem;
|
| 4386 |
+
line-height: 1;
|
| 4387 |
+
filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.08));
|
| 4388 |
+
}
|
| 4389 |
+
|
| 4390 |
+
.choice-option-title {
|
| 4391 |
+
font-size: 1.375rem;
|
| 4392 |
+
font-weight: 800;
|
| 4393 |
+
color: var(--gray-900);
|
| 4394 |
+
letter-spacing: -0.02em;
|
| 4395 |
+
margin: 0;
|
| 4396 |
+
}
|
| 4397 |
+
|
| 4398 |
+
.choice-option-desc {
|
| 4399 |
+
font-size: 0.9375rem;
|
| 4400 |
+
color: var(--gray-500);
|
| 4401 |
+
line-height: 1.6;
|
| 4402 |
+
margin: 0;
|
| 4403 |
+
max-width: 240px;
|
| 4404 |
+
}
|
| 4405 |
+
|
| 4406 |
+
.choice-divider {
|
| 4407 |
+
display: flex;
|
| 4408 |
+
align-items: center;
|
| 4409 |
+
justify-content: center;
|
| 4410 |
+
width: 48px;
|
| 4411 |
+
flex-shrink: 0;
|
| 4412 |
+
position: relative;
|
| 4413 |
+
background: transparent;
|
| 4414 |
+
}
|
| 4415 |
+
|
| 4416 |
+
.choice-divider::before {
|
| 4417 |
+
content: '';
|
| 4418 |
+
position: absolute;
|
| 4419 |
+
top: 0;
|
| 4420 |
+
bottom: 0;
|
| 4421 |
+
left: 50%;
|
| 4422 |
+
transform: translateX(-50%);
|
| 4423 |
+
width: 1px;
|
| 4424 |
+
background: var(--border-color);
|
| 4425 |
+
}
|
| 4426 |
+
|
| 4427 |
+
.choice-divider span {
|
| 4428 |
+
position: relative;
|
| 4429 |
+
z-index: 1;
|
| 4430 |
+
background: var(--card-bg);
|
| 4431 |
+
padding: 0.375rem 0.25rem;
|
| 4432 |
+
font-size: 0.8125rem;
|
| 4433 |
+
font-weight: 600;
|
| 4434 |
+
color: var(--gray-400);
|
| 4435 |
+
letter-spacing: 0.02em;
|
| 4436 |
+
}
|
| 4437 |
+
|
| 4438 |
+
/* ============================================================================
|
| 4439 |
+
Agent Creation — Scratch Ideas Grid
|
| 4440 |
+
============================================================================ */
|
| 4441 |
+
.scratch-ideas-grid {
|
| 4442 |
+
display: grid;
|
| 4443 |
+
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
| 4444 |
+
gap: 1.25rem;
|
| 4445 |
+
margin-top: 0.5rem;
|
| 4446 |
+
}
|
| 4447 |
+
|
| 4448 |
+
.scratch-idea-card {
|
| 4449 |
+
background: var(--card-bg);
|
| 4450 |
+
border: 1.5px solid var(--border-color);
|
| 4451 |
+
border-radius: 16px;
|
| 4452 |
+
padding: 1.5rem;
|
| 4453 |
+
display: flex;
|
| 4454 |
+
flex-direction: column;
|
| 4455 |
+
gap: 0.75rem;
|
| 4456 |
+
transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
|
| 4457 |
+
cursor: pointer;
|
| 4458 |
+
}
|
| 4459 |
+
|
| 4460 |
+
.scratch-idea-card:hover {
|
| 4461 |
+
transform: translateY(-3px);
|
| 4462 |
+
box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.1);
|
| 4463 |
+
border-color: var(--primary-300);
|
| 4464 |
+
}
|
| 4465 |
+
|
| 4466 |
+
.scratch-idea-icon {
|
| 4467 |
+
font-size: 2.25rem;
|
| 4468 |
+
line-height: 1;
|
| 4469 |
+
}
|
| 4470 |
+
|
| 4471 |
+
.scratch-idea-title {
|
| 4472 |
+
font-size: 1rem;
|
| 4473 |
+
font-weight: 700;
|
| 4474 |
+
color: var(--gray-900);
|
| 4475 |
+
letter-spacing: -0.01em;
|
| 4476 |
+
}
|
| 4477 |
+
|
| 4478 |
+
.scratch-idea-desc {
|
| 4479 |
+
font-size: 0.85rem;
|
| 4480 |
+
color: var(--gray-500);
|
| 4481 |
+
line-height: 1.55;
|
| 4482 |
+
flex: 1;
|
| 4483 |
+
}
|
| 4484 |
+
|
| 4485 |
+
.scratch-idea-blank {
|
| 4486 |
+
border-style: dashed;
|
| 4487 |
+
background: var(--gray-50);
|
| 4488 |
+
}
|
| 4489 |
+
|
| 4490 |
+
.scratch-idea-blank:hover {
|
| 4491 |
+
background: var(--primary-50);
|
| 4492 |
+
border-color: var(--primary-400);
|
| 4493 |
+
}
|
| 4494 |
+
|
| 4495 |
+
/* Button size lg */
|
| 4496 |
+
.btn-lg {
|
| 4497 |
+
padding: 0.875rem 2rem;
|
| 4498 |
+
font-size: 1rem;
|
| 4499 |
+
border-radius: 12px;
|
| 4500 |
+
}
|
| 4501 |
+
|
| 4502 |
+
/* Dark mode — choice screen */
|
| 4503 |
+
[data-theme="dark"] .choice-options {
|
| 4504 |
+
background: var(--card-bg);
|
| 4505 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 4506 |
+
}
|
| 4507 |
+
|
| 4508 |
+
[data-theme="dark"] .choice-option:hover {
|
| 4509 |
+
background: rgba(255, 255, 255, 0.03);
|
| 4510 |
+
}
|
| 4511 |
+
|
| 4512 |
+
[data-theme="dark"] .choice-divider span {
|
| 4513 |
+
background: var(--card-bg);
|
| 4514 |
+
}
|
| 4515 |
+
|
| 4516 |
+
[data-theme="dark"] .choice-divider::before {
|
| 4517 |
+
background: rgba(255, 255, 255, 0.06);
|
| 4518 |
+
}
|
| 4519 |
+
|
| 4520 |
+
[data-theme="dark"] .scratch-idea-card {
|
| 4521 |
+
background: var(--card-bg);
|
| 4522 |
+
border-color: rgba(255, 255, 255, 0.06);
|
| 4523 |
+
}
|
| 4524 |
+
|
| 4525 |
+
[data-theme="dark"] .scratch-idea-card:hover {
|
| 4526 |
+
border-color: rgba(99, 102, 241, 0.35);
|
| 4527 |
+
}
|
| 4528 |
+
|
| 4529 |
+
[data-theme="dark"] .scratch-idea-blank {
|
| 4530 |
+
background: rgba(255, 255, 255, 0.02);
|
| 4531 |
+
}
|
| 4532 |
+
|
| 4533 |
+
[data-theme="dark"] .scratch-idea-blank:hover {
|
| 4534 |
+
background: rgba(99, 102, 241, 0.06);
|
| 4535 |
+
}
|
| 4536 |
+
|
| 4537 |
+
@media (max-width: 640px) {
|
| 4538 |
+
.choice-options {
|
| 4539 |
+
flex-direction: column;
|
| 4540 |
+
}
|
| 4541 |
+
|
| 4542 |
+
.choice-divider {
|
| 4543 |
+
width: 100%;
|
| 4544 |
+
height: 48px;
|
| 4545 |
+
flex-direction: row;
|
| 4546 |
+
}
|
| 4547 |
+
|
| 4548 |
+
.choice-divider::before {
|
| 4549 |
+
top: 50%;
|
| 4550 |
+
left: 0;
|
| 4551 |
+
right: 0;
|
| 4552 |
+
bottom: auto;
|
| 4553 |
+
width: 100%;
|
| 4554 |
+
height: 1px;
|
| 4555 |
+
transform: translateY(-50%);
|
| 4556 |
+
}
|
| 4557 |
+
}
|
frontend/image/favicon.PNG
ADDED
|
|
Git LFS Details
|
frontend/index.html
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>PersonaFlow - AI Conversation Agents</title>
|
| 8 |
+
<meta name="description"
|
| 9 |
+
content="Create custom AI conversation agents with unique personalities. Chat or video call with your agents and share them with others.">
|
| 10 |
+
|
| 11 |
+
<!-- Google Fonts -->
|
| 12 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
| 13 |
+
|
| 14 |
+
<!-- Font Awesome -->
|
| 15 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 16 |
+
|
| 17 |
+
<!-- Favicon -->
|
| 18 |
+
<link rel="icon" type="image/png" href="image/favicon.png">
|
| 19 |
+
|
| 20 |
+
<!-- Styles -->
|
| 21 |
+
<link rel="stylesheet" href="css/styles.css">
|
| 22 |
+
</head>
|
| 23 |
+
|
| 24 |
+
<script>
|
| 25 |
+
// Apply dark mode immediately to prevent flash
|
| 26 |
+
(function () {
|
| 27 |
+
if (localStorage.getItem('personaflow-theme') === 'dark') {
|
| 28 |
+
document.documentElement.setAttribute('data-theme', 'dark');
|
| 29 |
+
}
|
| 30 |
+
})();
|
| 31 |
+
</script>
|
| 32 |
+
|
| 33 |
+
<body>
|
| 34 |
+
<!-- App Container -->
|
| 35 |
+
<div id="app">
|
| 36 |
+
<!-- Sidebar (hidden on auth pages) -->
|
| 37 |
+
<aside id="sidebar" class="sidebar hidden">
|
| 38 |
+
<div class="sidebar-header">
|
| 39 |
+
<div class="logo">
|
| 40 |
+
<img src="image/favicon.png" alt="PersonaFlow" class="logo-img">
|
| 41 |
+
<div style="display: flex; flex-direction: column;">
|
| 42 |
+
<span class="logo-text">PersonaFlow</span>
|
| 43 |
+
<span class="logo-subtitle">Dynamic AI Platform</span>
|
| 44 |
+
</div>
|
| 45 |
+
</div>
|
| 46 |
+
</div>
|
| 47 |
+
|
| 48 |
+
<nav class="sidebar-nav">
|
| 49 |
+
<a href="#/dashboard" class="nav-item" data-page="dashboard">
|
| 50 |
+
<span class="nav-icon"><i class="fas fa-th-large"></i></span>
|
| 51 |
+
<span class="nav-label">Dashboard</span>
|
| 52 |
+
<span class="nav-chevron"><i class="fas fa-chevron-right"></i></span>
|
| 53 |
+
</a>
|
| 54 |
+
<a href="#/agents" class="nav-item" data-page="agents">
|
| 55 |
+
<span class="nav-icon"><i class="fas fa-robot"></i></span>
|
| 56 |
+
<span class="nav-label">My Agents</span>
|
| 57 |
+
<span class="nav-chevron"><i class="fas fa-chevron-right"></i></span>
|
| 58 |
+
</a>
|
| 59 |
+
<a href="#/conversations" class="nav-item" data-page="conversations">
|
| 60 |
+
<span class="nav-icon"><i class="fas fa-comments"></i></span>
|
| 61 |
+
<span class="nav-label">Conversations</span>
|
| 62 |
+
<span class="nav-chevron"><i class="fas fa-chevron-right"></i></span>
|
| 63 |
+
</a>
|
| 64 |
+
<a href="#/reports" class="nav-item" data-page="reports">
|
| 65 |
+
<span class="nav-icon"><i class="fas fa-clipboard-list"></i></span>
|
| 66 |
+
<span class="nav-label">Reports</span>
|
| 67 |
+
<span class="nav-chevron"><i class="fas fa-chevron-right"></i></span>
|
| 68 |
+
</a>
|
| 69 |
+
</nav>
|
| 70 |
+
|
| 71 |
+
<div class="sidebar-footer">
|
| 72 |
+
<div class="dark-mode-row">
|
| 73 |
+
<div class="dark-mode-label">
|
| 74 |
+
<i class="fas fa-moon" id="dark-mode-icon"></i>
|
| 75 |
+
<span>Dark Mode</span>
|
| 76 |
+
</div>
|
| 77 |
+
<div class="dark-mode-switch" id="dark-mode-toggle" title="Toggle Dark Mode"></div>
|
| 78 |
+
</div>
|
| 79 |
+
<div class="user-info" id="user-info">
|
| 80 |
+
<div class="user-avatar" id="user-avatar">AK</div>
|
| 81 |
+
<div class="user-details">
|
| 82 |
+
<span class="user-name" id="user-name">User</span>
|
| 83 |
+
<span class="user-email" id="user-email"></span>
|
| 84 |
+
</div>
|
| 85 |
+
<button class="logout-btn" id="logout-btn" title="Logout"><i
|
| 86 |
+
class="fas fa-sign-out-alt"></i></button>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
</aside>
|
| 90 |
+
|
| 91 |
+
<!-- Main Content Area -->
|
| 92 |
+
<main id="main-content" class="main-content">
|
| 93 |
+
<!-- Dynamic content loaded here -->
|
| 94 |
+
</main>
|
| 95 |
+
</div>
|
| 96 |
+
|
| 97 |
+
<!-- Modal Container -->
|
| 98 |
+
<div id="modal-container" class="modal-container hidden">
|
| 99 |
+
<div class="modal-backdrop"></div>
|
| 100 |
+
<div class="modal" id="modal">
|
| 101 |
+
<div class="modal-header">
|
| 102 |
+
<h3 class="modal-title" id="modal-title">Modal Title</h3>
|
| 103 |
+
<button class="modal-close" id="modal-close">×</button>
|
| 104 |
+
</div>
|
| 105 |
+
<div class="modal-body" id="modal-body">
|
| 106 |
+
<!-- Modal content -->
|
| 107 |
+
</div>
|
| 108 |
+
<div class="modal-footer" id="modal-footer">
|
| 109 |
+
<!-- Modal actions -->
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
</div>
|
| 113 |
+
|
| 114 |
+
<!-- Toast Container -->
|
| 115 |
+
<div id="toast-container" class="toast-container"></div>
|
| 116 |
+
|
| 117 |
+
<!-- Three.js for 3D Avatar -->
|
| 118 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.142.0/build/three.min.js"></script>
|
| 119 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.142.0/examples/js/loaders/GLTFLoader.js"></script>
|
| 120 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.142.0/examples/js/loaders/FBXLoader.js"></script>
|
| 121 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.142.0/examples/js/loaders/RGBELoader.js"></script>
|
| 122 |
+
<script src="https://cdn.jsdelivr.net/npm/three@0.142.0/examples/js/libs/fflate.min.js"></script>
|
| 123 |
+
|
| 124 |
+
<!-- Scripts -->
|
| 125 |
+
<script src="js/app.js"></script>
|
| 126 |
+
<script src="js/api.js"></script>
|
| 127 |
+
<script src="js/router.js"></script>
|
| 128 |
+
<script src="js/components/sidebar.js"></script>
|
| 129 |
+
<script src="js/components/modal.js"></script>
|
| 130 |
+
<script src="js/components/toast.js"></script>
|
| 131 |
+
<script src="js/components/three-converter.js"></script>
|
| 132 |
+
<script src="js/components/lipsync-engine.js"></script>
|
| 133 |
+
<script src="js/components/avatar3d.js"></script>
|
| 134 |
+
<script src="js/components/onboarding.js"></script>
|
| 135 |
+
<script src="js/components/notifications.js"></script>
|
| 136 |
+
<script src="js/pages/login.js"></script>
|
| 137 |
+
<script src="js/pages/signup.js"></script>
|
| 138 |
+
<script src="js/pages/dashboard.js"></script>
|
| 139 |
+
<script src="js/pages/agents.js"></script>
|
| 140 |
+
<script src="js/pages/agent-wizard.js"></script>
|
| 141 |
+
<script src="js/pages/agent-detail.js"></script>
|
| 142 |
+
<script src="js/pages/chat.js"></script>
|
| 143 |
+
<script src="js/pages/video-call.js"></script>
|
| 144 |
+
<script src="js/pages/conversations.js"></script>
|
| 145 |
+
<script src="js/pages/reports.js"></script>
|
| 146 |
+
<script src="js/pages/share-access.js"></script>
|
| 147 |
+
<script src="js/pages/anchoring.js"></script>
|
| 148 |
+
<script src="js/pages/anchoring-remote.js"></script>
|
| 149 |
+
<script src="js/pages/templates.js"></script>
|
| 150 |
+
<script>
|
| 151 |
+
// Initialize app
|
| 152 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 153 |
+
App.init();
|
| 154 |
+
});
|
| 155 |
+
</script>
|
| 156 |
+
</body>
|
| 157 |
+
|
| 158 |
+
</html>
|
frontend/js/api.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - API Client
|
| 3 |
+
* Handles all HTTP requests to the backend
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
const API = {
|
| 7 |
+
// Use relative URL since frontend is served from Flask
|
| 8 |
+
baseUrl: '/api',
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* Make HTTP request
|
| 12 |
+
*/
|
| 13 |
+
async request(method, endpoint, data = null) {
|
| 14 |
+
const url = `${this.baseUrl}${endpoint}`;
|
| 15 |
+
|
| 16 |
+
const options = {
|
| 17 |
+
method,
|
| 18 |
+
headers: {
|
| 19 |
+
'Content-Type': 'application/json'
|
| 20 |
+
},
|
| 21 |
+
credentials: 'include'
|
| 22 |
+
};
|
| 23 |
+
|
| 24 |
+
if (data && (method === 'POST' || method === 'PUT' || method === 'PATCH')) {
|
| 25 |
+
options.body = JSON.stringify(data);
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
try {
|
| 29 |
+
const response = await fetch(url, options);
|
| 30 |
+
const result = await response.json();
|
| 31 |
+
|
| 32 |
+
if (!response.ok) {
|
| 33 |
+
throw new Error(result.error || 'Request failed');
|
| 34 |
+
}
|
| 35 |
+
|
| 36 |
+
return result;
|
| 37 |
+
} catch (error) {
|
| 38 |
+
console.error(`API ${method} ${endpoint}:`, error);
|
| 39 |
+
throw error;
|
| 40 |
+
}
|
| 41 |
+
},
|
| 42 |
+
|
| 43 |
+
/**
|
| 44 |
+
* GET request
|
| 45 |
+
*/
|
| 46 |
+
get(endpoint) {
|
| 47 |
+
return this.request('GET', endpoint);
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* POST request
|
| 52 |
+
*/
|
| 53 |
+
post(endpoint, data) {
|
| 54 |
+
return this.request('POST', endpoint, data);
|
| 55 |
+
},
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* PUT request
|
| 59 |
+
*/
|
| 60 |
+
put(endpoint, data) {
|
| 61 |
+
return this.request('PUT', endpoint, data);
|
| 62 |
+
},
|
| 63 |
+
|
| 64 |
+
/**
|
| 65 |
+
* DELETE request
|
| 66 |
+
*/
|
| 67 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Main Application
|
| 3 |
+
* Core initialization and state management
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
const App = {
|
| 7 |
+
state: {
|
| 8 |
+
user: null,
|
| 9 |
+
currentPage: null,
|
| 10 |
+
isAuthenticated: false
|
| 11 |
+
},
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Initialize the application
|
| 15 |
+
*/
|
| 16 |
+
init() {
|
| 17 |
+
this.checkAuth();
|
| 18 |
+
this.setupEventListeners();
|
| 19 |
+
Router.init();
|
| 20 |
+
},
|
| 21 |
+
|
| 22 |
+
/**
|
| 23 |
+
* Check if user is authenticated
|
| 24 |
+
*/
|
| 25 |
+
async checkAuth() {
|
| 26 |
+
try {
|
| 27 |
+
const response = await API.get('/auth/me');
|
| 28 |
+
if (response.user) {
|
| 29 |
+
this.state.user = response.user;
|
| 30 |
+
this.state.isAuthenticated = true;
|
| 31 |
+
Sidebar.updateUser(response.user);
|
| 32 |
+
// Initialize notification bell for already-logged-in users
|
| 33 |
+
setTimeout(() => Notifications.init(), 500);
|
| 34 |
+
}
|
| 35 |
+
} catch (error) {
|
| 36 |
+
this.state.isAuthenticated = false;
|
| 37 |
+
this.state.user = null;
|
| 38 |
+
}
|
| 39 |
+
},
|
| 40 |
+
|
| 41 |
+
/**
|
| 42 |
+
* Set up global event listeners
|
| 43 |
+
*/
|
| 44 |
+
setupEventListeners() {
|
| 45 |
+
// Logout button
|
| 46 |
+
document.getElementById('logout-btn')?.addEventListener('click', () => {
|
| 47 |
+
this.logout();
|
| 48 |
+
});
|
| 49 |
+
|
| 50 |
+
// Modal backdrop click
|
| 51 |
+
document.querySelector('.modal-backdrop')?.addEventListener('click', () => {
|
| 52 |
+
Modal.close();
|
| 53 |
+
});
|
| 54 |
+
|
| 55 |
+
// Modal close button
|
| 56 |
+
document.getElementById('modal-close')?.addEventListener('click', () => {
|
| 57 |
+
Modal.close();
|
| 58 |
+
});
|
| 59 |
+
},
|
| 60 |
+
|
| 61 |
+
/**
|
| 62 |
+
* Login user
|
| 63 |
+
*/
|
| 64 |
+
login(user) {
|
| 65 |
+
this.state.user = user;
|
| 66 |
+
this.state.isAuthenticated = true;
|
| 67 |
+
Sidebar.show();
|
| 68 |
+
Sidebar.updateUser(user);
|
| 69 |
+
// Start notification polling and show onboarding for new users
|
| 70 |
+
setTimeout(() => {
|
| 71 |
+
Notifications.init();
|
| 72 |
+
Onboarding.show();
|
| 73 |
+
}, 600);
|
| 74 |
+
const redirect = sessionStorage.getItem('redirectAfterLogin');
|
| 75 |
+
sessionStorage.removeItem('redirectAfterLogin');
|
| 76 |
+
Router.navigate(redirect || '/dashboard');
|
| 77 |
+
},
|
| 78 |
+
|
| 79 |
+
/**
|
| 80 |
+
* Logout user
|
| 81 |
+
*/
|
| 82 |
+
async logout() {
|
| 83 |
+
try {
|
| 84 |
+
await API.post('/auth/logout');
|
| 85 |
+
} catch (error) {
|
| 86 |
+
console.error('Logout error:', error);
|
| 87 |
+
}
|
| 88 |
+
|
| 89 |
+
this.state.user = null;
|
| 90 |
+
this.state.isAuthenticated = false;
|
| 91 |
+
Notifications.stop();
|
| 92 |
+
Sidebar.hide();
|
| 93 |
+
Router.navigate('/login');
|
| 94 |
+
},
|
| 95 |
+
|
| 96 |
+
/**
|
| 97 |
+
* Show loading overlay
|
| 98 |
+
*/
|
| 99 |
+
showLoading() {
|
| 100 |
+
const overlay = document.createElement('div');
|
| 101 |
+
overlay.className = 'loading-overlay';
|
| 102 |
+
overlay.id = 'loading-overlay';
|
| 103 |
+
overlay.innerHTML = '<div class="spinner"></div>';
|
| 104 |
+
document.body.appendChild(overlay);
|
| 105 |
+
},
|
| 106 |
+
|
| 107 |
+
/**
|
| 108 |
+
* Hide loading overlay
|
| 109 |
+
*/
|
| 110 |
+
hideLoading() {
|
| 111 |
+
document.getElementById('loading-overlay')?.remove();
|
| 112 |
+
},
|
| 113 |
+
|
| 114 |
+
/**
|
| 115 |
+
* Get initials from name
|
| 116 |
+
*/
|
| 117 |
+
getInitials(name) {
|
| 118 |
+
if (!name) return 'U';
|
| 119 |
+
return name
|
| 120 |
+
.split(' ')
|
| 121 |
+
.map(word => word[0])
|
| 122 |
+
.join('')
|
| 123 |
+
.toUpperCase()
|
| 124 |
+
.slice(0, 2);
|
| 125 |
+
},
|
| 126 |
+
|
| 127 |
+
/**
|
| 128 |
+
* Format date
|
| 129 |
+
*/
|
| 130 |
+
formatDate(dateString) {
|
| 131 |
+
const date = new Date(dateString);
|
| 132 |
+
return date.toLocaleDateString('en-US', {
|
| 133 |
+
month: 'short',
|
| 134 |
+
day: 'numeric',
|
| 135 |
+
year: 'numeric'
|
| 136 |
+
});
|
| 137 |
+
},
|
| 138 |
+
|
| 139 |
+
/**
|
| 140 |
+
* Format time
|
| 141 |
+
*/
|
| 142 |
+
formatTime(dateString) {
|
| 143 |
+
const date = new Date(dateString);
|
| 144 |
+
return date.toLocaleTimeString('en-US', {
|
| 145 |
+
hour: 'numeric',
|
| 146 |
+
minute: '2-digit',
|
| 147 |
+
hour12: true
|
| 148 |
+
});
|
| 149 |
+
},
|
| 150 |
+
|
| 151 |
+
/**
|
| 152 |
+
* Format relative time
|
| 153 |
+
*/
|
| 154 |
+
formatRelativeTime(dateString) {
|
| 155 |
+
const date = new Date(dateString);
|
| 156 |
+
const now = new Date();
|
| 157 |
+
const diffMs = now - date;
|
| 158 |
+
const diffMins = Math.floor(diffMs / 60000);
|
| 159 |
+
const diffHours = Math.floor(diffMs / 3600000);
|
| 160 |
+
const diffDays = Math.floor(diffMs / 86400000);
|
| 161 |
+
|
| 162 |
+
if (diffMins < 1) return 'Just now';
|
| 163 |
+
if (diffMins < 60) return `${diffMins}m ago`;
|
| 164 |
+
if (diffHours < 24) return `${diffHours}h ago`;
|
| 165 |
+
if (diffDays === 1) return 'Yesterday';
|
| 166 |
+
if (diffDays < 7) return `${diffDays} days ago`;
|
| 167 |
+
|
| 168 |
+
return this.formatDate(dateString);
|
| 169 |
+
}
|
| 170 |
+
};
|
frontend/js/components/avatar3d.js
ADDED
|
@@ -0,0 +1,1228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - 3D Avatar Renderer (Vanilla Three.js)
|
| 3 |
+
* Renders a realistic 3D talking avatar in the video call AI panel
|
| 4 |
+
* Ported from React Three Fiber to vanilla Three.js
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
const Avatar3D = {
|
| 8 |
+
scene: null,
|
| 9 |
+
camera: null,
|
| 10 |
+
renderer: null,
|
| 11 |
+
mixer: null,
|
| 12 |
+
clock: null,
|
| 13 |
+
container: null,
|
| 14 |
+
animationFrameId: null,
|
| 15 |
+
morphTargetDictionaryBody: null,
|
| 16 |
+
morphTargetDictionaryLowerTeeth: null,
|
| 17 |
+
gltfScene: null,
|
| 18 |
+
blinkData: null,
|
| 19 |
+
isInitialized: false,
|
| 20 |
+
isSpeaking: false,
|
| 21 |
+
currentAudio: null,
|
| 22 |
+
lipSyncClips: [],
|
| 23 |
+
onSpeakEnd: null,
|
| 24 |
+
|
| 25 |
+
// ─── Real-time viseme lip sync state ───
|
| 26 |
+
visemeTimeline: null, // Timeline from LipSyncEngine
|
| 27 |
+
bodyMesh: null, // Reference to primary mesh for morph target access
|
| 28 |
+
teethMesh: null, // Reference to teeth mesh
|
| 29 |
+
currentVisemeTargets: {}, // Current target values for each viseme morph
|
| 30 |
+
appliedVisemeValues: {}, // Currently applied (smoothed) values
|
| 31 |
+
moodTargets: {}, // Facial expression targets based on mood
|
| 32 |
+
appliedMoodValues: {}, // Currently applied mood values
|
| 33 |
+
microExpressionTimer: 0, // Timer for random micro-expressions
|
| 34 |
+
currentMood: 'neutral', // Current mood state
|
| 35 |
+
|
| 36 |
+
// ─── TalkingHead-style animation layers ───
|
| 37 |
+
headBone: null, // Head bone for rotation
|
| 38 |
+
neckBone: null, // Neck bone for rotation
|
| 39 |
+
spineBone: null, // Spine2 bone for torso sway
|
| 40 |
+
|
| 41 |
+
// Breathing
|
| 42 |
+
breathTimer: 0,
|
| 43 |
+
breathCycleDuration: 3.5, // seconds per breath cycle
|
| 44 |
+
|
| 45 |
+
// Eye blink (procedural)
|
| 46 |
+
blinkTimer: 0,
|
| 47 |
+
blinkNextAt: 3, // seconds until next blink
|
| 48 |
+
blinkPhase: 'idle', // 'idle' | 'closing' | 'closed' | 'opening'
|
| 49 |
+
blinkPhaseTimer: 0,
|
| 50 |
+
isDoubleBlink: false,
|
| 51 |
+
blinkCount: 0,
|
| 52 |
+
|
| 53 |
+
// Eye gaze
|
| 54 |
+
gazeTimer: 0,
|
| 55 |
+
gazeNextAt: 3,
|
| 56 |
+
gazeTargetX: 0, // Target eye look horizontal
|
| 57 |
+
gazeTargetY: 0, // Target eye look vertical
|
| 58 |
+
gazeCurrentX: 0,
|
| 59 |
+
gazeCurrentY: 0,
|
| 60 |
+
|
| 61 |
+
// Head/body sway
|
| 62 |
+
headSwayTime: 0, // Accumulator for sine-based head sway
|
| 63 |
+
headSwayTargetX: 0,
|
| 64 |
+
headSwayTargetY: 0,
|
| 65 |
+
headSwayTargetZ: 0,
|
| 66 |
+
headSwayCurrentX: 0,
|
| 67 |
+
headSwayCurrentY: 0,
|
| 68 |
+
headSwayCurrentZ: 0,
|
| 69 |
+
|
| 70 |
+
// Gesture state
|
| 71 |
+
activeGesture: null, // 'nod' | 'shake' | null
|
| 72 |
+
gestureTimer: 0,
|
| 73 |
+
gesturePhase: 0,
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Initialize the 3D avatar in the given container
|
| 77 |
+
*/
|
| 78 |
+
async init(containerId) {
|
| 79 |
+
this.container = document.getElementById(containerId);
|
| 80 |
+
if (!this.container) {
|
| 81 |
+
console.error('Avatar3D: Container not found:', containerId);
|
| 82 |
+
return false;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
try {
|
| 86 |
+
this.clock = new THREE.Clock();
|
| 87 |
+
this.scene = new THREE.Scene();
|
| 88 |
+
|
| 89 |
+
// Orthographic camera — zoomed in on face/upper body
|
| 90 |
+
const aspect = this.container.clientWidth / this.container.clientHeight;
|
| 91 |
+
const zoom = 1600;
|
| 92 |
+
this.camera = new THREE.OrthographicCamera(
|
| 93 |
+
-aspect / 2 * (1 / zoom * 1000),
|
| 94 |
+
aspect / 2 * (1 / zoom * 1000),
|
| 95 |
+
1 / zoom * 500,
|
| 96 |
+
-1 / zoom * 500,
|
| 97 |
+
0.01,
|
| 98 |
+
100
|
| 99 |
+
);
|
| 100 |
+
// Position camera at eye level, slightly in front, looking straight at the face
|
| 101 |
+
this.camera.position.set(0, 1.62, 1);
|
| 102 |
+
this.camera.lookAt(0, 1.62, 0);
|
| 103 |
+
|
| 104 |
+
// Renderer
|
| 105 |
+
this.renderer = new THREE.WebGLRenderer({
|
| 106 |
+
antialias: true,
|
| 107 |
+
alpha: true,
|
| 108 |
+
powerPreference: 'high-performance'
|
| 109 |
+
});
|
| 110 |
+
this.renderer.setSize(this.container.clientWidth, this.container.clientHeight);
|
| 111 |
+
this.renderer.setPixelRatio(Math.min(window.devicePixelRatio, 2));
|
| 112 |
+
this.renderer.outputEncoding = THREE.sRGBEncoding;
|
| 113 |
+
this.renderer.physicallyCorrectLights = true;
|
| 114 |
+
this.renderer.toneMapping = THREE.ACESFilmicToneMapping;
|
| 115 |
+
this.renderer.toneMappingExposure = 1.0;
|
| 116 |
+
this.container.appendChild(this.renderer.domElement);
|
| 117 |
+
|
| 118 |
+
// Lights
|
| 119 |
+
const ambientLight = new THREE.AmbientLight(0xffffff, 0.5);
|
| 120 |
+
this.scene.add(ambientLight);
|
| 121 |
+
|
| 122 |
+
const dirLight = new THREE.DirectionalLight(0xffffff, 0.8);
|
| 123 |
+
dirLight.position.set(1, 2, 3);
|
| 124 |
+
this.scene.add(dirLight);
|
| 125 |
+
|
| 126 |
+
const fillLight = new THREE.DirectionalLight(0x8888ff, 0.3);
|
| 127 |
+
fillLight.position.set(-1, 1, -1);
|
| 128 |
+
this.scene.add(fillLight);
|
| 129 |
+
|
| 130 |
+
// Load HDR environment map
|
| 131 |
+
await this.loadEnvironment();
|
| 132 |
+
|
| 133 |
+
// Load blink data
|
| 134 |
+
await this.loadBlinkData();
|
| 135 |
+
|
| 136 |
+
// Load background
|
| 137 |
+
await this.loadBackground();
|
| 138 |
+
|
| 139 |
+
// Load 3D model
|
| 140 |
+
await this.loadModel();
|
| 141 |
+
|
| 142 |
+
// Load idle animation
|
| 143 |
+
await this.loadIdleAnimation();
|
| 144 |
+
|
| 145 |
+
// Start blink animation (disabled — now using procedural blink in animate())
|
| 146 |
+
// this.startBlinkAnimation();
|
| 147 |
+
|
| 148 |
+
// Handle resize
|
| 149 |
+
this.resizeHandler = () => this.onResize();
|
| 150 |
+
window.addEventListener('resize', this.resizeHandler);
|
| 151 |
+
|
| 152 |
+
// Start render loop
|
| 153 |
+
this.isInitialized = true;
|
| 154 |
+
this.animate();
|
| 155 |
+
|
| 156 |
+
console.log('Avatar3D: Initialized successfully');
|
| 157 |
+
return true;
|
| 158 |
+
} catch (error) {
|
| 159 |
+
console.error('Avatar3D: Initialization failed:', error);
|
| 160 |
+
return false;
|
| 161 |
+
}
|
| 162 |
+
},
|
| 163 |
+
|
| 164 |
+
/**
|
| 165 |
+
* Load HDR environment map
|
| 166 |
+
*/
|
| 167 |
+
loadEnvironment() {
|
| 168 |
+
return new Promise((resolve) => {
|
| 169 |
+
try {
|
| 170 |
+
const rgbeLoader = new THREE.RGBELoader();
|
| 171 |
+
rgbeLoader.load('/3d-assets/images/photo_studio_loft_hall_1k.hdr', (texture) => {
|
| 172 |
+
texture.mapping = THREE.EquirectangularReflectionMapping;
|
| 173 |
+
this.scene.environment = texture;
|
| 174 |
+
resolve();
|
| 175 |
+
}, undefined, () => {
|
| 176 |
+
console.warn('Avatar3D: HDR environment load failed, using fallback');
|
| 177 |
+
resolve();
|
| 178 |
+
});
|
| 179 |
+
} catch (e) {
|
| 180 |
+
console.warn('Avatar3D: RGBELoader not available, skipping HDR');
|
| 181 |
+
resolve();
|
| 182 |
+
}
|
| 183 |
+
});
|
| 184 |
+
},
|
| 185 |
+
|
| 186 |
+
/**
|
| 187 |
+
* Load blink animation data
|
| 188 |
+
*/
|
| 189 |
+
async loadBlinkData() {
|
| 190 |
+
try {
|
| 191 |
+
const response = await fetch('/3d-assets/blendDataBlink.json');
|
| 192 |
+
this.blinkData = await response.json();
|
| 193 |
+
} catch (e) {
|
| 194 |
+
console.warn('Avatar3D: Blink data load failed');
|
| 195 |
+
this.blinkData = null;
|
| 196 |
+
}
|
| 197 |
+
},
|
| 198 |
+
|
| 199 |
+
/**
|
| 200 |
+
* Load background image
|
| 201 |
+
*/
|
| 202 |
+
loadBackground() {
|
| 203 |
+
return new Promise((resolve) => {
|
| 204 |
+
const textureLoader = new THREE.TextureLoader();
|
| 205 |
+
textureLoader.load('/3d-assets/images/background.jpg', (texture) => {
|
| 206 |
+
texture.encoding = THREE.sRGBEncoding;
|
| 207 |
+
// Calculate plane size to fill the entire camera view at z=-4
|
| 208 |
+
const zoom = 1400;
|
| 209 |
+
const aspect = this.container.clientWidth / this.container.clientHeight;
|
| 210 |
+
const viewWidth = aspect * (1000 / zoom);
|
| 211 |
+
const viewHeight = 2 * (500 / zoom);
|
| 212 |
+
// Add generous padding to ensure full coverage
|
| 213 |
+
const scale = 1.15;
|
| 214 |
+
const bgGeometry = new THREE.PlaneGeometry(viewWidth * scale, viewHeight * scale);
|
| 215 |
+
const bgMaterial = new THREE.MeshBasicMaterial({ map: texture });
|
| 216 |
+
this.bgMesh = new THREE.Mesh(bgGeometry, bgMaterial);
|
| 217 |
+
this.bgMesh.position.set(0, 1.62, -4);
|
| 218 |
+
this.scene.add(this.bgMesh);
|
| 219 |
+
resolve();
|
| 220 |
+
}, undefined, () => {
|
| 221 |
+
console.warn('Avatar3D: Background load failed');
|
| 222 |
+
resolve();
|
| 223 |
+
});
|
| 224 |
+
});
|
| 225 |
+
},
|
| 226 |
+
|
| 227 |
+
/**
|
| 228 |
+
* Load the Ready Player Me GLB 3D model (self-contained with embedded textures)
|
| 229 |
+
*/
|
| 230 |
+
loadModel() {
|
| 231 |
+
return new Promise((resolve, reject) => {
|
| 232 |
+
// Show loading state
|
| 233 |
+
if (this.container) {
|
| 234 |
+
const loadingDiv = document.createElement('div');
|
| 235 |
+
loadingDiv.id = 'avatar-loading';
|
| 236 |
+
loadingDiv.style.cssText = 'position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:rgba(255,255,255,0.7);font-size:0.875rem;z-index:10;';
|
| 237 |
+
loadingDiv.innerHTML = '<div style="text-align:center"><div class="avatar-spinner"></div><div style="margin-top:12px">Loading 3D Avatar...</div></div>';
|
| 238 |
+
this.container.appendChild(loadingDiv);
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
// RPM models are self-contained GLBs — no separate textures needed
|
| 242 |
+
const gltfLoader = new THREE.GLTFLoader();
|
| 243 |
+
gltfLoader.load('/3d-assets/rpm-model.glb', (gltf) => {
|
| 244 |
+
this.gltfScene = gltf.scene;
|
| 245 |
+
this.mixer = new THREE.AnimationMixer(gltf.scene);
|
| 246 |
+
|
| 247 |
+
// Collect all meshes that have morph targets (RPM spreads them across Wolf3D_Head, Wolf3D_Teeth, etc.)
|
| 248 |
+
this.morphMeshes = [];
|
| 249 |
+
this.morphTargetDictionaryBody = null; // Primary morph dict (from head mesh)
|
| 250 |
+
this.bodyMesh = null;
|
| 251 |
+
this.teethMesh = null;
|
| 252 |
+
|
| 253 |
+
gltf.scene.traverse((node) => {
|
| 254 |
+
if (node.type === 'Mesh' || node.type === 'SkinnedMesh') {
|
| 255 |
+
node.castShadow = true;
|
| 256 |
+
node.receiveShadow = true;
|
| 257 |
+
node.frustumCulled = false;
|
| 258 |
+
|
| 259 |
+
// Enhance embedded materials for better rendering
|
| 260 |
+
if (node.material) {
|
| 261 |
+
node.material.envMapIntensity = 0.6;
|
| 262 |
+
|
| 263 |
+
// Enhance skin appearance on head/body meshes
|
| 264 |
+
if (node.name.includes('Head') || node.name.includes('Body')) {
|
| 265 |
+
node.material.roughness = Math.min(node.material.roughness || 1.0, 0.8);
|
| 266 |
+
}
|
| 267 |
+
// Make eyes more reflective
|
| 268 |
+
if (node.name.includes('Eye')) {
|
| 269 |
+
node.material.roughness = 0.1;
|
| 270 |
+
node.material.envMapIntensity = 0.8;
|
| 271 |
+
}
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
// Collect meshes with morph targets
|
| 275 |
+
if (node.morphTargetInfluences && node.morphTargetInfluences.length > 0 && node.morphTargetDictionary) {
|
| 276 |
+
this.morphMeshes.push(node);
|
| 277 |
+
console.log('Avatar3D: Morphable mesh found:', node.name, '— morph targets:', Object.keys(node.morphTargetDictionary).length);
|
| 278 |
+
|
| 279 |
+
// Use the mesh with the most morph targets as the primary (usually Head)
|
| 280 |
+
if (!this.morphTargetDictionaryBody || Object.keys(node.morphTargetDictionary).length > Object.keys(this.morphTargetDictionaryBody).length) {
|
| 281 |
+
this.morphTargetDictionaryBody = node.morphTargetDictionary;
|
| 282 |
+
this.bodyMesh = node;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
// Track teeth mesh specifically
|
| 286 |
+
if (node.name.includes('Teeth')) {
|
| 287 |
+
this.morphTargetDictionaryLowerTeeth = node.morphTargetDictionary;
|
| 288 |
+
this.teethMesh = node;
|
| 289 |
+
}
|
| 290 |
+
}
|
| 291 |
+
}
|
| 292 |
+
|
| 293 |
+
// Store key bones for animation
|
| 294 |
+
if (node.isBone) {
|
| 295 |
+
if (node.name.includes('Head') && !this.headBone) this.headBone = node;
|
| 296 |
+
else if (node.name.includes('Neck') && !this.neckBone) this.neckBone = node;
|
| 297 |
+
else if ((node.name.includes('Spine2') || node.name.includes('Spine1')) && !this.spineBone) this.spineBone = node;
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
+
// Handle LineSegments (eyebrows etc.) — hide them for cleaner look
|
| 301 |
+
if (node.type === 'LineSegments') {
|
| 302 |
+
node.visible = false;
|
| 303 |
+
}
|
| 304 |
+
});
|
| 305 |
+
|
| 306 |
+
if (this.morphMeshes.length > 0) {
|
| 307 |
+
const visemeKeys = Object.keys(this.morphTargetDictionaryBody || {}).filter(k => k.startsWith('viseme'));
|
| 308 |
+
console.log('Avatar3D: RPM model loaded —', this.morphMeshes.length, 'morphable meshes, visemes:', visemeKeys);
|
| 309 |
+
} else {
|
| 310 |
+
console.warn('Avatar3D: No morphable meshes found in RPM model!');
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
// Log discovered bones
|
| 314 |
+
console.log('Avatar3D: Bones found — Head:', this.headBone?.name, 'Neck:', this.neckBone?.name, 'Spine:', this.spineBone?.name);
|
| 315 |
+
|
| 316 |
+
// Store initial bone rotations for resetting
|
| 317 |
+
if (this.headBone) this._headBoneInitQuat = this.headBone.quaternion.clone();
|
| 318 |
+
if (this.neckBone) this._neckBoneInitQuat = this.neckBone.quaternion.clone();
|
| 319 |
+
if (this.spineBone) this._spineBoneInitQuat = this.spineBone.quaternion.clone();
|
| 320 |
+
|
| 321 |
+
this.scene.add(gltf.scene);
|
| 322 |
+
|
| 323 |
+
// Remove loading indicator
|
| 324 |
+
const loadingEl = document.getElementById('avatar-loading');
|
| 325 |
+
if (loadingEl) loadingEl.remove();
|
| 326 |
+
|
| 327 |
+
resolve();
|
| 328 |
+
}, (progress) => {
|
| 329 |
+
// Update loading progress
|
| 330 |
+
if (progress.total > 0) {
|
| 331 |
+
const pct = Math.round(progress.loaded / progress.total * 100);
|
| 332 |
+
const loadingEl = document.getElementById('avatar-loading');
|
| 333 |
+
if (loadingEl) {
|
| 334 |
+
loadingEl.querySelector('div > div:last-child').textContent = `Loading 3D Avatar... ${pct}%`;
|
| 335 |
+
}
|
| 336 |
+
}
|
| 337 |
+
}, (error) => {
|
| 338 |
+
console.error('Avatar3D: Model load error:', error);
|
| 339 |
+
const loadingEl = document.getElementById('avatar-loading');
|
| 340 |
+
if (loadingEl) loadingEl.querySelector('div > div:last-child').textContent = 'Failed to load 3D model';
|
| 341 |
+
reject(error);
|
| 342 |
+
});
|
| 343 |
+
});
|
| 344 |
+
},
|
| 345 |
+
|
| 346 |
+
/**
|
| 347 |
+
* Load idle animation from FBX
|
| 348 |
+
*/
|
| 349 |
+
loadIdleAnimation() {
|
| 350 |
+
return new Promise((resolve) => {
|
| 351 |
+
if (!this.mixer) { resolve(); return; }
|
| 352 |
+
|
| 353 |
+
try {
|
| 354 |
+
const fbxLoader = new THREE.FBXLoader();
|
| 355 |
+
fbxLoader.load('/3d-assets/idle.fbx', (fbx) => {
|
| 356 |
+
if (fbx.animations && fbx.animations.length > 0) {
|
| 357 |
+
const clip = fbx.animations[0];
|
| 358 |
+
|
| 359 |
+
// Filter to only head/neck/spine tracks
|
| 360 |
+
clip.tracks = clip.tracks.filter(track =>
|
| 361 |
+
track.name.includes('Head') ||
|
| 362 |
+
track.name.includes('Neck') ||
|
| 363 |
+
track.name.includes('Spine2') ||
|
| 364 |
+
track.name.includes('Spine1')
|
| 365 |
+
);
|
| 366 |
+
|
| 367 |
+
// RPM models use Armature bone names (sometimes with mixamorig prefix)
|
| 368 |
+
// Try to find the actual bone names in the scene
|
| 369 |
+
const findBone = (nameContains) => {
|
| 370 |
+
let found = null;
|
| 371 |
+
if (this.gltfScene) {
|
| 372 |
+
this.gltfScene.traverse(n => {
|
| 373 |
+
if (n.isBone && n.name.includes(nameContains) && !found) {
|
| 374 |
+
found = n.name;
|
| 375 |
+
}
|
| 376 |
+
});
|
| 377 |
+
}
|
| 378 |
+
return found;
|
| 379 |
+
};
|
| 380 |
+
|
| 381 |
+
const headBone = findBone('Head') || 'Head';
|
| 382 |
+
const neckBone = findBone('Neck') || 'Neck';
|
| 383 |
+
const spineBone = findBone('Spine2') || findBone('Spine1') || 'Spine2';
|
| 384 |
+
|
| 385 |
+
clip.tracks = clip.tracks.map(track => {
|
| 386 |
+
if (track.name.includes('Head')) track.name = headBone + '.quaternion';
|
| 387 |
+
else if (track.name.includes('Neck')) track.name = neckBone + '.quaternion';
|
| 388 |
+
else if (track.name.includes('Spine')) track.name = spineBone + '.quaternion';
|
| 389 |
+
return track;
|
| 390 |
+
});
|
| 391 |
+
|
| 392 |
+
const action = this.mixer.clipAction(clip);
|
| 393 |
+
action.play();
|
| 394 |
+
}
|
| 395 |
+
resolve();
|
| 396 |
+
}, undefined, () => {
|
| 397 |
+
console.warn('Avatar3D: Idle animation load failed');
|
| 398 |
+
resolve();
|
| 399 |
+
});
|
| 400 |
+
} catch (e) {
|
| 401 |
+
console.warn('Avatar3D: FBXLoader not available');
|
| 402 |
+
resolve();
|
| 403 |
+
}
|
| 404 |
+
});
|
| 405 |
+
},
|
| 406 |
+
|
| 407 |
+
/**
|
| 408 |
+
* Start blink animation — works across all morphable meshes
|
| 409 |
+
*/
|
| 410 |
+
startBlinkAnimation() {
|
| 411 |
+
if (!this.blinkData || !this.mixer || !this.morphMeshes || this.morphMeshes.length === 0) return;
|
| 412 |
+
|
| 413 |
+
// Apply blink on each morphable mesh that has eyeBlink targets
|
| 414 |
+
this.morphMeshes.forEach(mesh => {
|
| 415 |
+
if (!mesh.morphTargetDictionary) return;
|
| 416 |
+
const blinkClip = ThreeConverter.createAnimation(
|
| 417 |
+
this.blinkData,
|
| 418 |
+
mesh.morphTargetDictionary,
|
| 419 |
+
mesh.name
|
| 420 |
+
);
|
| 421 |
+
if (blinkClip) {
|
| 422 |
+
const action = this.mixer.clipAction(blinkClip);
|
| 423 |
+
action.play();
|
| 424 |
+
}
|
| 425 |
+
});
|
| 426 |
+
},
|
| 427 |
+
|
| 428 |
+
// ─── Mood presets for facial expressions ───
|
| 429 |
+
moodPresets: {
|
| 430 |
+
neutral: {},
|
| 431 |
+
happy: {
|
| 432 |
+
browInnerUp: 0.12, cheekSquintLeft: 0.15, cheekSquintRight: 0.15,
|
| 433 |
+
eyeSquintLeft: 0.10, eyeSquintRight: 0.10,
|
| 434 |
+
mouthSmileLeft: 0.12, mouthSmileRight: 0.12,
|
| 435 |
+
mouthDimpleLeft: 0.05, mouthDimpleRight: 0.05
|
| 436 |
+
},
|
| 437 |
+
question: {
|
| 438 |
+
browInnerUp: 0.25, browOuterUpLeft: 0.18, browOuterUpRight: 0.18,
|
| 439 |
+
eyeWideLeft: 0.10, eyeWideRight: 0.10,
|
| 440 |
+
mouthPucker: 0.03
|
| 441 |
+
},
|
| 442 |
+
emphasis: {
|
| 443 |
+
browInnerUp: 0.20, browOuterUpLeft: 0.14, browOuterUpRight: 0.14,
|
| 444 |
+
eyeWideLeft: 0.08, eyeWideRight: 0.08,
|
| 445 |
+
jawForward: 0.03
|
| 446 |
+
},
|
| 447 |
+
warm: {
|
| 448 |
+
eyeSquintLeft: 0.12, eyeSquintRight: 0.12,
|
| 449 |
+
cheekSquintLeft: 0.10, cheekSquintRight: 0.10,
|
| 450 |
+
mouthSmileLeft: 0.06, mouthSmileRight: 0.06,
|
| 451 |
+
noseSneerLeft: 0.03, noseSneerRight: 0.03
|
| 452 |
+
},
|
| 453 |
+
surprise: {
|
| 454 |
+
browInnerUp: 0.25, browOuterUpLeft: 0.22, browOuterUpRight: 0.22,
|
| 455 |
+
eyeWideLeft: 0.18, eyeWideRight: 0.18, jawOpen: 0.08,
|
| 456 |
+
mouthFunnel: 0.04
|
| 457 |
+
},
|
| 458 |
+
concerned: {
|
| 459 |
+
browInnerUp: 0.18, browDownLeft: 0.10, browDownRight: 0.10,
|
| 460 |
+
mouthFrownLeft: 0.08, mouthFrownRight: 0.08,
|
| 461 |
+
mouthPressLeft: 0.05, mouthPressRight: 0.05
|
| 462 |
+
},
|
| 463 |
+
thinking: {
|
| 464 |
+
browInnerUp: 0.12, browDownLeft: 0.06,
|
| 465 |
+
eyeSquintLeft: 0.10, eyeLookUpLeft: 0.08, eyeLookUpRight: 0.08,
|
| 466 |
+
mouthPucker: 0.06, mouthLeft: 0.04
|
| 467 |
+
},
|
| 468 |
+
confident: {
|
| 469 |
+
browDownLeft: 0.05, browDownRight: 0.05,
|
| 470 |
+
cheekSquintLeft: 0.06, cheekSquintRight: 0.06,
|
| 471 |
+
mouthSmileLeft: 0.10, mouthSmileRight: 0.10,
|
| 472 |
+
jawForward: 0.04, noseSneerLeft: 0.02, noseSneerRight: 0.02
|
| 473 |
+
}
|
| 474 |
+
},
|
| 475 |
+
|
| 476 |
+
/**
|
| 477 |
+
* Detect mood from text sentence
|
| 478 |
+
*/
|
| 479 |
+
detectMood(sentence) {
|
| 480 |
+
const s = sentence.toLowerCase();
|
| 481 |
+
if (s.includes('?')) return 'question';
|
| 482 |
+
if (s.includes('!')) return 'surprise';
|
| 483 |
+
const happyWords = ['happy', 'great', 'wonderful', 'love', 'amazing', 'good', 'welcome', 'thank',
|
| 484 |
+
'thanks', 'please', 'glad', 'excited', 'awesome', 'fantastic', 'beautiful', 'excellent', 'enjoy',
|
| 485 |
+
'congratulations', 'perfect', 'brilliant', 'fun', 'nice', 'cool', 'sweet'];
|
| 486 |
+
if (happyWords.some(w => s.includes(w))) return 'happy';
|
| 487 |
+
const concernWords = ['sorry', 'unfortunately', 'problem', 'issue', 'difficult', 'hard', 'worry',
|
| 488 |
+
'concern', 'afraid', 'bad', 'wrong', 'fail', 'mistake', 'error', 'trouble'];
|
| 489 |
+
if (concernWords.some(w => s.includes(w))) return 'concerned';
|
| 490 |
+
const thinkWords = ['think', 'consider', 'perhaps', 'maybe', 'probably', 'might', 'could',
|
| 491 |
+
'wonder', 'imagine', 'suppose', 'hmm', 'well', 'let me', 'actually'];
|
| 492 |
+
if (thinkWords.some(w => s.includes(w))) return 'thinking';
|
| 493 |
+
const emphasisWords = ['important', 'key', 'critical', 'must', 'need', 'now', 'first',
|
| 494 |
+
'today', 'special', 'attention', 'remember', 'never', 'always', 'absolutely', 'definitely'];
|
| 495 |
+
if (emphasisWords.some(w => s.includes(w))) return 'emphasis';
|
| 496 |
+
const confidentWords = ['sure', 'certain', 'know', 'clearly', 'exactly', 'right', 'yes',
|
| 497 |
+
'correct', 'true', 'fact', 'indeed', 'obviously', 'of course'];
|
| 498 |
+
if (confidentWords.some(w => s.includes(w))) return 'confident';
|
| 499 |
+
return 'warm';
|
| 500 |
+
},
|
| 501 |
+
|
| 502 |
+
/**
|
| 503 |
+
* Speak with real-time viseme lip-sync animation
|
| 504 |
+
* Uses LipSyncEngine to generate viseme timeline, applies in animate() loop
|
| 505 |
+
*/
|
| 506 |
+
async speak(text, onEnd) {
|
| 507 |
+
if (this.isSpeaking) this.stopSpeaking();
|
| 508 |
+
this.isSpeaking = true;
|
| 509 |
+
this.onSpeakEnd = onEnd;
|
| 510 |
+
|
| 511 |
+
try {
|
| 512 |
+
// Call TTS endpoint (just need audio now, not blendData)
|
| 513 |
+
console.log('Avatar3D: Calling /api/avatar/talk...');
|
| 514 |
+
const response = await fetch('/api/avatar/talk', {
|
| 515 |
+
method: 'POST',
|
| 516 |
+
headers: { 'Content-Type': 'application/json' },
|
| 517 |
+
body: JSON.stringify({ text })
|
| 518 |
+
});
|
| 519 |
+
|
| 520 |
+
if (!response.ok) throw new Error('TTS request failed');
|
| 521 |
+
|
| 522 |
+
const data = await response.json();
|
| 523 |
+
const { audioUrl } = data;
|
| 524 |
+
|
| 525 |
+
if (!this.isSpeaking) return; // User may have interrupted
|
| 526 |
+
|
| 527 |
+
if (audioUrl) {
|
| 528 |
+
this.currentAudio = new Audio(audioUrl);
|
| 529 |
+
|
| 530 |
+
// Wait for audio metadata to get real duration
|
| 531 |
+
await new Promise((resolve) => {
|
| 532 |
+
this.currentAudio.addEventListener('loadedmetadata', resolve, { once: true });
|
| 533 |
+
this.currentAudio.addEventListener('canplaythrough', resolve, { once: true });
|
| 534 |
+
this.currentAudio.load();
|
| 535 |
+
setTimeout(resolve, 3000);
|
| 536 |
+
});
|
| 537 |
+
|
| 538 |
+
if (!this.isSpeaking) return;
|
| 539 |
+
|
| 540 |
+
const audioDuration = this.currentAudio.duration;
|
| 541 |
+
console.log('Avatar3D: Audio duration:', audioDuration, 'seconds');
|
| 542 |
+
|
| 543 |
+
// Generate viseme timeline using LipSyncEngine (frontend-side)
|
| 544 |
+
if (typeof LipSyncEngine !== 'undefined' && this.morphMeshes && this.morphMeshes.length > 0) {
|
| 545 |
+
this.visemeTimeline = LipSyncEngine.textToVisemes(text, audioDuration);
|
| 546 |
+
console.log('Avatar3D: Generated', this.visemeTimeline.length, 'viseme events for', audioDuration.toFixed(2) + 's audio');
|
| 547 |
+
|
| 548 |
+
// Detect mood for facial expressions
|
| 549 |
+
this.currentMood = this.detectMood(text);
|
| 550 |
+
this.moodTargets = { ...(this.moodPresets[this.currentMood] || {}) };
|
| 551 |
+
console.log('Avatar3D: Mood detected:', this.currentMood);
|
| 552 |
+
|
| 553 |
+
// Detect and trigger head gestures (nod/shake)
|
| 554 |
+
this.detectGestures(text);
|
| 555 |
+
} else {
|
| 556 |
+
console.warn('Avatar3D: LipSyncEngine not available or bodyMesh not loaded');
|
| 557 |
+
this.visemeTimeline = null;
|
| 558 |
+
}
|
| 559 |
+
|
| 560 |
+
this.currentAudio.onended = () => this.onAudioEnd();
|
| 561 |
+
this.currentAudio.onerror = () => {
|
| 562 |
+
console.error('Avatar3D: Audio playback error');
|
| 563 |
+
this.onAudioEnd();
|
| 564 |
+
};
|
| 565 |
+
this.currentAudio.play().catch(err => {
|
| 566 |
+
console.error('Avatar3D: Audio play failed:', err);
|
| 567 |
+
this.onAudioEnd();
|
| 568 |
+
});
|
| 569 |
+
}
|
| 570 |
+
|
| 571 |
+
return true;
|
| 572 |
+
} catch (error) {
|
| 573 |
+
console.error('Avatar3D: Speak failed:', error);
|
| 574 |
+
this.isSpeaking = false;
|
| 575 |
+
if (this.onSpeakEnd) this.onSpeakEnd();
|
| 576 |
+
return false;
|
| 577 |
+
}
|
| 578 |
+
},
|
| 579 |
+
|
| 580 |
+
/**
|
| 581 |
+
* Handle audio playback end — reset all viseme morph targets
|
| 582 |
+
*/
|
| 583 |
+
onAudioEnd() {
|
| 584 |
+
this.isSpeaking = false;
|
| 585 |
+
this.visemeTimeline = null;
|
| 586 |
+
this.currentVisemeTargets = {};
|
| 587 |
+
this.moodTargets = {};
|
| 588 |
+
this.microExpressionTimer = 0;
|
| 589 |
+
|
| 590 |
+
// Reset all viseme morph targets to 0
|
| 591 |
+
this.resetVisemeMorphTargets();
|
| 592 |
+
|
| 593 |
+
// Stop any old-style lip-sync clips (backward compat)
|
| 594 |
+
this.lipSyncClips.forEach(action => action.stop());
|
| 595 |
+
this.lipSyncClips = [];
|
| 596 |
+
this.currentAudio = null;
|
| 597 |
+
|
| 598 |
+
if (this.onSpeakEnd) {
|
| 599 |
+
this.onSpeakEnd();
|
| 600 |
+
this.onSpeakEnd = null;
|
| 601 |
+
}
|
| 602 |
+
},
|
| 603 |
+
|
| 604 |
+
/**
|
| 605 |
+
* Reset all viseme and expression morph targets to 0
|
| 606 |
+
*/
|
| 607 |
+
resetVisemeMorphTargets() {
|
| 608 |
+
if (!this.morphMeshes || this.morphMeshes.length === 0) return;
|
| 609 |
+
|
| 610 |
+
const visemeKeys = LipSyncEngine?.visemeNames || [];
|
| 611 |
+
const exprKeys = ['jawOpen', 'mouthSmileLeft', 'mouthSmileRight', 'browInnerUp',
|
| 612 |
+
'browOuterUpLeft', 'browOuterUpRight', 'eyeSquintLeft', 'eyeSquintRight',
|
| 613 |
+
'eyeWideLeft', 'eyeWideRight', 'cheekSquintLeft', 'cheekSquintRight',
|
| 614 |
+
'cheekPuff', 'noseSneerLeft', 'noseSneerRight'];
|
| 615 |
+
|
| 616 |
+
// Reset on ALL morphable meshes
|
| 617 |
+
this.morphMeshes.forEach(mesh => {
|
| 618 |
+
if (!mesh.morphTargetDictionary) return;
|
| 619 |
+
visemeKeys.forEach(v => {
|
| 620 |
+
const key = 'viseme_' + v;
|
| 621 |
+
if (key in mesh.morphTargetDictionary) {
|
| 622 |
+
mesh.morphTargetInfluences[mesh.morphTargetDictionary[key]] = 0;
|
| 623 |
+
}
|
| 624 |
+
});
|
| 625 |
+
exprKeys.forEach(key => {
|
| 626 |
+
if (key in mesh.morphTargetDictionary) {
|
| 627 |
+
mesh.morphTargetInfluences[mesh.morphTargetDictionary[key]] = 0;
|
| 628 |
+
}
|
| 629 |
+
});
|
| 630 |
+
});
|
| 631 |
+
|
| 632 |
+
this.appliedVisemeValues = {};
|
| 633 |
+
this.appliedMoodValues = {};
|
| 634 |
+
},
|
| 635 |
+
|
| 636 |
+
/**
|
| 637 |
+
* Set a morph target value on the body mesh directly
|
| 638 |
+
*/
|
| 639 |
+
setMorphTarget(name, value) {
|
| 640 |
+
if (!this.morphMeshes || this.morphMeshes.length === 0) return;
|
| 641 |
+
const clamped = Math.max(0, Math.min(1, value));
|
| 642 |
+
// Apply to ALL morphable meshes that have this morph target
|
| 643 |
+
this.morphMeshes.forEach(mesh => {
|
| 644 |
+
if (mesh.morphTargetDictionary && name in mesh.morphTargetDictionary) {
|
| 645 |
+
mesh.morphTargetInfluences[mesh.morphTargetDictionary[name]] = clamped;
|
| 646 |
+
}
|
| 647 |
+
});
|
| 648 |
+
},
|
| 649 |
+
|
| 650 |
+
// ═══════════════════════════════════════════════════════════
|
| 651 |
+
// TalkingHead-style Animation Update Methods
|
| 652 |
+
// ═══════════════════════════════════════════════════════════
|
| 653 |
+
|
| 654 |
+
/**
|
| 655 |
+
* Continuous breathing — chest rises and falls using chestInhale morph target
|
| 656 |
+
*/
|
| 657 |
+
updateBreathing(delta) {
|
| 658 |
+
this.breathTimer += delta;
|
| 659 |
+
const cycleDuration = this.isSpeaking ? 2.8 : this.breathCycleDuration;
|
| 660 |
+
const phase = (this.breathTimer % cycleDuration) / cycleDuration;
|
| 661 |
+
// Smooth breathing curve: 0→peak→0 using sin
|
| 662 |
+
const breathValue = Math.sin(phase * Math.PI) * 0.4;
|
| 663 |
+
this.setMorphTarget('chestInhale', breathValue);
|
| 664 |
+
},
|
| 665 |
+
|
| 666 |
+
/**
|
| 667 |
+
* Procedural eye blink — single + occasional double blinks with realistic timing
|
| 668 |
+
* State machine: idle → closing → closed → opening → idle
|
| 669 |
+
*/
|
| 670 |
+
updateBlink(delta) {
|
| 671 |
+
switch (this.blinkPhase) {
|
| 672 |
+
case 'idle':
|
| 673 |
+
this.blinkTimer += delta;
|
| 674 |
+
if (this.blinkTimer >= this.blinkNextAt) {
|
| 675 |
+
this.blinkPhase = 'closing';
|
| 676 |
+
this.blinkPhaseTimer = 0;
|
| 677 |
+
this.blinkTimer = 0;
|
| 678 |
+
this.isDoubleBlink = Math.random() < 0.15;
|
| 679 |
+
this.blinkCount = 0;
|
| 680 |
+
}
|
| 681 |
+
break;
|
| 682 |
+
case 'closing':
|
| 683 |
+
this.blinkPhaseTimer += delta;
|
| 684 |
+
const closeProgress = Math.min(this.blinkPhaseTimer / 0.06, 1);
|
| 685 |
+
this.setMorphTarget('eyeBlinkLeft', closeProgress);
|
| 686 |
+
this.setMorphTarget('eyeBlinkRight', closeProgress);
|
| 687 |
+
if (closeProgress >= 1) {
|
| 688 |
+
this.blinkPhase = 'closed';
|
| 689 |
+
this.blinkPhaseTimer = 0;
|
| 690 |
+
}
|
| 691 |
+
break;
|
| 692 |
+
case 'closed':
|
| 693 |
+
this.blinkPhaseTimer += delta;
|
| 694 |
+
const holdDuration = 0.05 + Math.random() * 0.10;
|
| 695 |
+
if (this.blinkPhaseTimer >= holdDuration) {
|
| 696 |
+
this.blinkPhase = 'opening';
|
| 697 |
+
this.blinkPhaseTimer = 0;
|
| 698 |
+
}
|
| 699 |
+
break;
|
| 700 |
+
case 'opening':
|
| 701 |
+
this.blinkPhaseTimer += delta;
|
| 702 |
+
const openProgress = Math.min(this.blinkPhaseTimer / 0.08, 1);
|
| 703 |
+
this.setMorphTarget('eyeBlinkLeft', 1 - openProgress);
|
| 704 |
+
this.setMorphTarget('eyeBlinkRight', 1 - openProgress);
|
| 705 |
+
if (openProgress >= 1) {
|
| 706 |
+
this.blinkCount++;
|
| 707 |
+
if (this.isDoubleBlink && this.blinkCount < 2) {
|
| 708 |
+
// Double blink: small pause then blink again
|
| 709 |
+
this.blinkPhase = 'closing';
|
| 710 |
+
this.blinkPhaseTimer = 0;
|
| 711 |
+
} else {
|
| 712 |
+
this.blinkPhase = 'idle';
|
| 713 |
+
this.blinkPhaseTimer = 0;
|
| 714 |
+
// Gaussian-ish random: 2-6s, more frequent when speaking
|
| 715 |
+
const base = this.isSpeaking ? 1.5 : 2.5;
|
| 716 |
+
const range = this.isSpeaking ? 2.5 : 4.0;
|
| 717 |
+
this.blinkNextAt = base + Math.random() * range;
|
| 718 |
+
}
|
| 719 |
+
}
|
| 720 |
+
break;
|
| 721 |
+
}
|
| 722 |
+
},
|
| 723 |
+
|
| 724 |
+
/**
|
| 725 |
+
* Natural eye gaze — eyes look around randomly using morph targets
|
| 726 |
+
*/
|
| 727 |
+
updateEyeGaze(delta) {
|
| 728 |
+
this.gazeTimer += delta;
|
| 729 |
+
if (this.gazeTimer >= this.gazeNextAt) {
|
| 730 |
+
this.gazeTimer = 0;
|
| 731 |
+
if (this.isSpeaking && Math.random() < 0.7) {
|
| 732 |
+
// During speech, mostly maintain eye contact (center)
|
| 733 |
+
this.gazeTargetX = (Math.random() - 0.5) * 0.15;
|
| 734 |
+
this.gazeTargetY = (Math.random() - 0.5) * 0.10;
|
| 735 |
+
this.gazeNextAt = 2 + Math.random() * 4;
|
| 736 |
+
} else {
|
| 737 |
+
// Idle: look around more freely
|
| 738 |
+
this.gazeTargetX = (Math.random() - 0.5) * 0.5;
|
| 739 |
+
this.gazeTargetY = -0.1 + Math.random() * 0.4;
|
| 740 |
+
this.gazeNextAt = 1.5 + Math.random() * 3;
|
| 741 |
+
}
|
| 742 |
+
}
|
| 743 |
+
|
| 744 |
+
// Smooth interpolation toward target
|
| 745 |
+
const gazeSmoothing = 1 - Math.exp(-4 * delta);
|
| 746 |
+
this.gazeCurrentX += (this.gazeTargetX - this.gazeCurrentX) * gazeSmoothing;
|
| 747 |
+
this.gazeCurrentY += (this.gazeTargetY - this.gazeCurrentY) * gazeSmoothing;
|
| 748 |
+
|
| 749 |
+
// Apply via morph targets (split into left/right for natural look)
|
| 750 |
+
if (this.gazeCurrentX > 0) {
|
| 751 |
+
this.setMorphTarget('eyeLookOutLeft', this.gazeCurrentX);
|
| 752 |
+
this.setMorphTarget('eyeLookInRight', this.gazeCurrentX);
|
| 753 |
+
this.setMorphTarget('eyeLookInLeft', 0);
|
| 754 |
+
this.setMorphTarget('eyeLookOutRight', 0);
|
| 755 |
+
} else {
|
| 756 |
+
this.setMorphTarget('eyeLookInLeft', -this.gazeCurrentX);
|
| 757 |
+
this.setMorphTarget('eyeLookOutRight', -this.gazeCurrentX);
|
| 758 |
+
this.setMorphTarget('eyeLookOutLeft', 0);
|
| 759 |
+
this.setMorphTarget('eyeLookInRight', 0);
|
| 760 |
+
}
|
| 761 |
+
if (this.gazeCurrentY > 0) {
|
| 762 |
+
this.setMorphTarget('eyeLookDownLeft', this.gazeCurrentY);
|
| 763 |
+
this.setMorphTarget('eyeLookDownRight', this.gazeCurrentY);
|
| 764 |
+
this.setMorphTarget('eyeLookUpLeft', 0);
|
| 765 |
+
this.setMorphTarget('eyeLookUpRight', 0);
|
| 766 |
+
} else {
|
| 767 |
+
this.setMorphTarget('eyeLookUpLeft', -this.gazeCurrentY);
|
| 768 |
+
this.setMorphTarget('eyeLookUpRight', -this.gazeCurrentY);
|
| 769 |
+
this.setMorphTarget('eyeLookDownLeft', 0);
|
| 770 |
+
this.setMorphTarget('eyeLookDownRight', 0);
|
| 771 |
+
}
|
| 772 |
+
},
|
| 773 |
+
|
| 774 |
+
/**
|
| 775 |
+
* Natural head/body sway — multi-frequency sine waves applied to Head bone
|
| 776 |
+
* Ported from TalkingHead's bodyRotateX/Y/Z system
|
| 777 |
+
*/
|
| 778 |
+
updateHeadSway(delta) {
|
| 779 |
+
if (!this.headBone) return;
|
| 780 |
+
|
| 781 |
+
this.headSwayTime += delta;
|
| 782 |
+
const t = this.headSwayTime;
|
| 783 |
+
|
| 784 |
+
// Multi-frequency Perlin-like noise for organic movement
|
| 785 |
+
// Each axis uses 2-3 layered sine waves at different frequencies
|
| 786 |
+
if (this.isSpeaking) {
|
| 787 |
+
// More animated during speech
|
| 788 |
+
this.headSwayTargetX = Math.sin(t * 0.7) * 0.04 + Math.sin(t * 1.9) * 0.03 + Math.sin(t * 3.1) * 0.02;
|
| 789 |
+
this.headSwayTargetY = Math.sin(t * 0.5) * 0.06 + Math.sin(t * 1.3) * 0.03;
|
| 790 |
+
this.headSwayTargetZ = Math.sin(t * 0.8) * 0.03 + Math.sin(t * 2.1) * 0.02;
|
| 791 |
+
} else {
|
| 792 |
+
// Gentle idle drift
|
| 793 |
+
this.headSwayTargetX = Math.sin(t * 0.3) * 0.02 + Math.sin(t * 0.8) * 0.015;
|
| 794 |
+
this.headSwayTargetY = Math.sin(t * 0.2) * 0.04 + Math.sin(t * 0.6) * 0.02;
|
| 795 |
+
this.headSwayTargetZ = Math.sin(t * 0.4) * 0.015 + Math.sin(t * 0.9) * 0.01;
|
| 796 |
+
}
|
| 797 |
+
|
| 798 |
+
// Smooth interpolation
|
| 799 |
+
const swaySmooth = 1 - Math.exp(-3 * delta);
|
| 800 |
+
this.headSwayCurrentX += (this.headSwayTargetX - this.headSwayCurrentX) * swaySmooth;
|
| 801 |
+
this.headSwayCurrentY += (this.headSwayTargetY - this.headSwayCurrentY) * swaySmooth;
|
| 802 |
+
this.headSwayCurrentZ += (this.headSwayTargetZ - this.headSwayCurrentZ) * swaySmooth;
|
| 803 |
+
|
| 804 |
+
// Apply rotation to head bone using quaternion
|
| 805 |
+
if (this._headBoneInitQuat && !this.activeGesture) {
|
| 806 |
+
const euler = new THREE.Euler(
|
| 807 |
+
this.headSwayCurrentX,
|
| 808 |
+
this.headSwayCurrentY,
|
| 809 |
+
this.headSwayCurrentZ,
|
| 810 |
+
'XYZ'
|
| 811 |
+
);
|
| 812 |
+
const swayQuat = new THREE.Quaternion().setFromEuler(euler);
|
| 813 |
+
this.headBone.quaternion.copy(this._headBoneInitQuat).multiply(swayQuat);
|
| 814 |
+
}
|
| 815 |
+
|
| 816 |
+
// Subtle spine sway (half the head amplitude for natural look)
|
| 817 |
+
if (this.spineBone && this._spineBoneInitQuat && !this.activeGesture) {
|
| 818 |
+
const spineEuler = new THREE.Euler(
|
| 819 |
+
this.headSwayCurrentX * 0.3,
|
| 820 |
+
this.headSwayCurrentY * 0.4,
|
| 821 |
+
this.headSwayCurrentZ * 0.3,
|
| 822 |
+
'XYZ'
|
| 823 |
+
);
|
| 824 |
+
const spineQuat = new THREE.Quaternion().setFromEuler(spineEuler);
|
| 825 |
+
this.spineBone.quaternion.copy(this._spineBoneInitQuat).multiply(spineQuat);
|
| 826 |
+
}
|
| 827 |
+
},
|
| 828 |
+
|
| 829 |
+
/**
|
| 830 |
+
* Head nod gesture — quick up-down rotations for agreement
|
| 831 |
+
*/
|
| 832 |
+
headNod() {
|
| 833 |
+
if (this.activeGesture) return;
|
| 834 |
+
this.activeGesture = 'nod';
|
| 835 |
+
this.gestureTimer = 0;
|
| 836 |
+
this.gesturePhase = 0;
|
| 837 |
+
},
|
| 838 |
+
|
| 839 |
+
/**
|
| 840 |
+
* Head shake gesture — quick left-right rotations for disagreement
|
| 841 |
+
*/
|
| 842 |
+
headShake() {
|
| 843 |
+
if (this.activeGesture) return;
|
| 844 |
+
this.activeGesture = 'shake';
|
| 845 |
+
this.gestureTimer = 0;
|
| 846 |
+
this.gesturePhase = 0;
|
| 847 |
+
},
|
| 848 |
+
|
| 849 |
+
/**
|
| 850 |
+
* Update active gesture animation (nod or shake)
|
| 851 |
+
*/
|
| 852 |
+
updateGesture(delta) {
|
| 853 |
+
if (!this.activeGesture || !this.headBone || !this._headBoneInitQuat) return;
|
| 854 |
+
|
| 855 |
+
this.gestureTimer += delta;
|
| 856 |
+
|
| 857 |
+
if (this.activeGesture === 'nod') {
|
| 858 |
+
// 3 nods: 0.15s down, 0.15s up each = 0.9s total
|
| 859 |
+
const nodAngle = 0.12; // radians
|
| 860 |
+
const nodSpeed = 0.15; // seconds per half-nod
|
| 861 |
+
const totalDuration = 6 * nodSpeed;
|
| 862 |
+
|
| 863 |
+
if (this.gestureTimer >= totalDuration) {
|
| 864 |
+
this.activeGesture = null;
|
| 865 |
+
return;
|
| 866 |
+
}
|
| 867 |
+
|
| 868 |
+
const phase = this.gestureTimer / nodSpeed;
|
| 869 |
+
const cyclePhase = phase % 2; // 0-2 per nod
|
| 870 |
+
const angle = cyclePhase < 1
|
| 871 |
+
? nodAngle * Math.sin(cyclePhase * Math.PI) // down
|
| 872 |
+
: 0; // back up
|
| 873 |
+
|
| 874 |
+
const euler = new THREE.Euler(angle, 0, 0, 'XYZ');
|
| 875 |
+
const gestureQuat = new THREE.Quaternion().setFromEuler(euler);
|
| 876 |
+
// Layer on top of current sway
|
| 877 |
+
const swayEuler = new THREE.Euler(this.headSwayCurrentX, this.headSwayCurrentY, this.headSwayCurrentZ, 'XYZ');
|
| 878 |
+
const swayQuat = new THREE.Quaternion().setFromEuler(swayEuler);
|
| 879 |
+
this.headBone.quaternion.copy(this._headBoneInitQuat).multiply(swayQuat).multiply(gestureQuat);
|
| 880 |
+
}
|
| 881 |
+
|
| 882 |
+
if (this.activeGesture === 'shake') {
|
| 883 |
+
// 4 shakes: left-right-left-right
|
| 884 |
+
const shakeAngle = 0.10;
|
| 885 |
+
const shakeSpeed = 0.12;
|
| 886 |
+
const totalDuration = 8 * shakeSpeed;
|
| 887 |
+
|
| 888 |
+
if (this.gestureTimer >= totalDuration) {
|
| 889 |
+
this.activeGesture = null;
|
| 890 |
+
return;
|
| 891 |
+
}
|
| 892 |
+
|
| 893 |
+
const phase = this.gestureTimer / shakeSpeed;
|
| 894 |
+
const cyclePhase = phase % 2;
|
| 895 |
+
const direction = Math.floor(phase / 2) % 2 === 0 ? -1 : 1;
|
| 896 |
+
const angle = direction * shakeAngle * Math.sin(cyclePhase * Math.PI);
|
| 897 |
+
|
| 898 |
+
const euler = new THREE.Euler(0, angle, 0, 'XYZ');
|
| 899 |
+
const gestureQuat = new THREE.Quaternion().setFromEuler(euler);
|
| 900 |
+
const swayEuler = new THREE.Euler(this.headSwayCurrentX, this.headSwayCurrentY, this.headSwayCurrentZ, 'XYZ');
|
| 901 |
+
const swayQuat = new THREE.Quaternion().setFromEuler(swayEuler);
|
| 902 |
+
this.headBone.quaternion.copy(this._headBoneInitQuat).multiply(swayQuat).multiply(gestureQuat);
|
| 903 |
+
}
|
| 904 |
+
},
|
| 905 |
+
|
| 906 |
+
/**
|
| 907 |
+
* Detect and trigger gestures from spoken text
|
| 908 |
+
*/
|
| 909 |
+
detectGestures(text) {
|
| 910 |
+
const s = text.toLowerCase();
|
| 911 |
+
const yesWords = ['yes', 'yeah', 'yep', 'sure', 'absolutely', 'definitely',
|
| 912 |
+
'correct', 'right', 'agree', 'of course', 'certainly', 'exactly', 'indeed'];
|
| 913 |
+
const noWords = ['no', 'nope', 'never', 'disagree', 'wrong', 'incorrect',
|
| 914 |
+
'not really', 'don\'t think', 'negative'];
|
| 915 |
+
if (yesWords.some(w => s.includes(w))) {
|
| 916 |
+
setTimeout(() => this.headNod(), 300 + Math.random() * 500);
|
| 917 |
+
} else if (noWords.some(w => s.includes(w))) {
|
| 918 |
+
setTimeout(() => this.headShake(), 300 + Math.random() * 500);
|
| 919 |
+
}
|
| 920 |
+
},
|
| 921 |
+
|
| 922 |
+
/**
|
| 923 |
+
* Stop current speech
|
| 924 |
+
*/
|
| 925 |
+
stopSpeaking() {
|
| 926 |
+
this.isSpeaking = false;
|
| 927 |
+
this.visemeTimeline = null;
|
| 928 |
+
this.currentVisemeTargets = {};
|
| 929 |
+
this.moodTargets = {};
|
| 930 |
+
|
| 931 |
+
if (this.currentAudio) {
|
| 932 |
+
this.currentAudio.pause();
|
| 933 |
+
this.currentAudio.currentTime = 0;
|
| 934 |
+
this.currentAudio = null;
|
| 935 |
+
}
|
| 936 |
+
|
| 937 |
+
// Reset viseme morph targets
|
| 938 |
+
this.resetVisemeMorphTargets();
|
| 939 |
+
|
| 940 |
+
this.lipSyncClips.forEach(action => action.stop());
|
| 941 |
+
this.lipSyncClips = [];
|
| 942 |
+
},
|
| 943 |
+
|
| 944 |
+
/**
|
| 945 |
+
* Animation render loop — includes real-time viseme lip sync
|
| 946 |
+
*/
|
| 947 |
+
animate() {
|
| 948 |
+
this.animationFrameId = requestAnimationFrame(() => this.animate());
|
| 949 |
+
|
| 950 |
+
const delta = this.clock.getDelta();
|
| 951 |
+
|
| 952 |
+
if (this.mixer) {
|
| 953 |
+
this.mixer.update(delta);
|
| 954 |
+
}
|
| 955 |
+
|
| 956 |
+
// ─── Always-on animation layers (run even when not speaking) ───
|
| 957 |
+
this.updateBreathing(delta);
|
| 958 |
+
this.updateBlink(delta);
|
| 959 |
+
this.updateEyeGaze(delta);
|
| 960 |
+
this.updateHeadSway(delta);
|
| 961 |
+
this.updateGesture(delta);
|
| 962 |
+
|
| 963 |
+
// ─── Real-time viseme lip sync ───
|
| 964 |
+
if (this.isSpeaking && this.visemeTimeline && this.currentAudio && this.morphMeshes && this.morphMeshes.length > 0) {
|
| 965 |
+
// Small time offset to compensate for audio decode/playback latency
|
| 966 |
+
const timeOffset = 0.12;
|
| 967 |
+
const currentTime = this.currentAudio.currentTime + timeOffset;
|
| 968 |
+
const activeViseme = LipSyncEngine.getActiveViseme(this.visemeTimeline, currentTime);
|
| 969 |
+
|
| 970 |
+
// Build target values for all viseme morphs
|
| 971 |
+
const targets = {};
|
| 972 |
+
LipSyncEngine.visemeNames.forEach(v => { targets['viseme_' + v] = 0; });
|
| 973 |
+
|
| 974 |
+
// Set active viseme
|
| 975 |
+
if (activeViseme.viseme !== 'sil') {
|
| 976 |
+
targets['viseme_' + activeViseme.viseme] = activeViseme.intensity;
|
| 977 |
+
|
| 978 |
+
// Blend a small amount of the next viseme for smooth transitions
|
| 979 |
+
if (activeViseme.nextViseme && activeViseme.nextViseme !== 'sil' && activeViseme.progress > 0.6) {
|
| 980 |
+
const blendFactor = (activeViseme.progress - 0.6) / 0.4; // 0 to 1 in last 40%
|
| 981 |
+
targets['viseme_' + activeViseme.nextViseme] = activeViseme.intensity * blendFactor * 0.3;
|
| 982 |
+
}
|
| 983 |
+
}
|
| 984 |
+
|
| 985 |
+
// Apply viseme morph targets with near-instant interpolation
|
| 986 |
+
// Factor 40 at 60fps → ~49% per frame = very responsive, no perceptible delay
|
| 987 |
+
const smoothing = 1 - Math.exp(-40 * delta);
|
| 988 |
+
for (const [key, target] of Object.entries(targets)) {
|
| 989 |
+
const current = this.appliedVisemeValues[key] || 0;
|
| 990 |
+
const newValue = current + (target - current) * smoothing;
|
| 991 |
+
this.appliedVisemeValues[key] = newValue;
|
| 992 |
+
this.setMorphTarget(key, newValue);
|
| 993 |
+
}
|
| 994 |
+
|
| 995 |
+
// Apply supplementary jawOpen from viseme (makes lip sync more visible)
|
| 996 |
+
const visemeBlend = LipSyncEngine.visemeBlendshapes?.[activeViseme.viseme];
|
| 997 |
+
if (visemeBlend) {
|
| 998 |
+
for (const [key, val] of Object.entries(visemeBlend)) {
|
| 999 |
+
const target = val * activeViseme.intensity;
|
| 1000 |
+
const current = this.appliedVisemeValues['_' + key] || 0;
|
| 1001 |
+
const newValue = current + (target - current) * smoothing;
|
| 1002 |
+
this.appliedVisemeValues['_' + key] = newValue;
|
| 1003 |
+
this.setMorphTarget(key, newValue);
|
| 1004 |
+
}
|
| 1005 |
+
} else {
|
| 1006 |
+
// Decay jawOpen when no viseme blend
|
| 1007 |
+
const cur = this.appliedVisemeValues['_jawOpen'] || 0;
|
| 1008 |
+
if (cur > 0.001) {
|
| 1009 |
+
const nv = cur * (1 - smoothing);
|
| 1010 |
+
this.appliedVisemeValues['_jawOpen'] = nv;
|
| 1011 |
+
this.setMorphTarget('jawOpen', nv);
|
| 1012 |
+
}
|
| 1013 |
+
}
|
| 1014 |
+
|
| 1015 |
+
// ─── Mood-based facial expressions ───
|
| 1016 |
+
const moodSmoothing = 1 - Math.exp(-3 * delta); // Slower, more gradual
|
| 1017 |
+
for (const [key, target] of Object.entries(this.moodTargets)) {
|
| 1018 |
+
const current = this.appliedMoodValues[key] || 0;
|
| 1019 |
+
const newValue = current + (target - current) * moodSmoothing;
|
| 1020 |
+
this.appliedMoodValues[key] = newValue;
|
| 1021 |
+
this.setMorphTarget(key, newValue);
|
| 1022 |
+
}
|
| 1023 |
+
|
| 1024 |
+
// ─── Micro-expressions & gestures during speech ───
|
| 1025 |
+
this.microExpressionTimer -= delta;
|
| 1026 |
+
if (this.microExpressionTimer <= 0) {
|
| 1027 |
+
this.microExpressionTimer = 0.8 + Math.random() * 1.2; // every 0.8-2.0s (more frequent)
|
| 1028 |
+
const microType = Math.random();
|
| 1029 |
+
const mood = this.moodPresets[this.currentMood] || {};
|
| 1030 |
+
|
| 1031 |
+
if (microType < 0.20) {
|
| 1032 |
+
// Brow flash — emphasis gesture
|
| 1033 |
+
this.moodTargets.browInnerUp = (mood.browInnerUp || 0) + 0.10 + Math.random() * 0.12;
|
| 1034 |
+
this.moodTargets.browOuterUpLeft = (mood.browOuterUpLeft || 0) + 0.06;
|
| 1035 |
+
this.moodTargets.browOuterUpRight = (mood.browOuterUpRight || 0) + 0.06;
|
| 1036 |
+
setTimeout(() => {
|
| 1037 |
+
if (this.isSpeaking) {
|
| 1038 |
+
this.moodTargets.browInnerUp = mood.browInnerUp || 0;
|
| 1039 |
+
this.moodTargets.browOuterUpLeft = mood.browOuterUpLeft || 0;
|
| 1040 |
+
this.moodTargets.browOuterUpRight = mood.browOuterUpRight || 0;
|
| 1041 |
+
}
|
| 1042 |
+
}, 350);
|
| 1043 |
+
} else if (microType < 0.35) {
|
| 1044 |
+
// Subtle squint — thinking/processing
|
| 1045 |
+
const v = 0.06 + Math.random() * 0.10;
|
| 1046 |
+
this.moodTargets.eyeSquintLeft = (mood.eyeSquintLeft || 0) + v;
|
| 1047 |
+
this.moodTargets.eyeSquintRight = (mood.eyeSquintRight || 0) + v;
|
| 1048 |
+
setTimeout(() => {
|
| 1049 |
+
if (this.isSpeaking) {
|
| 1050 |
+
this.moodTargets.eyeSquintLeft = mood.eyeSquintLeft || 0;
|
| 1051 |
+
this.moodTargets.eyeSquintRight = mood.eyeSquintRight || 0;
|
| 1052 |
+
}
|
| 1053 |
+
}, 500);
|
| 1054 |
+
} else if (microType < 0.50) {
|
| 1055 |
+
// Smile flicker — warmth/engagement
|
| 1056 |
+
const smileV = 0.06 + Math.random() * 0.08;
|
| 1057 |
+
this.moodTargets.mouthSmileLeft = (mood.mouthSmileLeft || 0) + smileV;
|
| 1058 |
+
this.moodTargets.mouthSmileRight = (mood.mouthSmileRight || 0) + smileV;
|
| 1059 |
+
this.moodTargets.cheekSquintLeft = (mood.cheekSquintLeft || 0) + smileV * 0.5;
|
| 1060 |
+
this.moodTargets.cheekSquintRight = (mood.cheekSquintRight || 0) + smileV * 0.5;
|
| 1061 |
+
setTimeout(() => {
|
| 1062 |
+
if (this.isSpeaking) {
|
| 1063 |
+
this.moodTargets.mouthSmileLeft = mood.mouthSmileLeft || 0;
|
| 1064 |
+
this.moodTargets.mouthSmileRight = mood.mouthSmileRight || 0;
|
| 1065 |
+
this.moodTargets.cheekSquintLeft = mood.cheekSquintLeft || 0;
|
| 1066 |
+
this.moodTargets.cheekSquintRight = mood.cheekSquintRight || 0;
|
| 1067 |
+
}
|
| 1068 |
+
}, 600);
|
| 1069 |
+
} else if (microType < 0.65) {
|
| 1070 |
+
// Head nod — agreement/acknowledgment via morph targets
|
| 1071 |
+
this.moodTargets.jawOpen = (mood.jawOpen || 0) + 0.03;
|
| 1072 |
+
this.moodTargets.noseSneerLeft = (mood.noseSneerLeft || 0) + 0.04;
|
| 1073 |
+
this.moodTargets.noseSneerRight = (mood.noseSneerRight || 0) + 0.04;
|
| 1074 |
+
setTimeout(() => {
|
| 1075 |
+
if (this.isSpeaking) {
|
| 1076 |
+
this.moodTargets.jawOpen = mood.jawOpen || 0;
|
| 1077 |
+
this.moodTargets.noseSneerLeft = mood.noseSneerLeft || 0;
|
| 1078 |
+
this.moodTargets.noseSneerRight = mood.noseSneerRight || 0;
|
| 1079 |
+
}
|
| 1080 |
+
}, 300);
|
| 1081 |
+
} else if (microType < 0.78) {
|
| 1082 |
+
// Eye widen — attention/interest
|
| 1083 |
+
this.moodTargets.eyeWideLeft = (mood.eyeWideLeft || 0) + 0.08 + Math.random() * 0.06;
|
| 1084 |
+
this.moodTargets.eyeWideRight = (mood.eyeWideRight || 0) + 0.08 + Math.random() * 0.06;
|
| 1085 |
+
setTimeout(() => {
|
| 1086 |
+
if (this.isSpeaking) {
|
| 1087 |
+
this.moodTargets.eyeWideLeft = mood.eyeWideLeft || 0;
|
| 1088 |
+
this.moodTargets.eyeWideRight = mood.eyeWideRight || 0;
|
| 1089 |
+
}
|
| 1090 |
+
}, 400);
|
| 1091 |
+
} else if (microType < 0.88) {
|
| 1092 |
+
// Mouth dimple — contemplation gesture
|
| 1093 |
+
this.moodTargets.mouthDimpleLeft = (mood.mouthDimpleLeft || 0) + 0.10;
|
| 1094 |
+
this.moodTargets.mouthDimpleRight = (mood.mouthDimpleRight || 0) + 0.10;
|
| 1095 |
+
this.moodTargets.mouthPressLeft = (mood.mouthPressLeft || 0) + 0.05;
|
| 1096 |
+
this.moodTargets.mouthPressRight = (mood.mouthPressRight || 0) + 0.05;
|
| 1097 |
+
setTimeout(() => {
|
| 1098 |
+
if (this.isSpeaking) {
|
| 1099 |
+
this.moodTargets.mouthDimpleLeft = mood.mouthDimpleLeft || 0;
|
| 1100 |
+
this.moodTargets.mouthDimpleRight = mood.mouthDimpleRight || 0;
|
| 1101 |
+
this.moodTargets.mouthPressLeft = mood.mouthPressLeft || 0;
|
| 1102 |
+
this.moodTargets.mouthPressRight = mood.mouthPressRight || 0;
|
| 1103 |
+
}
|
| 1104 |
+
}, 500);
|
| 1105 |
+
} else {
|
| 1106 |
+
// Nose sneer — subtle character gesture
|
| 1107 |
+
const sneerV = 0.04 + Math.random() * 0.05;
|
| 1108 |
+
this.moodTargets.noseSneerLeft = (mood.noseSneerLeft || 0) + sneerV;
|
| 1109 |
+
this.moodTargets.noseSneerRight = (mood.noseSneerRight || 0) + sneerV * 0.6;
|
| 1110 |
+
setTimeout(() => {
|
| 1111 |
+
if (this.isSpeaking) {
|
| 1112 |
+
this.moodTargets.noseSneerLeft = mood.noseSneerLeft || 0;
|
| 1113 |
+
this.moodTargets.noseSneerRight = mood.noseSneerRight || 0;
|
| 1114 |
+
}
|
| 1115 |
+
}, 350);
|
| 1116 |
+
}
|
| 1117 |
+
}
|
| 1118 |
+
} else if (!this.isSpeaking) {
|
| 1119 |
+
// When not speaking, decay all applied values smoothly to 0
|
| 1120 |
+
const decaySmoothing = 1 - Math.exp(-5 * delta);
|
| 1121 |
+
let hasValues = false;
|
| 1122 |
+
for (const [key, val] of Object.entries(this.appliedVisemeValues)) {
|
| 1123 |
+
if (Math.abs(val) > 0.001) {
|
| 1124 |
+
hasValues = true;
|
| 1125 |
+
const newValue = val * (1 - decaySmoothing);
|
| 1126 |
+
this.appliedVisemeValues[key] = newValue;
|
| 1127 |
+
const morphKey = key.startsWith('_') ? key.substring(1) : key;
|
| 1128 |
+
this.setMorphTarget(morphKey, newValue);
|
| 1129 |
+
}
|
| 1130 |
+
}
|
| 1131 |
+
for (const [key, val] of Object.entries(this.appliedMoodValues)) {
|
| 1132 |
+
if (Math.abs(val) > 0.001) {
|
| 1133 |
+
hasValues = true;
|
| 1134 |
+
const newValue = val * (1 - decaySmoothing);
|
| 1135 |
+
this.appliedMoodValues[key] = newValue;
|
| 1136 |
+
this.setMorphTarget(key, newValue);
|
| 1137 |
+
}
|
| 1138 |
+
}
|
| 1139 |
+
if (!hasValues) {
|
| 1140 |
+
this.appliedVisemeValues = {};
|
| 1141 |
+
this.appliedMoodValues = {};
|
| 1142 |
+
}
|
| 1143 |
+
}
|
| 1144 |
+
|
| 1145 |
+
if (this.renderer && this.scene && this.camera) {
|
| 1146 |
+
this.renderer.render(this.scene, this.camera);
|
| 1147 |
+
}
|
| 1148 |
+
},
|
| 1149 |
+
|
| 1150 |
+
/**
|
| 1151 |
+
* Handle window resize
|
| 1152 |
+
*/
|
| 1153 |
+
onResize() {
|
| 1154 |
+
if (!this.container || !this.camera || !this.renderer) return;
|
| 1155 |
+
|
| 1156 |
+
const width = this.container.clientWidth;
|
| 1157 |
+
const height = this.container.clientHeight;
|
| 1158 |
+
const aspect = width / height;
|
| 1159 |
+
const zoom = 1600;
|
| 1160 |
+
|
| 1161 |
+
this.camera.left = -aspect / 2 * (1 / zoom * 1000);
|
| 1162 |
+
this.camera.right = aspect / 2 * (1 / zoom * 1000);
|
| 1163 |
+
this.camera.top = 1 / zoom * 500;
|
| 1164 |
+
this.camera.bottom = -1 / zoom * 500;
|
| 1165 |
+
this.camera.updateProjectionMatrix();
|
| 1166 |
+
|
| 1167 |
+
this.renderer.setSize(width, height);
|
| 1168 |
+
|
| 1169 |
+
// Resize background to fill the new viewport
|
| 1170 |
+
if (this.bgMesh) {
|
| 1171 |
+
const viewWidth = aspect * (1000 / zoom);
|
| 1172 |
+
const viewHeight = 2 * (500 / zoom);
|
| 1173 |
+
const scale = 1.15;
|
| 1174 |
+
this.bgMesh.geometry.dispose();
|
| 1175 |
+
this.bgMesh.geometry = new THREE.PlaneGeometry(viewWidth * scale, viewHeight * scale);
|
| 1176 |
+
}
|
| 1177 |
+
},
|
| 1178 |
+
|
| 1179 |
+
/**
|
| 1180 |
+
* Clean up all resources
|
| 1181 |
+
*/
|
| 1182 |
+
destroy() {
|
| 1183 |
+
this.stopSpeaking();
|
| 1184 |
+
|
| 1185 |
+
if (this.animationFrameId) {
|
| 1186 |
+
cancelAnimationFrame(this.animationFrameId);
|
| 1187 |
+
this.animationFrameId = null;
|
| 1188 |
+
}
|
| 1189 |
+
|
| 1190 |
+
if (this.resizeHandler) {
|
| 1191 |
+
window.removeEventListener('resize', this.resizeHandler);
|
| 1192 |
+
}
|
| 1193 |
+
|
| 1194 |
+
if (this.renderer) {
|
| 1195 |
+
this.renderer.dispose();
|
| 1196 |
+
if (this.renderer.domElement && this.renderer.domElement.parentNode) {
|
| 1197 |
+
this.renderer.domElement.parentNode.removeChild(this.renderer.domElement);
|
| 1198 |
+
}
|
| 1199 |
+
}
|
| 1200 |
+
|
| 1201 |
+
if (this.scene) {
|
| 1202 |
+
this.scene.traverse((obj) => {
|
| 1203 |
+
if (obj.geometry) obj.geometry.dispose();
|
| 1204 |
+
if (obj.material) {
|
| 1205 |
+
if (Array.isArray(obj.material)) {
|
| 1206 |
+
obj.material.forEach(m => m.dispose());
|
| 1207 |
+
} else {
|
| 1208 |
+
obj.material.dispose();
|
| 1209 |
+
}
|
| 1210 |
+
}
|
| 1211 |
+
});
|
| 1212 |
+
}
|
| 1213 |
+
|
| 1214 |
+
this.scene = null;
|
| 1215 |
+
this.camera = null;
|
| 1216 |
+
this.renderer = null;
|
| 1217 |
+
this.mixer = null;
|
| 1218 |
+
this.gltfScene = null;
|
| 1219 |
+
this.isInitialized = false;
|
| 1220 |
+
this.morphTargetDictionaryBody = null;
|
| 1221 |
+
this.morphTargetDictionaryLowerTeeth = null;
|
| 1222 |
+
this.morphMeshes = [];
|
| 1223 |
+
this.bodyMesh = null;
|
| 1224 |
+
this.teethMesh = null;
|
| 1225 |
+
|
| 1226 |
+
console.log('Avatar3D: Destroyed');
|
| 1227 |
+
}
|
| 1228 |
+
};
|
frontend/js/components/lipsync-engine.js
ADDED
|
@@ -0,0 +1,444 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - LipSync Engine
|
| 3 |
+
* Ported from TalkingHead (MIT License, Mika Suominen)
|
| 4 |
+
* Converts English text to Oculus LipSync Visemes with timing data
|
| 5 |
+
*
|
| 6 |
+
* Viseme set: aa, E, I, O, U, PP, SS, TH, DD, FF, kk, nn, RR, CH, sil
|
| 7 |
+
* These map directly to RPM model morph targets: viseme_aa, viseme_E, etc.
|
| 8 |
+
*/
|
| 9 |
+
|
| 10 |
+
const LipSyncEngine = {
|
| 11 |
+
|
| 12 |
+
// ─── Letter-to-Sound Rules (NRL Report 7948) ───
|
| 13 |
+
// Each rule: { regex, move, visemes[] }
|
| 14 |
+
_rulesCompiled: false,
|
| 15 |
+
_rules: {},
|
| 16 |
+
|
| 17 |
+
// Viseme durations in relative units (1 = average)
|
| 18 |
+
visemeDurations: {
|
| 19 |
+
'aa': 0.95, 'E': 0.90, 'I': 0.92, 'O': 0.96, 'U': 0.95, 'PP': 1.08,
|
| 20 |
+
'SS': 1.23, 'TH': 1, 'DD': 1.05, 'FF': 1.00, 'kk': 1.21, 'nn': 0.88,
|
| 21 |
+
'RR': 0.88, 'CH': 1.1, 'sil': 1
|
| 22 |
+
},
|
| 23 |
+
|
| 24 |
+
// Pauses in relative units
|
| 25 |
+
specialDurations: { ' ': 1, ',': 3, '-': 0.5, "'": 0.5 },
|
| 26 |
+
|
| 27 |
+
// All viseme names (Oculus LipSync)
|
| 28 |
+
visemeNames: ['aa', 'E', 'I', 'O', 'U', 'PP', 'SS', 'TH', 'DD', 'FF', 'kk', 'nn', 'RR', 'CH', 'sil'],
|
| 29 |
+
|
| 30 |
+
// Viseme-to-blendshape intensity mapping for non-viseme morph targets
|
| 31 |
+
// This adds jaw movement and supplementary expressions to make lip sync more visible
|
| 32 |
+
visemeBlendshapes: {
|
| 33 |
+
'aa': { jawOpen: 0.35 },
|
| 34 |
+
'E': { jawOpen: 0.20 },
|
| 35 |
+
'I': { jawOpen: 0.12 },
|
| 36 |
+
'O': { jawOpen: 0.30 },
|
| 37 |
+
'U': { jawOpen: 0.15 },
|
| 38 |
+
'PP': { jawOpen: 0.02 },
|
| 39 |
+
'SS': { jawOpen: 0.05 },
|
| 40 |
+
'TH': { jawOpen: 0.08 },
|
| 41 |
+
'DD': { jawOpen: 0.10 },
|
| 42 |
+
'FF': { jawOpen: 0.05 },
|
| 43 |
+
'kk': { jawOpen: 0.12 },
|
| 44 |
+
'nn': { jawOpen: 0.08 },
|
| 45 |
+
'RR': { jawOpen: 0.10 },
|
| 46 |
+
'CH': { jawOpen: 0.08 },
|
| 47 |
+
'sil': { jawOpen: 0.0 }
|
| 48 |
+
},
|
| 49 |
+
|
| 50 |
+
/**
|
| 51 |
+
* Initialize the rules engine. Called once on first use.
|
| 52 |
+
*/
|
| 53 |
+
init() {
|
| 54 |
+
if (this._rulesCompiled) return;
|
| 55 |
+
|
| 56 |
+
// Raw letter-to-sound rules from NRL Report 7948
|
| 57 |
+
const rawRules = {
|
| 58 |
+
'A': [
|
| 59 |
+
"[A] =aa", " [ARE] =aa RR", " [AR]O=aa RR", "[AR]#=E RR",
|
| 60 |
+
" ^[AS]#=E SS", "[A]WA=aa", "[AW]=aa", " :[ANY]=E nn I",
|
| 61 |
+
"[A]^+#=E", "#:[ALLY]=aa nn I", " [AL]#=aa nn", "[AGAIN]=aa kk E nn",
|
| 62 |
+
"#:[AG]E=I kk", "[A]^+:#=aa", ":[A]^+ =E", "[A]^%=E",
|
| 63 |
+
" [ARR]=aa RR", "[ARR]=aa RR", " :[AR] =aa RR", "[AR] =E",
|
| 64 |
+
"[AR]=aa RR", "[AIR]=E RR", "[AI]=E", "[AY]=E", "[AU]=aa",
|
| 65 |
+
"#:[AL] =aa nn", "#:[ALS] =aa nn SS", "[ALK]=aa kk", "[AL]^=aa nn",
|
| 66 |
+
" :[ABLE]=E PP aa nn", "[ABLE]=aa PP aa nn", "[ANG]+=E nn kk", "[A]=aa"
|
| 67 |
+
],
|
| 68 |
+
'B': [
|
| 69 |
+
" [BE]^#=PP I", "[BEING]=PP I I nn", " [BOTH] =PP O TH",
|
| 70 |
+
" [BUS]#=PP I SS", "[BUIL]=PP I nn", "[B]=PP"
|
| 71 |
+
],
|
| 72 |
+
'C': [
|
| 73 |
+
" [CH]^=kk", "^E[CH]=kk", "[CH]=CH", " S[CI]#=SS aa",
|
| 74 |
+
"[CI]A=SS", "[CI]O=SS", "[CI]EN=SS", "[C]+=SS",
|
| 75 |
+
"[CK]=kk", "[COM]%=kk aa PP", "[C]=kk"
|
| 76 |
+
],
|
| 77 |
+
'D': [
|
| 78 |
+
"#:[DED] =DD I DD", ".E[D] =DD", "#^:E[D] =DD", " [DE]^#=DD I",
|
| 79 |
+
" [DO] =DD U", " [DOES]=DD aa SS", " [DOING]=DD U I nn",
|
| 80 |
+
" [DOW]=DD aa", "[DU]A=kk U", "[D]=DD"
|
| 81 |
+
],
|
| 82 |
+
'E': [
|
| 83 |
+
"#:[E] =", "'^:[E] =", " :[E] =I", "#[ED] =DD", "#:[E]D =",
|
| 84 |
+
"[EV]ER=E FF", "[E]^%=I", "[ERI]#=I RR I", "[ERI]=E RR I",
|
| 85 |
+
"#:[ER]#=E", "[ER]#=E RR", "[ER]=E", " [EVEN]=I FF E nn",
|
| 86 |
+
"#:[E]W=", "@[EW]=U", "[EW]=I U", "[E]O=I", "#:&[ES] =I SS",
|
| 87 |
+
"#:[E]S =", "#:[ELY] =nn I", "#:[EMENT]=PP E nn DD", "[EFUL]=FF U nn",
|
| 88 |
+
"[EE]=I", "[EARN]=E nn", " [EAR]^=E", "[EAD]=E DD", "#:[EA] =I aa",
|
| 89 |
+
"[EA]SU=E", "[EA]=I", "[EIGH]=E", "[EI]=I", " [EYE]=aa", "[EY]=I",
|
| 90 |
+
"[EU]=I U", "[E]=E"
|
| 91 |
+
],
|
| 92 |
+
'F': [
|
| 93 |
+
"[FUL]=FF U nn", "[F]=FF"
|
| 94 |
+
],
|
| 95 |
+
'G': [
|
| 96 |
+
"[GIV]=kk I FF", " [G]I^=kk", "[GE]T=kk E", "SU[GGES]=kk kk E SS",
|
| 97 |
+
"[GG]=kk", " B#[G]=kk", "[G]+=kk", "[GREAT]=kk RR E DD",
|
| 98 |
+
"#[GH]=", "[G]=kk"
|
| 99 |
+
],
|
| 100 |
+
'H': [
|
| 101 |
+
" [HAV]=I aa FF", " [HERE]=I I RR", " [HOUR]=aa EE", "[HOW]=I aa",
|
| 102 |
+
"[H]#=I", "[H]="
|
| 103 |
+
],
|
| 104 |
+
'I': [
|
| 105 |
+
" [IN]=I nn", " [I] =aa", "[IN]D=aa nn", "[IER]=I E",
|
| 106 |
+
"#:R[IED] =I DD", "[IED] =aa DD", "[IEN]=I E nn", "[IE]T=aa E",
|
| 107 |
+
" :[I]%=aa", "[I]%=I", "[IE]=I", "[I]^+:#=I", "[IR]#=aa RR",
|
| 108 |
+
"[IZ]%=aa SS", "[IS]%=aa SS", "[I]D%=aa", "+^[I]^+=I",
|
| 109 |
+
"[I]T%=aa", "#^:[I]^+=I", "[I]^+=aa", "[IR]=E", "[IGH]=aa",
|
| 110 |
+
"[ILD]=aa nn DD", "[IGN] =aa nn", "[IGN]^=aa nn", "[IGN]%=aa nn",
|
| 111 |
+
"[IQUE]=I kk", "[I]=I"
|
| 112 |
+
],
|
| 113 |
+
'J': ["[J]=kk"],
|
| 114 |
+
'K': [" [K]N=", "[K]=kk"],
|
| 115 |
+
'L': ["[LO]C#=nn O", "L[L]=", "#^:[L]%=aa nn", "[LEAD]=nn I DD", "[L]=nn"],
|
| 116 |
+
'M': ["[MOV]=PP U FF", "[M]=PP"],
|
| 117 |
+
'N': [
|
| 118 |
+
"E[NG]+=nn kk", "[NG]R=nn kk", "[NG]#=nn kk", "[NGL]%=nn kk aa nn",
|
| 119 |
+
"[NG]=nn", "[NK]=nn kk", " [NOW] =nn aa", "[N]=nn"
|
| 120 |
+
],
|
| 121 |
+
'O': [
|
| 122 |
+
"[OF] =aa FF", "[OROUGH]=E O", "#:[OR] =E", "#:[ORS] =E SS",
|
| 123 |
+
"[OR]=aa RR", " [ONE]=FF aa nn", "[OW]=O", " [OVER]=O FF E",
|
| 124 |
+
"[OV]=aa FF", "[O]^%=O", "[O]^EN=O", "[O]^I#=O", "[OL]D=O nn",
|
| 125 |
+
"[OUGHT]=aa DD", "[OUGH]=aa FF", " [OU]=aa", "H[OU]S#=aa",
|
| 126 |
+
"[OUS]=aa SS", "[OUR]=aa RR", "[OULD]=U DD", "^[OU]^L=aa",
|
| 127 |
+
"[OUP]=U OO", "[OU]=aa", "[OY]=O", "[OING]=O I nn", "[OI]=O",
|
| 128 |
+
"[OOR]=aa RR", "[OOK]=U kk", "[OOD]=U DD", "[OO]=U", "[O]E=O",
|
| 129 |
+
"[O] =O", "[OA]=O", " [ONLY]=O nn nn I", " [ONCE]=FF aa nn SS",
|
| 130 |
+
"[ON'T]=O nn DD", "C[O]N=aa", "[O]NG=aa", " ^:[O]N=aa",
|
| 131 |
+
"I[ON]=aa nn", "#:[ON] =aa nn", "#^[ON]=aa nn", "[O]ST =O",
|
| 132 |
+
"[OF]^=aa FF", "[OTHER]=aa TH E", "[OSS] =aa SS", "#^:[OM]=aa PP",
|
| 133 |
+
"[O]=aa"
|
| 134 |
+
],
|
| 135 |
+
'P': [
|
| 136 |
+
"[PH]=FF", "[PEOP]=PP I PP", "[POW]=PP aa", "[PUT] =PP U DD",
|
| 137 |
+
"[P]=PP"
|
| 138 |
+
],
|
| 139 |
+
'Q': ["[QUAR]=kk FF aa RR", "[QU]=kk FF", "[Q]=kk"],
|
| 140 |
+
'R': [" [RE]^#=RR I", "[R]=RR"],
|
| 141 |
+
'S': [
|
| 142 |
+
"[SH]=SS", "#[SION]=SS aa nn", "[SOME]=SS aa PP", "#[SUR]#=SS E",
|
| 143 |
+
"[SUR]#=SS E", "#[SU]#=SS U", "#[SSU]#=SS U", "#[SED] =SS DD",
|
| 144 |
+
"#[S]#=SS", "[SAID]=SS E DD", "^[SION]=SS aa nn", "[S]S=",
|
| 145 |
+
".[S] =SS", "#:.E[S] =SS", "#^:##[S] =SS", "#^:#[S] =SS",
|
| 146 |
+
"U[S] =SS", " :#[S] =SS", " [SCH]=SS kk", "[S]C+=",
|
| 147 |
+
"#[SM]=SS PP", "#[SN]'=SS aa nn", "[S]=SS"
|
| 148 |
+
],
|
| 149 |
+
'T': [
|
| 150 |
+
" [THE] =TH aa", "[TO] =DD U", "[THAT] =TH aa DD", " [THIS] =TH I SS",
|
| 151 |
+
" [THEY]=TH E", " [THERE]=TH E RR", "[THER]=TH E", "[THEIR]=TH E RR",
|
| 152 |
+
" [THAN] =TH aa nn", " [THEM] =TH E PP", "[THESE] =TH I SS",
|
| 153 |
+
" [THEN]=TH E nn", "[THROUGH]=TH RR U", "[THOSE]=TH O SS",
|
| 154 |
+
"[THOUGH] =TH O", " [THUS]=TH aa SS", "[TH]=TH", "#:[TED] =DD I DD",
|
| 155 |
+
"S[TI]#N=CH", "[TI]O=SS", "[TI]A=SS", "[TIEN]=SS aa nn",
|
| 156 |
+
"[TUR]#=CH E", "[TU]A=CH U", " [TWO]=DD U", "[T]=DD"
|
| 157 |
+
],
|
| 158 |
+
'U': [
|
| 159 |
+
" [UN]I=I U nn", " [UN]=aa nn", " [UPON]=aa PP aa nn",
|
| 160 |
+
"@[UR]#=U RR", "[UR]#=I U RR", "[UR]=E", "[U]^ =aa",
|
| 161 |
+
"[U]^^=aa", "[UY]=aa", " G[U]#=", "G[U]%=", "G[U]#=FF",
|
| 162 |
+
"#N[U]=I U", "@[U]=I", "[U]=I U"
|
| 163 |
+
],
|
| 164 |
+
'V': ["[VIEW]=FF I U", "[V]=FF"],
|
| 165 |
+
'W': [
|
| 166 |
+
" [WERE]=FF E", "[WA]S=FF aa", "[WA]T=FF aa", "[WHERE]=FF E RR",
|
| 167 |
+
"[WHAT]=FF aa DD", "[WHOL]=I O nn", "[WHO]=I U", "[WH]=FF",
|
| 168 |
+
"[WAR]=FF aa RR", "[WOR]^=FF E", "[WR]=RR", "[W]=FF"
|
| 169 |
+
],
|
| 170 |
+
'X': [" [X]=SS", "[X]=kk SS"],
|
| 171 |
+
'Y': [
|
| 172 |
+
"[YOUNG]=I aa nn", " [YOU]=I U", " [YES]=I E SS", " [Y]=I",
|
| 173 |
+
"#^:[Y] =I", "#^:[Y]I=I", " :[Y] =aa", " :[Y]#=aa",
|
| 174 |
+
" :[Y]^+:#=I", " :[Y]^#=I", "[Y]=I"
|
| 175 |
+
],
|
| 176 |
+
'Z': ["[Z]=SS"]
|
| 177 |
+
};
|
| 178 |
+
|
| 179 |
+
// Operator definitions for rule patterns
|
| 180 |
+
const ops = {
|
| 181 |
+
'#': '[AEIOUY]+',
|
| 182 |
+
'.': '[BDVGJLMNRWZ]',
|
| 183 |
+
'%': '(?:ER|E|ES|ED|ING|ELY)',
|
| 184 |
+
'&': '(?:[SCGZXJ]|CH|SH)',
|
| 185 |
+
'@': '(?:[TSRDLZNJ]|TH|CH|SH)',
|
| 186 |
+
'^': '[BCDFGHJKLMNPQRSTVWXZ]',
|
| 187 |
+
'+': '[EIY]',
|
| 188 |
+
':': '[BCDFGHJKLMNPQRSTVWXZ]*',
|
| 189 |
+
' ': '\\b'
|
| 190 |
+
};
|
| 191 |
+
|
| 192 |
+
// Compile rules to regex
|
| 193 |
+
Object.keys(rawRules).forEach(key => {
|
| 194 |
+
this._rules[key] = rawRules[key].map(rule => {
|
| 195 |
+
const posL = rule.indexOf('[');
|
| 196 |
+
const posR = rule.indexOf(']');
|
| 197 |
+
const posE = rule.indexOf('=');
|
| 198 |
+
const strLeft = rule.substring(0, posL);
|
| 199 |
+
const strLetters = rule.substring(posL + 1, posR);
|
| 200 |
+
const strRight = rule.substring(posR + 1, posE);
|
| 201 |
+
const strVisemes = rule.substring(posE + 1);
|
| 202 |
+
|
| 203 |
+
const o = { regex: '', move: 0, visemes: [] };
|
| 204 |
+
|
| 205 |
+
let exp = '';
|
| 206 |
+
exp += [...strLeft].map(x => ops[x] || x).join('');
|
| 207 |
+
const ctxLetters = [...strLetters];
|
| 208 |
+
ctxLetters[0] = ctxLetters[0].toLowerCase();
|
| 209 |
+
exp += ctxLetters.join('');
|
| 210 |
+
o.move = ctxLetters.length;
|
| 211 |
+
exp += [...strRight].map(x => ops[x] || x).join('');
|
| 212 |
+
o.regex = new RegExp(exp);
|
| 213 |
+
|
| 214 |
+
if (strVisemes.length) {
|
| 215 |
+
strVisemes.split(' ').forEach(viseme => {
|
| 216 |
+
o.visemes.push(viseme);
|
| 217 |
+
});
|
| 218 |
+
}
|
| 219 |
+
|
| 220 |
+
return o;
|
| 221 |
+
});
|
| 222 |
+
});
|
| 223 |
+
|
| 224 |
+
this._rulesCompiled = true;
|
| 225 |
+
console.log('LipSyncEngine: Initialized with', Object.keys(this._rules).length, 'letter rules');
|
| 226 |
+
},
|
| 227 |
+
|
| 228 |
+
/**
|
| 229 |
+
* Pre-process text: remove special chars, convert numbers to words, etc.
|
| 230 |
+
* @param {string} s - Input text
|
| 231 |
+
* @returns {string} Cleaned text
|
| 232 |
+
*/
|
| 233 |
+
preProcessText(s) {
|
| 234 |
+
// Symbols to words
|
| 235 |
+
const symbols = { '%': 'percent', '€': 'euros', '&': 'and', '+': 'plus', '$': 'dollars' };
|
| 236 |
+
let r = s.replace(/[#_*":;]/g, '');
|
| 237 |
+
r = r.replace(/[%€&+$]/g, (sym) => ' ' + (symbols[sym] || '') + ' ');
|
| 238 |
+
|
| 239 |
+
// Simple number-to-word conversion for common cases
|
| 240 |
+
r = r.replace(/\b(\d+)\b/g, (match) => {
|
| 241 |
+
const n = parseInt(match);
|
| 242 |
+
if (n >= 0 && n <= 20) {
|
| 243 |
+
const words = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine',
|
| 244 |
+
'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen',
|
| 245 |
+
'eighteen', 'nineteen', 'twenty'];
|
| 246 |
+
return words[n];
|
| 247 |
+
}
|
| 248 |
+
// For larger numbers, just spell out digits
|
| 249 |
+
return match.split('').map(d => ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'][parseInt(d)] || d).join(' ');
|
| 250 |
+
});
|
| 251 |
+
|
| 252 |
+
r = r.replace(/(\D)\1\1+/g, '$1$1') // max 2 repeating chars
|
| 253 |
+
.replace(/ +/g, ' ')
|
| 254 |
+
.trim();
|
| 255 |
+
|
| 256 |
+
return r;
|
| 257 |
+
},
|
| 258 |
+
|
| 259 |
+
/**
|
| 260 |
+
* Convert a word to Oculus LipSync Visemes with timing
|
| 261 |
+
* @param {string} w - Word to convert
|
| 262 |
+
* @returns {Object} { visemes: string[], times: number[], durations: number[] }
|
| 263 |
+
*/
|
| 264 |
+
wordToVisemes(w) {
|
| 265 |
+
this.init();
|
| 266 |
+
|
| 267 |
+
const o = { words: w.toUpperCase(), visemes: [], times: [], durations: [], i: 0 };
|
| 268 |
+
let t = 0;
|
| 269 |
+
|
| 270 |
+
const chars = [...o.words];
|
| 271 |
+
while (o.i < chars.length) {
|
| 272 |
+
const c = chars[o.i];
|
| 273 |
+
const ruleset = this._rules[c];
|
| 274 |
+
if (ruleset) {
|
| 275 |
+
let matched = false;
|
| 276 |
+
for (let i = 0; i < ruleset.length; i++) {
|
| 277 |
+
const rule = ruleset[i];
|
| 278 |
+
const test = o.words.substring(0, o.i) + c.toLowerCase() + o.words.substring(o.i + 1);
|
| 279 |
+
const matches = test.match(rule.regex);
|
| 280 |
+
if (matches) {
|
| 281 |
+
rule.visemes.forEach(viseme => {
|
| 282 |
+
if (o.visemes.length && o.visemes[o.visemes.length - 1] === viseme) {
|
| 283 |
+
const d = 0.7 * (this.visemeDurations[viseme] || 1);
|
| 284 |
+
o.durations[o.durations.length - 1] += d;
|
| 285 |
+
t += d;
|
| 286 |
+
} else {
|
| 287 |
+
const d = this.visemeDurations[viseme] || 1;
|
| 288 |
+
o.visemes.push(viseme);
|
| 289 |
+
o.times.push(t);
|
| 290 |
+
o.durations.push(d);
|
| 291 |
+
t += d;
|
| 292 |
+
}
|
| 293 |
+
});
|
| 294 |
+
o.i += rule.move;
|
| 295 |
+
matched = true;
|
| 296 |
+
break;
|
| 297 |
+
}
|
| 298 |
+
}
|
| 299 |
+
if (!matched) o.i++;
|
| 300 |
+
} else {
|
| 301 |
+
o.i++;
|
| 302 |
+
t += this.specialDurations[c] || 0;
|
| 303 |
+
}
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
return o;
|
| 307 |
+
},
|
| 308 |
+
|
| 309 |
+
/**
|
| 310 |
+
* Convert full text to a viseme timeline scaled to a given audio duration
|
| 311 |
+
* @param {string} text - Full text to convert
|
| 312 |
+
* @param {number} audioDuration - Audio duration in seconds
|
| 313 |
+
* @returns {Object[]} Array of { time, viseme, duration, intensity }
|
| 314 |
+
*/
|
| 315 |
+
textToVisemes(text, audioDuration) {
|
| 316 |
+
this.init();
|
| 317 |
+
|
| 318 |
+
const processedText = this.preProcessText(text);
|
| 319 |
+
const words = processedText.split(/\s+/).filter(w => w.length > 0);
|
| 320 |
+
|
| 321 |
+
if (words.length === 0) return [];
|
| 322 |
+
|
| 323 |
+
// Build the full viseme sequence with relative timing
|
| 324 |
+
let allVisemes = [];
|
| 325 |
+
let totalRelativeTime = 0;
|
| 326 |
+
|
| 327 |
+
words.forEach((word, wi) => {
|
| 328 |
+
// Strip trailing punctuation — keep it for pause calculation but don't feed to viseme rules
|
| 329 |
+
const punctMatch = word.match(/[.,!?;:…]+$/);
|
| 330 |
+
const cleanWord = punctMatch ? word.slice(0, -punctMatch[0].length) : word;
|
| 331 |
+
const punct = punctMatch ? punctMatch[0] : '';
|
| 332 |
+
|
| 333 |
+
if (cleanWord.length > 0) {
|
| 334 |
+
const result = this.wordToVisemes(cleanWord);
|
| 335 |
+
if (result.visemes.length > 0) {
|
| 336 |
+
const wordDuration = result.times[result.visemes.length - 1] + result.durations[result.visemes.length - 1];
|
| 337 |
+
result.visemes.forEach((viseme, vi) => {
|
| 338 |
+
allVisemes.push({
|
| 339 |
+
viseme: viseme,
|
| 340 |
+
relTime: totalRelativeTime + result.times[vi],
|
| 341 |
+
relDuration: result.durations[vi]
|
| 342 |
+
});
|
| 343 |
+
});
|
| 344 |
+
totalRelativeTime += wordDuration;
|
| 345 |
+
}
|
| 346 |
+
}
|
| 347 |
+
|
| 348 |
+
// Punctuation-aware pauses — insert explicit silence viseme so mouth closes
|
| 349 |
+
let pauseDuration;
|
| 350 |
+
if (punct.includes('…') || punct.includes('...')) {
|
| 351 |
+
pauseDuration = 4.0;
|
| 352 |
+
} else if (punct.includes('.') || punct.includes('!') || punct.includes('?')) {
|
| 353 |
+
pauseDuration = 3.0;
|
| 354 |
+
} else if (punct.includes(',') || punct.includes(';') || punct.includes(':')) {
|
| 355 |
+
pauseDuration = 1.8;
|
| 356 |
+
} else {
|
| 357 |
+
pauseDuration = 0.8;
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
// Insert a silence viseme at the pause start so the mouth closes
|
| 361 |
+
allVisemes.push({
|
| 362 |
+
viseme: 'sil',
|
| 363 |
+
relTime: totalRelativeTime,
|
| 364 |
+
relDuration: pauseDuration
|
| 365 |
+
});
|
| 366 |
+
totalRelativeTime += pauseDuration;
|
| 367 |
+
});
|
| 368 |
+
|
| 369 |
+
if (allVisemes.length === 0 || totalRelativeTime === 0) return [];
|
| 370 |
+
|
| 371 |
+
// Scale relative times to actual audio duration
|
| 372 |
+
// Leave small margin at start and end for natural feel
|
| 373 |
+
const startMargin = 0.05; // 50ms
|
| 374 |
+
const endMargin = 0.15; // 150ms
|
| 375 |
+
const effectiveDuration = audioDuration - startMargin - endMargin;
|
| 376 |
+
const scale = effectiveDuration / totalRelativeTime;
|
| 377 |
+
|
| 378 |
+
const timeline = allVisemes.map(v => ({
|
| 379 |
+
time: startMargin + v.relTime * scale,
|
| 380 |
+
viseme: v.viseme,
|
| 381 |
+
duration: v.relDuration * scale,
|
| 382 |
+
// PP and FF are bilabial/labiodental — more visible
|
| 383 |
+
intensity: (v.viseme === 'PP' || v.viseme === 'FF') ? 0.9 : 0.7
|
| 384 |
+
}));
|
| 385 |
+
|
| 386 |
+
// Add initial and final silence
|
| 387 |
+
timeline.unshift({ time: 0, viseme: 'sil', duration: startMargin, intensity: 0 });
|
| 388 |
+
timeline.push({ time: audioDuration - endMargin, viseme: 'sil', duration: endMargin, intensity: 0 });
|
| 389 |
+
|
| 390 |
+
return timeline;
|
| 391 |
+
},
|
| 392 |
+
|
| 393 |
+
/**
|
| 394 |
+
* Get the active viseme at a given time from a timeline
|
| 395 |
+
* @param {Object[]} timeline - Viseme timeline from textToVisemes()
|
| 396 |
+
* @param {number} currentTime - Current audio playback time in seconds
|
| 397 |
+
* @returns {Object} { viseme, intensity, progress } where progress is 0-1 within the viseme
|
| 398 |
+
*/
|
| 399 |
+
getActiveViseme(timeline, currentTime) {
|
| 400 |
+
if (!timeline || timeline.length === 0) return { viseme: 'sil', intensity: 0, progress: 0 };
|
| 401 |
+
|
| 402 |
+
// Find the active viseme
|
| 403 |
+
let active = timeline[0];
|
| 404 |
+
for (let i = timeline.length - 1; i >= 0; i--) {
|
| 405 |
+
if (currentTime >= timeline[i].time) {
|
| 406 |
+
active = timeline[i];
|
| 407 |
+
break;
|
| 408 |
+
}
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
// Find the next viseme for blending
|
| 412 |
+
let nextIdx = -1;
|
| 413 |
+
for (let i = 0; i < timeline.length; i++) {
|
| 414 |
+
if (timeline[i].time > currentTime) {
|
| 415 |
+
nextIdx = i;
|
| 416 |
+
break;
|
| 417 |
+
}
|
| 418 |
+
}
|
| 419 |
+
|
| 420 |
+
const elapsed = currentTime - active.time;
|
| 421 |
+
const progress = active.duration > 0 ? Math.min(1, elapsed / active.duration) : 1;
|
| 422 |
+
|
| 423 |
+
// Envelope: quick attack, sustain, decay
|
| 424 |
+
let envelope;
|
| 425 |
+
if (progress < 0.15) {
|
| 426 |
+
// Attack phase — ramp up quickly
|
| 427 |
+
envelope = progress / 0.15;
|
| 428 |
+
} else if (progress < 0.7) {
|
| 429 |
+
// Sustain — full intensity
|
| 430 |
+
envelope = 1.0;
|
| 431 |
+
} else {
|
| 432 |
+
// Decay — ramp down
|
| 433 |
+
envelope = 1.0 - ((progress - 0.7) / 0.3);
|
| 434 |
+
}
|
| 435 |
+
envelope = Math.max(0, Math.min(1, envelope));
|
| 436 |
+
|
| 437 |
+
return {
|
| 438 |
+
viseme: active.viseme,
|
| 439 |
+
intensity: active.intensity * envelope,
|
| 440 |
+
progress: progress,
|
| 441 |
+
nextViseme: nextIdx >= 0 ? timeline[nextIdx].viseme : 'sil'
|
| 442 |
+
};
|
| 443 |
+
}
|
| 444 |
+
};
|
frontend/js/components/modal.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Modal Component
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
const Modal = {
|
| 6 |
+
container: null,
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* Initialize modal
|
| 10 |
+
*/
|
| 11 |
+
init() {
|
| 12 |
+
this.container = document.getElementById('modal-container');
|
| 13 |
+
},
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Open modal
|
| 17 |
+
*/
|
| 18 |
+
open(title, content, footer = '') {
|
| 19 |
+
if (!this.container) this.init();
|
| 20 |
+
|
| 21 |
+
document.getElementById('modal-title').textContent = title;
|
| 22 |
+
document.getElementById('modal-body').innerHTML = content;
|
| 23 |
+
document.getElementById('modal-footer').innerHTML = footer;
|
| 24 |
+
|
| 25 |
+
this.container.classList.remove('hidden');
|
| 26 |
+
document.body.style.overflow = 'hidden';
|
| 27 |
+
},
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Close modal
|
| 31 |
+
*/
|
| 32 |
+
close() {
|
| 33 |
+
if (!this.container) this.init();
|
| 34 |
+
|
| 35 |
+
this.container.classList.add('hidden');
|
| 36 |
+
document.body.style.overflow = '';
|
| 37 |
+
},
|
| 38 |
+
|
| 39 |
+
/**
|
| 40 |
+
* Confirm dialog
|
| 41 |
+
*/
|
| 42 |
+
confirm(title, message, onConfirm, confirmText = 'Confirm', danger = false) {
|
| 43 |
+
const content = `<p style="color: var(--gray-600);">${message}</p>`;
|
| 44 |
+
const footer = `
|
| 45 |
+
<button class="btn btn-secondary" onclick="Modal.close()">Cancel</button>
|
| 46 |
+
<button class="btn ${danger ? 'btn-danger' : 'btn-primary'}" id="modal-confirm-btn">${confirmText}</button>
|
| 47 |
+
`;
|
| 48 |
+
|
| 49 |
+
this.open(title, content, footer);
|
| 50 |
+
|
| 51 |
+
document.getElementById('modal-confirm-btn').addEventListener('click', () => {
|
| 52 |
+
onConfirm();
|
| 53 |
+
this.close();
|
| 54 |
+
});
|
| 55 |
+
},
|
| 56 |
+
|
| 57 |
+
/**
|
| 58 |
+
* Alert dialog
|
| 59 |
+
*/
|
| 60 |
+
alert(title, message) {
|
| 61 |
+
const content = `<p style="color: var(--gray-600);">${message}</p>`;
|
| 62 |
+
const footer = `<button class="btn btn-primary" onclick="Modal.close()">OK</button>`;
|
| 63 |
+
|
| 64 |
+
this.open(title, content, footer);
|
| 65 |
+
}
|
| 66 |
+
};
|
frontend/js/components/notifications.js
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Notification System
|
| 3 |
+
* In-app bell icon with real-time polling for shared agent activity
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
const Notifications = {
|
| 7 |
+
items: [],
|
| 8 |
+
readIds: new Set(),
|
| 9 |
+
pollInterval: null,
|
| 10 |
+
POLL_MS: 30000, // 30 seconds
|
| 11 |
+
|
| 12 |
+
init() {
|
| 13 |
+
// Load read notification IDs from localStorage
|
| 14 |
+
try {
|
| 15 |
+
const stored = localStorage.getItem('pf-notif-read');
|
| 16 |
+
this.readIds = new Set(JSON.parse(stored || '[]'));
|
| 17 |
+
} catch (e) {
|
| 18 |
+
this.readIds = new Set();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
this.injectBell();
|
| 22 |
+
this.poll();
|
| 23 |
+
this.pollInterval = setInterval(() => this.poll(), this.POLL_MS);
|
| 24 |
+
},
|
| 25 |
+
|
| 26 |
+
stop() {
|
| 27 |
+
if (this.pollInterval) {
|
| 28 |
+
clearInterval(this.pollInterval);
|
| 29 |
+
this.pollInterval = null;
|
| 30 |
+
}
|
| 31 |
+
},
|
| 32 |
+
|
| 33 |
+
injectBell() {
|
| 34 |
+
// Insert bell button into the sidebar header
|
| 35 |
+
const sidebarHeader = document.querySelector('.sidebar-header');
|
| 36 |
+
if (!sidebarHeader || document.getElementById('notif-bell')) return;
|
| 37 |
+
|
| 38 |
+
const bellWrapper = document.createElement('div');
|
| 39 |
+
bellWrapper.id = 'notif-bell-wrapper';
|
| 40 |
+
bellWrapper.style.cssText = 'position:relative;cursor:pointer;margin-left:auto;';
|
| 41 |
+
bellWrapper.innerHTML = `
|
| 42 |
+
<button id="notif-bell" title="Notifications" style="
|
| 43 |
+
background: none; border: none; cursor: pointer;
|
| 44 |
+
font-size: 1.2rem; padding: 0.25rem 0.4rem;
|
| 45 |
+
border-radius: 8px; transition: background 0.2s;
|
| 46 |
+
color: var(--gray-400, #9ca3af);
|
| 47 |
+
position: relative;
|
| 48 |
+
" onmouseover="this.style.background='var(--gray-100,#f3f4f6)'" onmouseout="this.style.background='none'"
|
| 49 |
+
onclick="Notifications.togglePanel()">
|
| 50 |
+
🔔
|
| 51 |
+
<span id="notif-badge" style="
|
| 52 |
+
position: absolute; top: -4px; right: -4px;
|
| 53 |
+
background: #ef4444; color: white;
|
| 54 |
+
font-size: 0.65rem; font-weight: 700;
|
| 55 |
+
border-radius: 999px; min-width: 16px; height: 16px;
|
| 56 |
+
display: none; align-items: center; justify-content: center;
|
| 57 |
+
line-height: 1; padding: 0 3px;
|
| 58 |
+
border: 2px solid var(--surface, white);
|
| 59 |
+
">0</span>
|
| 60 |
+
</button>
|
| 61 |
+
`;
|
| 62 |
+
|
| 63 |
+
sidebarHeader.appendChild(bellWrapper);
|
| 64 |
+
|
| 65 |
+
// ─────────────────────────────────────────────────────────────────
|
| 66 |
+
// IMPORTANT: attach the panel to <body> so it is NEVER clipped by
|
| 67 |
+
// the sidebar's overflow or width constraints. We position it
|
| 68 |
+
// dynamically via getBoundingClientRect() each time it opens.
|
| 69 |
+
// ─────────────────────────────────────────────────────────────────
|
| 70 |
+
const panel = document.createElement('div');
|
| 71 |
+
panel.id = 'notif-panel';
|
| 72 |
+
panel.style.cssText = `
|
| 73 |
+
display: none;
|
| 74 |
+
position: fixed;
|
| 75 |
+
width: 320px;
|
| 76 |
+
background: var(--surface, #ffffff);
|
| 77 |
+
border: 1px solid var(--gray-200, #e5e7eb);
|
| 78 |
+
border-radius: 14px;
|
| 79 |
+
box-shadow: 0 12px 48px rgba(0,0,0,0.18);
|
| 80 |
+
z-index: 99999;
|
| 81 |
+
overflow: hidden;
|
| 82 |
+
`;
|
| 83 |
+
panel.innerHTML = `
|
| 84 |
+
<div style="padding: 0.75rem 1rem; border-bottom: 1px solid var(--gray-100,#f3f4f6); display:flex; justify-content:space-between; align-items:center;">
|
| 85 |
+
<div style="font-weight: 600; font-size: 0.9rem; color: var(--gray-900,#111827);">Notifications</div>
|
| 86 |
+
<button onclick="Notifications.markAllRead()" style="background:none;border:none;cursor:pointer;font-size:0.75rem;color:var(--primary-500,#6366f1);font-weight:500;">
|
| 87 |
+
Mark all read
|
| 88 |
+
</button>
|
| 89 |
+
</div>
|
| 90 |
+
<div id="notif-list" style="max-height: 360px; overflow-y: auto;">
|
| 91 |
+
<div style="padding: 2rem; text-align: center; color: var(--gray-400,#9ca3af); font-size: 0.875rem;">
|
| 92 |
+
No notifications yet
|
| 93 |
+
</div>
|
| 94 |
+
</div>
|
| 95 |
+
`;
|
| 96 |
+
document.body.appendChild(panel);
|
| 97 |
+
|
| 98 |
+
// Close panel when clicking outside both the bell and the panel
|
| 99 |
+
document.addEventListener('click', (e) => {
|
| 100 |
+
const wrapper = document.getElementById('notif-bell-wrapper');
|
| 101 |
+
if (!wrapper?.contains(e.target) && !panel.contains(e.target)) {
|
| 102 |
+
panel.style.display = 'none';
|
| 103 |
+
}
|
| 104 |
+
});
|
| 105 |
+
},
|
| 106 |
+
|
| 107 |
+
async poll() {
|
| 108 |
+
try {
|
| 109 |
+
const data = await API.get('/notifications');
|
| 110 |
+
this.items = data.notifications || [];
|
| 111 |
+
this.renderBadge();
|
| 112 |
+
} catch (e) {
|
| 113 |
+
// Silently ignore polling failures
|
| 114 |
+
}
|
| 115 |
+
},
|
| 116 |
+
|
| 117 |
+
renderBadge() {
|
| 118 |
+
const unread = this.items.filter(n => !this.readIds.has(n.id));
|
| 119 |
+
const badge = document.getElementById('notif-badge');
|
| 120 |
+
if (!badge) return;
|
| 121 |
+
|
| 122 |
+
if (unread.length > 0) {
|
| 123 |
+
badge.style.display = 'flex';
|
| 124 |
+
badge.textContent = unread.length > 9 ? '9+' : unread.length;
|
| 125 |
+
} else {
|
| 126 |
+
badge.style.display = 'none';
|
| 127 |
+
}
|
| 128 |
+
},
|
| 129 |
+
|
| 130 |
+
togglePanel() {
|
| 131 |
+
const panel = document.getElementById('notif-panel');
|
| 132 |
+
const bell = document.getElementById('notif-bell');
|
| 133 |
+
if (!panel || !bell) return;
|
| 134 |
+
|
| 135 |
+
const isOpen = panel.style.display === 'block';
|
| 136 |
+
|
| 137 |
+
if (isOpen) {
|
| 138 |
+
panel.style.display = 'none';
|
| 139 |
+
return;
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
// ── Position the panel relative to the bell button's screen rect ──
|
| 143 |
+
const rect = bell.getBoundingClientRect();
|
| 144 |
+
const panelWidth = 320;
|
| 145 |
+
const margin = 8; // gap between bell and panel top edge
|
| 146 |
+
|
| 147 |
+
// Place the panel just below the bell
|
| 148 |
+
let top = rect.bottom + margin;
|
| 149 |
+
// Align left edge of panel with left edge of bell (then clamp to viewport)
|
| 150 |
+
let left = rect.left;
|
| 151 |
+
|
| 152 |
+
// If it would overflow the right edge of the viewport, shift left
|
| 153 |
+
if (left + panelWidth > window.innerWidth - 12) {
|
| 154 |
+
left = window.innerWidth - panelWidth - 12;
|
| 155 |
+
}
|
| 156 |
+
// Never go off-screen left
|
| 157 |
+
if (left < 8) left = 8;
|
| 158 |
+
|
| 159 |
+
// If it would overflow the bottom, open upward instead
|
| 160 |
+
const panelMaxHeight = 420; // header + list max-height
|
| 161 |
+
if (top + panelMaxHeight > window.innerHeight) {
|
| 162 |
+
top = rect.top - panelMaxHeight - margin;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
panel.style.top = `${top}px`;
|
| 166 |
+
panel.style.left = `${left}px`;
|
| 167 |
+
panel.style.display = 'block';
|
| 168 |
+
|
| 169 |
+
this.renderPanel();
|
| 170 |
+
},
|
| 171 |
+
|
| 172 |
+
renderPanel() {
|
| 173 |
+
const list = document.getElementById('notif-list');
|
| 174 |
+
if (!list) return;
|
| 175 |
+
|
| 176 |
+
if (this.items.length === 0) {
|
| 177 |
+
list.innerHTML = `
|
| 178 |
+
<div style="padding: 2rem; text-align: center; color: var(--gray-400,#9ca3af); font-size: 0.875rem;">
|
| 179 |
+
<div style="font-size: 1.5rem; margin-bottom: 0.5rem;">🔔</div>
|
| 180 |
+
No notifications yet
|
| 181 |
+
</div>
|
| 182 |
+
`;
|
| 183 |
+
return;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
list.innerHTML = this.items.map(n => {
|
| 187 |
+
const isRead = this.readIds.has(n.id);
|
| 188 |
+
return `
|
| 189 |
+
<div onclick="Notifications.handleClick('${n.id}', '${n.link || ''}')" style="
|
| 190 |
+
padding: 0.75rem 1rem;
|
| 191 |
+
border-bottom: 1px solid var(--gray-50,#f9fafb);
|
| 192 |
+
cursor: pointer;
|
| 193 |
+
display: flex; gap: 0.75rem; align-items: flex-start;
|
| 194 |
+
background: ${isRead ? 'transparent' : 'var(--primary-50,#eef2ff)'};
|
| 195 |
+
transition: background 0.15s;
|
| 196 |
+
" onmouseover="this.style.background='var(--gray-50,#f9fafb)'" onmouseout="this.style.background='${isRead ? 'transparent' : 'var(--primary-50,#eef2ff)'}'"">
|
| 197 |
+
<div style="font-size: 1.3rem; flex-shrink: 0;">${n.icon || '🔔'}</div>
|
| 198 |
+
<div style="flex: 1; min-width: 0;">
|
| 199 |
+
<div style="font-weight: ${isRead ? '400' : '600'}; font-size: 0.85rem; color: var(--gray-900,#111827); margin-bottom: 0.1rem;">
|
| 200 |
+
${n.title}
|
| 201 |
+
</div>
|
| 202 |
+
<div style="font-size: 0.75rem; color: var(--gray-500,#6b7280); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
| 203 |
+
${n.message}
|
| 204 |
+
</div>
|
| 205 |
+
<div style="font-size: 0.7rem; color: var(--gray-400,#9ca3af); margin-top: 0.2rem;">
|
| 206 |
+
${this.timeAgo(n.timestamp)}
|
| 207 |
+
</div>
|
| 208 |
+
</div>
|
| 209 |
+
${!isRead ? `<div style="width: 8px; height: 8px; border-radius: 50%; background: var(--primary-500,#6366f1); flex-shrink: 0; margin-top: 0.3rem;"></div>` : ''}
|
| 210 |
+
</div>
|
| 211 |
+
`;
|
| 212 |
+
}).join('');
|
| 213 |
+
},
|
| 214 |
+
|
| 215 |
+
handleClick(id, link) {
|
| 216 |
+
this.markRead(id);
|
| 217 |
+
if (link) {
|
| 218 |
+
document.getElementById('notif-panel').style.display = 'none';
|
| 219 |
+
Router.navigate(link);
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
|
| 223 |
+
markRead(id) {
|
| 224 |
+
this.readIds.add(id);
|
| 225 |
+
this.saveReadIds();
|
| 226 |
+
this.renderBadge();
|
| 227 |
+
this.renderPanel();
|
| 228 |
+
},
|
| 229 |
+
|
| 230 |
+
markAllRead() {
|
| 231 |
+
this.items.forEach(n => this.readIds.add(n.id));
|
| 232 |
+
this.saveReadIds();
|
| 233 |
+
this.renderBadge();
|
| 234 |
+
this.renderPanel();
|
| 235 |
+
},
|
| 236 |
+
|
| 237 |
+
saveReadIds() {
|
| 238 |
+
try {
|
| 239 |
+
localStorage.setItem('pf-notif-read', JSON.stringify([...this.readIds]));
|
| 240 |
+
} catch (e) { }
|
| 241 |
+
},
|
| 242 |
+
|
| 243 |
+
timeAgo(ts) {
|
| 244 |
+
if (!ts) return '';
|
| 245 |
+
const diff = Date.now() - new Date(ts).getTime();
|
| 246 |
+
const mins = Math.floor(diff / 60000);
|
| 247 |
+
if (mins < 1) return 'just now';
|
| 248 |
+
if (mins < 60) return `${mins}m ago`;
|
| 249 |
+
const hrs = Math.floor(mins / 60);
|
| 250 |
+
if (hrs < 24) return `${hrs}h ago`;
|
| 251 |
+
return `${Math.floor(hrs / 24)}d ago`;
|
| 252 |
+
}
|
| 253 |
+
};
|
frontend/js/components/onboarding.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Onboarding Flow
|
| 3 |
+
* Multi-step welcome modal shown once to new users
|
| 4 |
+
*/
|
| 5 |
+
|
| 6 |
+
const Onboarding = {
|
| 7 |
+
currentStep: 0,
|
| 8 |
+
steps: [
|
| 9 |
+
{
|
| 10 |
+
icon: '🎉',
|
| 11 |
+
title: 'Welcome to PersonaFlow!',
|
| 12 |
+
desc: 'You\'re about to build your first AI conversation agent. It takes less than 2 minutes and no technical knowledge required.',
|
| 13 |
+
visual: `<div style="display:flex;gap:1rem;justify-content:center;flex-wrap:wrap;margin-top:1rem;">
|
| 14 |
+
<div style="background:var(--primary-50,#eef2ff);border-radius:12px;padding:1rem;text-align:center;flex:1;min-width:100px;">
|
| 15 |
+
<div style="font-size:1.75rem;margin-bottom:0.5rem;">🤖</div>
|
| 16 |
+
<div style="font-size:0.75rem;font-weight:600;color:var(--primary-600,#4f46e5);">Create Agents</div>
|
| 17 |
+
</div>
|
| 18 |
+
<div style="background:var(--primary-50,#eef2ff);border-radius:12px;padding:1rem;text-align:center;flex:1;min-width:100px;">
|
| 19 |
+
<div style="font-size:1.75rem;margin-bottom:0.5rem;">💬</div>
|
| 20 |
+
<div style="font-size:0.75rem;font-weight:600;color:var(--primary-600,#4f46e5);">Chat & Video Call</div>
|
| 21 |
+
</div>
|
| 22 |
+
<div style="background:var(--primary-50,#eef2ff);border-radius:12px;padding:1rem;text-align:center;flex:1;min-width:100px;">
|
| 23 |
+
<div style="font-size:1.75rem;margin-bottom:0.5rem;">📊</div>
|
| 24 |
+
<div style="font-size:0.75rem;font-weight:600;color:var(--primary-600,#4f46e5);">Get Reports</div>
|
| 25 |
+
</div>
|
| 26 |
+
</div>`
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
icon: '🤖',
|
| 30 |
+
title: 'What is an AI Agent?',
|
| 31 |
+
desc: 'An agent is an AI persona with a specific role, personality, and purpose — like a Sales Coach, Customer Support Rep, or Interview Trainer.',
|
| 32 |
+
visual: `<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1.25rem;margin-top:1rem;border:1px solid var(--gray-200,#e5e7eb);">
|
| 33 |
+
<div style="font-weight:600;margin-bottom:0.75rem;color:var(--gray-700,#374151);">Example: Sales Coach Agent</div>
|
| 34 |
+
<div style="display:flex;gap:0.75rem;align-items:flex-start;margin-bottom:0.75rem;">
|
| 35 |
+
<div style="width:36px;height:36px;border-radius:50%;background:#6366f1;display:flex;align-items:center;justify-content:center;font-size:1.1rem;flex-shrink:0;">💼</div>
|
| 36 |
+
<div style="background:#6366f120;padding:0.75rem;border-radius:8px;font-size:0.85rem;color:var(--gray-700,#374151);">
|
| 37 |
+
"Tell me about your product. I'm looking for something to solve our reporting problem..."
|
| 38 |
+
</div>
|
| 39 |
+
</div>
|
| 40 |
+
<div style="display:flex;gap:0.75rem;align-items:flex-start;justify-content:flex-end;">
|
| 41 |
+
<div style="background:var(--primary-500,#6366f1);padding:0.75rem;border-radius:8px;font-size:0.85rem;color:white;max-width:75%;">
|
| 42 |
+
"Sure! Our platform integrates with all your existing tools and cuts report time by 80%..."
|
| 43 |
+
</div>
|
| 44 |
+
</div>
|
| 45 |
+
</div>`
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
icon: '🚀',
|
| 49 |
+
title: 'Three ways to start',
|
| 50 |
+
desc: 'Create an agent from scratch, use a pre-built template, or use the shared link someone sent you.',
|
| 51 |
+
visual: `<div style="display:flex;flex-direction:column;gap:0.75rem;margin-top:1rem;">
|
| 52 |
+
<div style="display:flex;gap:0.75rem;align-items:center;padding:0.75rem;background:var(--gray-50,#f9fafb);border-radius:10px;border:1px solid var(--gray-200,#e5e7eb);">
|
| 53 |
+
<div style="font-size:1.5rem;">✨</div>
|
| 54 |
+
<div>
|
| 55 |
+
<div style="font-weight:600;font-size:0.875rem;">Templates</div>
|
| 56 |
+
<div style="font-size:0.8rem;color:var(--gray-500,#6b7280);">Start with Sales Coach, Interview Prep, and more — ready in 1 click</div>
|
| 57 |
+
</div>
|
| 58 |
+
</div>
|
| 59 |
+
<div style="display:flex;gap:0.75rem;align-items:center;padding:0.75rem;background:var(--gray-50,#f9fafb);border-radius:10px;border:1px solid var(--gray-200,#e5e7eb);">
|
| 60 |
+
<div style="font-size:1.5rem;">🛠️</div>
|
| 61 |
+
<div>
|
| 62 |
+
<div style="font-weight:600;font-size:0.875rem;">Build from Scratch</div>
|
| 63 |
+
<div style="font-size:0.8rem;color:var(--gray-500,#6b7280);">Full 4-step wizard to define role, behavior, output & appearance</div>
|
| 64 |
+
</div>
|
| 65 |
+
</div>
|
| 66 |
+
<div style="display:flex;gap:0.75rem;align-items:center;padding:0.75rem;background:var(--gray-50,#f9fafb);border-radius:10px;border:1px solid var(--gray-200,#e5e7eb);">
|
| 67 |
+
<div style="font-size:1.5rem;">🔗</div>
|
| 68 |
+
<div>
|
| 69 |
+
<div style="font-weight:600;font-size:0.875rem;">Share Links</div>
|
| 70 |
+
<div style="font-size:0.8rem;color:var(--gray-500,#6b7280);">Share any agent via a link — with password, expiry & usage limits</div>
|
| 71 |
+
</div>
|
| 72 |
+
</div>
|
| 73 |
+
</div>`
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
icon: '🎊',
|
| 77 |
+
title: 'You\'re all set!',
|
| 78 |
+
desc: 'Let\'s create your first agent. Try a template for the fastest start, or build one from scratch.',
|
| 79 |
+
visual: `<div style="display:flex;gap:1rem;margin-top:1.5rem;flex-wrap:wrap;">
|
| 80 |
+
<a href="#/templates" onclick="Onboarding.finish()" class="btn btn-primary" style="flex:1;justify-content:center;text-align:center;text-decoration:none;">
|
| 81 |
+
✨ Browse Templates
|
| 82 |
+
</a>
|
| 83 |
+
<a href="#/agents/new" onclick="Onboarding.finish()" class="btn btn-secondary" style="flex:1;justify-content:center;text-align:center;text-decoration:none;">
|
| 84 |
+
🛠️ Build from Scratch
|
| 85 |
+
</a>
|
| 86 |
+
</div>`
|
| 87 |
+
}
|
| 88 |
+
],
|
| 89 |
+
|
| 90 |
+
shouldShow() {
|
| 91 |
+
return !localStorage.getItem('pf-onboarded');
|
| 92 |
+
},
|
| 93 |
+
|
| 94 |
+
show() {
|
| 95 |
+
if (!this.shouldShow()) return;
|
| 96 |
+
this.currentStep = 0;
|
| 97 |
+
this.renderModal();
|
| 98 |
+
},
|
| 99 |
+
|
| 100 |
+
renderModal() {
|
| 101 |
+
// Dismiss any existing onboarding modal first
|
| 102 |
+
document.getElementById('onboarding-overlay')?.remove();
|
| 103 |
+
|
| 104 |
+
const step = this.steps[this.currentStep];
|
| 105 |
+
const total = this.steps.length;
|
| 106 |
+
const isLast = this.currentStep === total - 1;
|
| 107 |
+
|
| 108 |
+
const overlay = document.createElement('div');
|
| 109 |
+
overlay.id = 'onboarding-overlay';
|
| 110 |
+
overlay.style.cssText = `
|
| 111 |
+
position: fixed; inset: 0; z-index: 9999;
|
| 112 |
+
background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
|
| 113 |
+
display: flex; align-items: center; justify-content: center;
|
| 114 |
+
animation: fadeIn 0.2s ease;
|
| 115 |
+
`;
|
| 116 |
+
|
| 117 |
+
overlay.innerHTML = `
|
| 118 |
+
<div style="
|
| 119 |
+
background: var(--surface, #ffffff);
|
| 120 |
+
border-radius: 20px;
|
| 121 |
+
padding: 2rem;
|
| 122 |
+
max-width: 480px;
|
| 123 |
+
width: calc(100% - 2rem);
|
| 124 |
+
box-shadow: 0 25px 60px rgba(0,0,0,0.3);
|
| 125 |
+
animation: slideUp 0.3s ease;
|
| 126 |
+
position: relative;
|
| 127 |
+
">
|
| 128 |
+
<!-- Skip button -->
|
| 129 |
+
<button onclick="Onboarding.finish()" style="
|
| 130 |
+
position: absolute; top: 1rem; right: 1rem;
|
| 131 |
+
background: none; border: none; color: var(--gray-400,#9ca3af);
|
| 132 |
+
cursor: pointer; font-size: 0.85rem; padding: 0.25rem 0.5rem;
|
| 133 |
+
border-radius: 6px; transition: background 0.2s;
|
| 134 |
+
" onmouseover="this.style.background='var(--gray-100,#f3f4f6)'" onmouseout="this.style.background='none'">
|
| 135 |
+
Skip ✕
|
| 136 |
+
</button>
|
| 137 |
+
|
| 138 |
+
<!-- Step indicator dots -->
|
| 139 |
+
<div style="display:flex;gap:0.4rem;justify-content:center;margin-bottom:1.5rem;">
|
| 140 |
+
${this.steps.map((_, i) => `
|
| 141 |
+
<div style="
|
| 142 |
+
width: ${i === this.currentStep ? '24px' : '8px'};
|
| 143 |
+
height: 8px;
|
| 144 |
+
border-radius: 4px;
|
| 145 |
+
background: ${i === this.currentStep ? 'var(--primary-500,#6366f1)' : 'var(--gray-200,#e5e7eb)'};
|
| 146 |
+
transition: all 0.3s ease;
|
| 147 |
+
"></div>
|
| 148 |
+
`).join('')}
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<!-- Icon -->
|
| 152 |
+
<div style="text-align:center;font-size:3rem;margin-bottom:1rem;">${step.icon}</div>
|
| 153 |
+
|
| 154 |
+
<!-- Title -->
|
| 155 |
+
<h2 style="text-align:center;margin:0 0 0.75rem;font-size:1.4rem;font-weight:700;color:var(--gray-900,#111827);">
|
| 156 |
+
${step.title}
|
| 157 |
+
</h2>
|
| 158 |
+
|
| 159 |
+
<!-- Description -->
|
| 160 |
+
<p style="text-align:center;color:var(--gray-500,#6b7280);margin:0 0 0.5rem;line-height:1.6;">
|
| 161 |
+
${step.desc}
|
| 162 |
+
</p>
|
| 163 |
+
|
| 164 |
+
<!-- Visual content -->
|
| 165 |
+
${step.visual}
|
| 166 |
+
|
| 167 |
+
<!-- Navigation -->
|
| 168 |
+
${!isLast ? `
|
| 169 |
+
<div style="display:flex;justify-content:space-between;align-items:center;margin-top:1.5rem;">
|
| 170 |
+
<button onclick="Onboarding.prev()"
|
| 171 |
+
style="background:none;border:none;cursor:pointer;color:var(--gray-400,#9ca3af);font-size:0.875rem;padding:0.5rem;${this.currentStep === 0 ? 'visibility:hidden' : ''}"
|
| 172 |
+
>
|
| 173 |
+
← Back
|
| 174 |
+
</button>
|
| 175 |
+
<button onclick="Onboarding.next()" class="btn btn-primary">
|
| 176 |
+
Next →
|
| 177 |
+
</button>
|
| 178 |
+
</div>
|
| 179 |
+
` : ''}
|
| 180 |
+
</div>
|
| 181 |
+
`;
|
| 182 |
+
|
| 183 |
+
document.body.appendChild(overlay);
|
| 184 |
+
|
| 185 |
+
// Close on backdrop click
|
| 186 |
+
overlay.addEventListener('click', (e) => {
|
| 187 |
+
if (e.target === overlay) this.finish();
|
| 188 |
+
});
|
| 189 |
+
},
|
| 190 |
+
|
| 191 |
+
next() {
|
| 192 |
+
if (this.currentStep < this.steps.length - 1) {
|
| 193 |
+
this.currentStep++;
|
| 194 |
+
this.renderModal();
|
| 195 |
+
}
|
| 196 |
+
},
|
| 197 |
+
|
| 198 |
+
prev() {
|
| 199 |
+
if (this.currentStep > 0) {
|
| 200 |
+
this.currentStep--;
|
| 201 |
+
this.renderModal();
|
| 202 |
+
}
|
| 203 |
+
},
|
| 204 |
+
|
| 205 |
+
finish() {
|
| 206 |
+
localStorage.setItem('pf-onboarded', '1');
|
| 207 |
+
const overlay = document.getElementById('onboarding-overlay');
|
| 208 |
+
if (overlay) {
|
| 209 |
+
overlay.style.animation = 'fadeOut 0.2s ease forwards';
|
| 210 |
+
setTimeout(() => overlay.remove(), 200);
|
| 211 |
+
}
|
| 212 |
+
}
|
| 213 |
+
};
|
frontend/js/components/sidebar.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Sidebar Component
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
const Sidebar = {
|
| 6 |
+
element: null,
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* Initialize sidebar
|
| 10 |
+
*/
|
| 11 |
+
init() {
|
| 12 |
+
this.element = document.getElementById('sidebar');
|
| 13 |
+
this.initDarkMode();
|
| 14 |
+
},
|
| 15 |
+
|
| 16 |
+
/**
|
| 17 |
+
* Show sidebar
|
| 18 |
+
*/
|
| 19 |
+
show() {
|
| 20 |
+
if (!this.element) this.init();
|
| 21 |
+
this.element.classList.remove('hidden');
|
| 22 |
+
},
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Hide sidebar
|
| 26 |
+
*/
|
| 27 |
+
hide() {
|
| 28 |
+
if (!this.element) this.init();
|
| 29 |
+
this.element.classList.add('hidden');
|
| 30 |
+
},
|
| 31 |
+
|
| 32 |
+
/**
|
| 33 |
+
* Set active nav item
|
| 34 |
+
*/
|
| 35 |
+
setActive(page) {
|
| 36 |
+
const navItems = document.querySelectorAll('.nav-item');
|
| 37 |
+
navItems.forEach(item => {
|
| 38 |
+
const itemPage = item.dataset.page;
|
| 39 |
+
if (itemPage === page || (page === 'agent-detail' && itemPage === 'agents')) {
|
| 40 |
+
item.classList.add('active');
|
| 41 |
+
} else {
|
| 42 |
+
item.classList.remove('active');
|
| 43 |
+
}
|
| 44 |
+
});
|
| 45 |
+
},
|
| 46 |
+
|
| 47 |
+
/**
|
| 48 |
+
* Update user info
|
| 49 |
+
*/
|
| 50 |
+
updateUser(user) {
|
| 51 |
+
const avatar = document.getElementById('user-avatar');
|
| 52 |
+
const name = document.getElementById('user-name');
|
| 53 |
+
const email = document.getElementById('user-email');
|
| 54 |
+
|
| 55 |
+
if (avatar && user) {
|
| 56 |
+
avatar.textContent = App.getInitials(user.name);
|
| 57 |
+
avatar.style.backgroundColor = user.avatar_color;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
if (name && user) {
|
| 61 |
+
name.textContent = user.name;
|
| 62 |
+
}
|
| 63 |
+
|
| 64 |
+
if (email && user) {
|
| 65 |
+
email.textContent = user.email || '';
|
| 66 |
+
}
|
| 67 |
+
},
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Initialize dark mode from localStorage and bind toggle
|
| 71 |
+
*/
|
| 72 |
+
initDarkMode() {
|
| 73 |
+
const saved = localStorage.getItem('personaflow-theme');
|
| 74 |
+
const toggle = document.getElementById('dark-mode-toggle');
|
| 75 |
+
const icon = document.getElementById('dark-mode-icon');
|
| 76 |
+
|
| 77 |
+
if (saved === 'dark') {
|
| 78 |
+
document.documentElement.setAttribute('data-theme', 'dark');
|
| 79 |
+
if (toggle) toggle.classList.add('active');
|
| 80 |
+
if (icon) { icon.classList.remove('fa-moon'); icon.classList.add('fa-sun'); }
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
if (toggle) {
|
| 84 |
+
toggle.addEventListener('click', () => this.toggleDarkMode());
|
| 85 |
+
}
|
| 86 |
+
},
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Toggle dark mode on/off
|
| 90 |
+
*/
|
| 91 |
+
toggleDarkMode() {
|
| 92 |
+
const html = document.documentElement;
|
| 93 |
+
const toggle = document.getElementById('dark-mode-toggle');
|
| 94 |
+
const icon = document.getElementById('dark-mode-icon');
|
| 95 |
+
const isDark = html.getAttribute('data-theme') === 'dark';
|
| 96 |
+
|
| 97 |
+
if (isDark) {
|
| 98 |
+
html.removeAttribute('data-theme');
|
| 99 |
+
localStorage.setItem('personaflow-theme', 'light');
|
| 100 |
+
if (toggle) toggle.classList.remove('active');
|
| 101 |
+
if (icon) { icon.classList.remove('fa-sun'); icon.classList.add('fa-moon'); }
|
| 102 |
+
} else {
|
| 103 |
+
html.setAttribute('data-theme', 'dark');
|
| 104 |
+
localStorage.setItem('personaflow-theme', 'dark');
|
| 105 |
+
if (toggle) toggle.classList.add('active');
|
| 106 |
+
if (icon) { icon.classList.add('fa-sun'); icon.classList.remove('fa-moon'); }
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
};
|
frontend/js/components/three-converter.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Three.js Animation Converter
|
| 3 |
+
* Converts blendshape data into Three.js AnimationClip objects
|
| 4 |
+
* Ported from 3d/src/converter.js (React version) to vanilla JS
|
| 5 |
+
*/
|
| 6 |
+
|
| 7 |
+
const ThreeConverter = {
|
| 8 |
+
fps: 60,
|
| 9 |
+
|
| 10 |
+
modifiedKey(key) {
|
| 11 |
+
const eyeKeys = [
|
| 12 |
+
"eyeLookDownLeft", "eyeLookDownRight", "eyeLookInLeft", "eyeLookInRight",
|
| 13 |
+
"eyeLookOutLeft", "eyeLookOutRight", "eyeLookUpLeft", "eyeLookUpRight"
|
| 14 |
+
];
|
| 15 |
+
if (eyeKeys.includes(key)) return key;
|
| 16 |
+
if (key.endsWith("Right")) return key.replace("Right", "_R");
|
| 17 |
+
if (key.endsWith("Left")) return key.replace("Left", "_L");
|
| 18 |
+
return key;
|
| 19 |
+
},
|
| 20 |
+
|
| 21 |
+
createAnimation(recordedData, morphTargetDictionary, bodyPart) {
|
| 22 |
+
if (!recordedData || recordedData.length === 0 || !morphTargetDictionary) return null;
|
| 23 |
+
|
| 24 |
+
const animation = [];
|
| 25 |
+
for (let i = 0; i < Object.keys(morphTargetDictionary).length; i++) {
|
| 26 |
+
animation.push([]);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
const time = [];
|
| 30 |
+
let finishedFrames = 0;
|
| 31 |
+
|
| 32 |
+
recordedData.forEach((d) => {
|
| 33 |
+
if (!d.blendshapes) return;
|
| 34 |
+
Object.entries(d.blendshapes).forEach(([key, value]) => {
|
| 35 |
+
const modKey = this.modifiedKey(key);
|
| 36 |
+
if (!(modKey in morphTargetDictionary)) return;
|
| 37 |
+
if (key === 'mouthShrugUpper') value += 0.4;
|
| 38 |
+
animation[morphTargetDictionary[modKey]].push(value);
|
| 39 |
+
});
|
| 40 |
+
time.push(finishedFrames / this.fps);
|
| 41 |
+
finishedFrames++;
|
| 42 |
+
});
|
| 43 |
+
|
| 44 |
+
const tracks = [];
|
| 45 |
+
|
| 46 |
+
Object.entries(recordedData[0].blendshapes).forEach(([key]) => {
|
| 47 |
+
const modKey = this.modifiedKey(key);
|
| 48 |
+
if (!(modKey in morphTargetDictionary)) return;
|
| 49 |
+
|
| 50 |
+
const i = morphTargetDictionary[modKey];
|
| 51 |
+
if (!animation[i] || animation[i].length === 0) return;
|
| 52 |
+
|
| 53 |
+
const track = new THREE.NumberKeyframeTrack(
|
| 54 |
+
`${bodyPart}.morphTargetInfluences[${i}]`,
|
| 55 |
+
time,
|
| 56 |
+
animation[i]
|
| 57 |
+
);
|
| 58 |
+
tracks.push(track);
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
+
if (tracks.length === 0) return null;
|
| 62 |
+
return new THREE.AnimationClip('animation', -1, tracks);
|
| 63 |
+
}
|
| 64 |
+
};
|
frontend/js/components/toast.js
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Toast Notification Component
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
const Toast = {
|
| 6 |
+
container: null,
|
| 7 |
+
|
| 8 |
+
/**
|
| 9 |
+
* Initialize toast container
|
| 10 |
+
*/
|
| 11 |
+
init() {
|
| 12 |
+
this.container = document.getElementById('toast-container');
|
| 13 |
+
},
|
| 14 |
+
|
| 15 |
+
/**
|
| 16 |
+
* Show toast notification
|
| 17 |
+
*/
|
| 18 |
+
show(type, title, message = '', duration = 4000) {
|
| 19 |
+
if (!this.container) this.init();
|
| 20 |
+
|
| 21 |
+
const icons = {
|
| 22 |
+
success: '✓',
|
| 23 |
+
error: '✕',
|
| 24 |
+
warning: '⚠',
|
| 25 |
+
info: 'ℹ'
|
| 26 |
+
};
|
| 27 |
+
|
| 28 |
+
const toast = document.createElement('div');
|
| 29 |
+
toast.className = `toast toast-${type}`;
|
| 30 |
+
toast.innerHTML = `
|
| 31 |
+
<span class="toast-icon">${icons[type] || 'ℹ'}</span>
|
| 32 |
+
<div class="toast-content">
|
| 33 |
+
<div class="toast-title">${title}</div>
|
| 34 |
+
${message ? `<div class="toast-message">${message}</div>` : ''}
|
| 35 |
+
</div>
|
| 36 |
+
<button class="toast-close">×</button>
|
| 37 |
+
`;
|
| 38 |
+
|
| 39 |
+
this.container.appendChild(toast);
|
| 40 |
+
|
| 41 |
+
// Close button
|
| 42 |
+
toast.querySelector('.toast-close').addEventListener('click', () => {
|
| 43 |
+
this.remove(toast);
|
| 44 |
+
});
|
| 45 |
+
|
| 46 |
+
// Auto dismiss
|
| 47 |
+
if (duration > 0) {
|
| 48 |
+
setTimeout(() => this.remove(toast), duration);
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
return toast;
|
| 52 |
+
},
|
| 53 |
+
|
| 54 |
+
/**
|
| 55 |
+
* Remove toast
|
| 56 |
+
*/
|
| 57 |
+
remove(toast) {
|
| 58 |
+
toast.style.animation = 'slideInRight 0.3s ease reverse';
|
| 59 |
+
setTimeout(() => toast.remove(), 300);
|
| 60 |
+
},
|
| 61 |
+
|
| 62 |
+
/**
|
| 63 |
+
* Success toast
|
| 64 |
+
*/
|
| 65 |
+
success(title, message = '') {
|
| 66 |
+
return this.show('success', title, message);
|
| 67 |
+
},
|
| 68 |
+
|
| 69 |
+
/**
|
| 70 |
+
* Error toast
|
| 71 |
+
*/
|
| 72 |
+
error(title, message = '') {
|
| 73 |
+
return this.show('error', title, message);
|
| 74 |
+
},
|
| 75 |
+
|
| 76 |
+
/**
|
| 77 |
+
* Warning toast
|
| 78 |
+
*/
|
| 79 |
+
warning(title, message = '') {
|
| 80 |
+
return this.show('warning', title, message);
|
| 81 |
+
},
|
| 82 |
+
|
| 83 |
+
/**
|
| 84 |
+
* Info toast
|
| 85 |
+
*/
|
| 86 |
+
info(title, message = '') {
|
| 87 |
+
return this.show('info', title, message);
|
| 88 |
+
}
|
| 89 |
+
};
|
frontend/js/pages/agent-detail.js
ADDED
|
@@ -0,0 +1,838 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Agent Detail Page
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
const AgentDetailPage = {
|
| 6 |
+
agent: null,
|
| 7 |
+
activeTab: 'settings',
|
| 8 |
+
// Report Chat state — persisted per agent across tab navigation
|
| 9 |
+
_rcHistoryCache: {}, // { [agentId]: [{role, content}] }
|
| 10 |
+
_rcAgentId: null,
|
| 11 |
+
|
| 12 |
+
get _rcHistory() {
|
| 13 |
+
const id = this._rcAgentId;
|
| 14 |
+
if (!id) return [];
|
| 15 |
+
if (!this._rcHistoryCache[id]) this._rcHistoryCache[id] = [];
|
| 16 |
+
return this._rcHistoryCache[id];
|
| 17 |
+
},
|
| 18 |
+
set _rcHistory(val) {
|
| 19 |
+
if (this._rcAgentId) this._rcHistoryCache[this._rcAgentId] = val;
|
| 20 |
+
},
|
| 21 |
+
|
| 22 |
+
async render(container, agentId) {
|
| 23 |
+
this.agent = null;
|
| 24 |
+
this.activeTab = 'settings';
|
| 25 |
+
// Update report chat agent ID (but preserve history cache)
|
| 26 |
+
|
| 27 |
+
container.innerHTML = `
|
| 28 |
+
<div class="empty-state">
|
| 29 |
+
<div class="spinner"></div>
|
| 30 |
+
</div>
|
| 31 |
+
`;
|
| 32 |
+
|
| 33 |
+
try {
|
| 34 |
+
const { agent } = await API.get(`/agents/${agentId}`);
|
| 35 |
+
this.agent = agent;
|
| 36 |
+
this.renderContent(container);
|
| 37 |
+
} catch (error) {
|
| 38 |
+
Toast.error('Failed to load agent');
|
| 39 |
+
Router.navigate('/agents');
|
| 40 |
+
}
|
| 41 |
+
},
|
| 42 |
+
|
| 43 |
+
renderContent(container) {
|
| 44 |
+
container.innerHTML = `
|
| 45 |
+
<div class="page-header">
|
| 46 |
+
<div class="flex items-center gap-4">
|
| 47 |
+
<div class="agent-icon" style="width: 64px; height: 64px; background: ${this.agent.color}; font-size: 2rem;">${this.agent.icon}</div>
|
| 48 |
+
<div>
|
| 49 |
+
<h1 class="page-title">${this.agent.name}</h1>
|
| 50 |
+
<p class="page-subtitle">${this.agent.role}</p>
|
| 51 |
+
</div>
|
| 52 |
+
<span class="badge ${this.agent.status}" style="margin-left: 1rem;">${this.agent.status}</span>
|
| 53 |
+
${this.agent.agent_type === 'anchoring' ? '<span class="badge" style="margin-left:0.5rem;background:linear-gradient(135deg,#f59e0b,#f97316);color:#fff;">🎤 Anchoring Mode</span>' : ''}
|
| 54 |
+
${this.agent.is_default ? '<span class="badge" style="margin-left:0.5rem;background:rgba(99,102,241,0.15);color:#6366f1;">🔒 System Agent</span>' : ''}
|
| 55 |
+
</div>
|
| 56 |
+
<div class="flex gap-2">
|
| 57 |
+
${this.agent.agent_type === 'anchoring' ? `
|
| 58 |
+
<button class="btn btn-primary" onclick="AgentDetailPage.openRemoteControl()">
|
| 59 |
+
🎛️ Remote Control
|
| 60 |
+
</button>
|
| 61 |
+
<button class="btn btn-secondary" onclick="AgentDetailPage.startAnchoring()">
|
| 62 |
+
▶️ Start Performance
|
| 63 |
+
</button>
|
| 64 |
+
` : `
|
| 65 |
+
<button class="btn btn-primary" onclick="AgentDetailPage.startVideoCall()">
|
| 66 |
+
📹 Video Call
|
| 67 |
+
</button>
|
| 68 |
+
<button class="btn btn-secondary" onclick="AgentDetailPage.startTextChat()">
|
| 69 |
+
💬 Text Chat
|
| 70 |
+
</button>
|
| 71 |
+
`}
|
| 72 |
+
<a href="#/agents/${this.agent.id}/edit" class="btn btn-outline">
|
| 73 |
+
✏️ Edit
|
| 74 |
+
</a>
|
| 75 |
+
</div>
|
| 76 |
+
</div>
|
| 77 |
+
|
| 78 |
+
<div class="tabs">
|
| 79 |
+
<button class="tab ${this.activeTab === 'settings' ? 'active' : ''}" data-tab="settings">Settings</button>
|
| 80 |
+
<button class="tab ${this.activeTab === 'share-links' ? 'active' : ''}" data-tab="share-links">Share Links</button>
|
| 81 |
+
<button class="tab ${this.activeTab === 'conversations' ? 'active' : ''}" data-tab="conversations">Conversations</button>
|
| 82 |
+
<button class="tab ${this.activeTab === 'analytics' ? 'active' : ''}" data-tab="analytics">📊 Analytics</button>
|
| 83 |
+
<button class="tab ${this.activeTab === 'report-chat' ? 'active' : ''}" data-tab="report-chat">🤖 Report Chat</button>
|
| 84 |
+
</div>
|
| 85 |
+
|
| 86 |
+
<div id="tab-content">
|
| 87 |
+
${this.renderTabContent()}
|
| 88 |
+
</div>
|
| 89 |
+
`;
|
| 90 |
+
|
| 91 |
+
this.setupListeners();
|
| 92 |
+
},
|
| 93 |
+
|
| 94 |
+
renderTabContent() {
|
| 95 |
+
switch (this.activeTab) {
|
| 96 |
+
case 'settings':
|
| 97 |
+
return this.renderSettingsTab();
|
| 98 |
+
case 'share-links':
|
| 99 |
+
return this.renderShareLinksTab();
|
| 100 |
+
case 'conversations':
|
| 101 |
+
return this.renderConversationsTab();
|
| 102 |
+
case 'analytics':
|
| 103 |
+
return this.renderAnalyticsTab();
|
| 104 |
+
case 'report-chat':
|
| 105 |
+
return this.renderReportChatTab();
|
| 106 |
+
default:
|
| 107 |
+
return '';
|
| 108 |
+
}
|
| 109 |
+
},
|
| 110 |
+
|
| 111 |
+
renderReportChatTab() {
|
| 112 |
+
// Set agent ID so the history getter/setter work
|
| 113 |
+
this._rcAgentId = this.agent.id;
|
| 114 |
+
// Restore previous messages from cache if any
|
| 115 |
+
const history = this._rcHistory;
|
| 116 |
+
const hasHistory = history.length > 0;
|
| 117 |
+
return `
|
| 118 |
+
<div class="card" style="padding:0; overflow:hidden; border-radius:16px;">
|
| 119 |
+
<!-- Chat Header -->
|
| 120 |
+
<div style="display:flex; align-items:center; justify-content:space-between; padding:1.25rem 1.5rem; background:#f8fafc; border-bottom:1px solid var(--border-color);">
|
| 121 |
+
<div style="display:flex; align-items:center; gap:0.75rem;">
|
| 122 |
+
<div style="width:40px; height:40px; border-radius:12px; background:${this.agent.color}22; display:flex; align-items:center; justify-content:center; font-size:1.25rem;">${this.agent.icon}</div>
|
| 123 |
+
<div>
|
| 124 |
+
<div style="font-weight:700; color:#111827; font-size:1rem;">${this.agent.name} — Report Chat</div>
|
| 125 |
+
<div style="font-size:0.75rem; color:#6b7280;">AI assistant with full access to this agent's data</div>
|
| 126 |
+
</div>
|
| 127 |
+
</div>
|
| 128 |
+
<div style="display:flex; gap:0.5rem;">
|
| 129 |
+
<button onclick="AgentDetailPage.rcClearHistory()" title="Clear chat history" style="padding:0.4rem 0.9rem; background:transparent; color:#9ca3af; border:1px solid #e5e7eb; border-radius:8px; font-size:0.8rem; font-weight:500; cursor:pointer;">🗑 Clear</button>
|
| 130 |
+
<button onclick="AgentDetailPage.rcDownloadPDF()" style="padding:0.4rem 0.9rem; background:#6366f1; color:white; border:none; border-radius:8px; font-size:0.8rem; font-weight:600; cursor:pointer;">📄 PDF</button>
|
| 131 |
+
<button onclick="AgentDetailPage.rcDownloadDOCX()" style="padding:0.4rem 0.9rem; background:#16a34a; color:white; border:none; border-radius:8px; font-size:0.8rem; font-weight:600; cursor:pointer;">📝 DOCX</button>
|
| 132 |
+
</div>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<!-- Quick Suggestions -->
|
| 136 |
+
<div style="padding:0.75rem 1.25rem; background:#f1f5f9; border-bottom:1px solid #e2e8f0; display:flex; gap:0.5rem; flex-wrap:wrap;">
|
| 137 |
+
${['Top 10 performers', 'Average score', 'Recent sessions', 'Lowest scores', 'Performance of [name]', 'Total conversations'].map(q =>
|
| 138 |
+
`<button onclick="AgentDetailPage.rcSuggest('${q}')" style="padding:0.3rem 0.7rem; background:white; color:#6366f1; border:1px solid #c7d2fe; border-radius:20px; font-size:0.78rem; font-weight:500; cursor:pointer; transition:all .15s;" onmouseover="this.style.background='#eef2ff'" onmouseout="this.style.background='white'">${q}</button>`
|
| 139 |
+
).join('')}
|
| 140 |
+
</div>
|
| 141 |
+
|
| 142 |
+
<!-- Messages -->
|
| 143 |
+
<div id="rc-messages" style="height:360px; overflow-y:auto; padding:1.25rem; display:flex; flex-direction:column; gap:0.875rem; background:#ffffff;">
|
| 144 |
+
${hasHistory ? '' : `
|
| 145 |
+
<div style="text-align:center; color:#9ca3af; font-size:0.85rem; padding:1.5rem 0;">
|
| 146 |
+
👋 Ask me anything about <strong>${this.agent.name}</strong>'s data!<br>
|
| 147 |
+
<span style="font-size:0.78rem;">e.g. "Top 5 performers", "Performance of John", "Average score"</span>
|
| 148 |
+
</div>`}
|
| 149 |
+
</div>
|
| 150 |
+
|
| 151 |
+
<!-- Input -->
|
| 152 |
+
<div style="padding:1rem 1.25rem; border-top:1px solid #e2e8f0; background:#f8fafc; display:flex; gap:0.5rem;">
|
| 153 |
+
<input type="text" id="rc-input" placeholder="Ask about scores, rankings, specific participant performance..." style="flex:1; padding:0.65rem 1rem; border:1px solid #d1d5db; border-radius:10px; background:white; color:#111827; font-size:0.9rem; outline:none; font-family:inherit;" onkeypress="if(event.key==='Enter') AgentDetailPage.rcSend()">
|
| 154 |
+
<button onclick="AgentDetailPage.rcSend()" style="padding:0.65rem 1.1rem; background:#6366f1; color:white; border:none; border-radius:10px; cursor:pointer; font-size:1rem; font-weight:600;">➤</button>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
`;
|
| 158 |
+
},
|
| 159 |
+
|
| 160 |
+
renderAnalyticsTab() {
|
| 161 |
+
return `
|
| 162 |
+
<div class="card">
|
| 163 |
+
<h4 style="margin-bottom: 1.5rem; color: var(--gray-900);">📊 Agent Analytics</h4>
|
| 164 |
+
|
| 165 |
+
<!-- Summary Stats -->
|
| 166 |
+
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:1rem;margin-bottom:2rem;" id="analytics-stats">
|
| 167 |
+
<div class="card" style="text-align:center;padding:1rem;">
|
| 168 |
+
<div class="spinner" style="margin:auto;"></div>
|
| 169 |
+
</div>
|
| 170 |
+
</div>
|
| 171 |
+
|
| 172 |
+
<!-- Conversations over time chart -->
|
| 173 |
+
<div style="margin-bottom:1.5rem;">
|
| 174 |
+
<div style="font-weight:600;color:var(--gray-700);margin-bottom:0.75rem;font-size:0.875rem;">Conversations (last 30 days)</div>
|
| 175 |
+
<div style="position:relative;height:180px;">
|
| 176 |
+
<canvas id="analytics-chart"></canvas>
|
| 177 |
+
</div>
|
| 178 |
+
</div>
|
| 179 |
+
|
| 180 |
+
<!-- Score trend -->
|
| 181 |
+
<div id="analytics-score-section" style="display:none;">
|
| 182 |
+
<div style="font-weight:600;color:var(--gray-700);margin-bottom:0.75rem;font-size:0.875rem;">Score Trend (last 10 sessions)</div>
|
| 183 |
+
<div style="position:relative;height:140px;">
|
| 184 |
+
<canvas id="score-chart"></canvas>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
`;
|
| 189 |
+
},
|
| 190 |
+
|
| 191 |
+
renderSettingsTab() {
|
| 192 |
+
const rules = this.agent.rules || [];
|
| 193 |
+
const config = this.agent.output_config || {};
|
| 194 |
+
const isAnchoring = this.agent.agent_type === 'anchoring';
|
| 195 |
+
|
| 196 |
+
return `
|
| 197 |
+
<div class="card">
|
| 198 |
+
${isAnchoring ? `
|
| 199 |
+
<div style="margin-bottom:1.5rem;padding:16px;background:linear-gradient(135deg,rgba(245,158,11,0.1),rgba(249,115,22,0.05));border:1px solid rgba(245,158,11,0.2);border-radius:12px;">
|
| 200 |
+
<div style="display:flex;align-items:center;gap:10px;margin-bottom:8px;">
|
| 201 |
+
<span style="font-size:24px;">🎤</span>
|
| 202 |
+
<strong style="color:var(--gray-900);">Event Anchoring Agent</strong>
|
| 203 |
+
</div>
|
| 204 |
+
<p style="color:var(--gray-600);font-size:0.875rem;margin:0;">This is a script-based anchoring agent. It reads your script line by line with no conversation. Use the Remote Control to manage the performance.</p>
|
| 205 |
+
</div>
|
| 206 |
+
|
| 207 |
+
<h4 style="margin-bottom:1rem;color:var(--gray-900);">📝 Anchoring Script</h4>
|
| 208 |
+
<textarea id="anc-detail-script" class="form-input" style="min-height:200px;font-family:monospace;line-height:1.8;resize:vertical;" placeholder="Enter your anchoring script... Each line will be spoken separately.">${this.agent.script_content || ''}</textarea>
|
| 209 |
+
<div style="margin-top:1rem;display:flex;gap:0.5rem;">
|
| 210 |
+
<button class="btn btn-primary" onclick="AgentDetailPage.saveScript()">💾 Save Script</button>
|
| 211 |
+
<button class="btn btn-secondary" onclick="AgentDetailPage.openRemoteControl()">🎛️ Open Remote Control</button>
|
| 212 |
+
</div>
|
| 213 |
+
<hr style="margin:1.5rem 0;border:none;border-top:1px solid var(--gray-100);">
|
| 214 |
+
` : ''}
|
| 215 |
+
|
| 216 |
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;">
|
| 217 |
+
<div>
|
| 218 |
+
<h4 style="margin-bottom: 1rem; color: var(--gray-900);">Identity</h4>
|
| 219 |
+
<div class="mb-3">
|
| 220 |
+
<div style="font-size: 0.875rem; color: var(--gray-500);">Goal</div>
|
| 221 |
+
<div>${this.agent.goal || 'Not specified'}</div>
|
| 222 |
+
</div>
|
| 223 |
+
<div class="mb-3">
|
| 224 |
+
<div style="font-size: 0.875rem; color: var(--gray-500);">Opening Message</div>
|
| 225 |
+
<div>${this.agent.opening_message || 'No opening message'}</div>
|
| 226 |
+
</div>
|
| 227 |
+
</div>
|
| 228 |
+
|
| 229 |
+
<div>
|
| 230 |
+
<h4 style="margin-bottom: 1rem; color: var(--gray-900);">Behavior</h4>
|
| 231 |
+
<div class="mb-3">
|
| 232 |
+
<div style="font-size: 0.875rem; color: var(--gray-500);">Tone</div>
|
| 233 |
+
<div style="text-transform: capitalize;">${this.agent.tone}</div>
|
| 234 |
+
</div>
|
| 235 |
+
<div class="mb-3">
|
| 236 |
+
<div style="font-size: 0.875rem; color: var(--gray-500);">Rules</div>
|
| 237 |
+
${rules.length > 0 ? `
|
| 238 |
+
<ul style="margin: 0; padding-left: 1.25rem;">
|
| 239 |
+
${rules.map(r => `<li>${r}</li>`).join('')}
|
| 240 |
+
</ul>
|
| 241 |
+
` : '<div>No rules defined</div>'}
|
| 242 |
+
</div>
|
| 243 |
+
</div>
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
<hr style="margin: 1.5rem 0; border: none; border-top: 1px solid var(--gray-100);">
|
| 247 |
+
|
| 248 |
+
<div>
|
| 249 |
+
<h4 style="margin-bottom: 1rem; color: var(--gray-900);">Output Configuration</h4>
|
| 250 |
+
<div class="flex gap-4">
|
| 251 |
+
<span class="badge ${config.summary ? 'active' : 'inactive'}">Summary: ${config.summary ? 'On' : 'Off'}</span>
|
| 252 |
+
<span class="badge ${config.transcript ? 'active' : 'inactive'}">Transcript: ${config.transcript ? 'On' : 'Off'}</span>
|
| 253 |
+
<span class="badge ${config.evaluation ? 'active' : 'inactive'}">Evaluation: ${config.evaluation ? 'On' : 'Off'}</span>
|
| 254 |
+
</div>
|
| 255 |
+
</div>
|
| 256 |
+
|
| 257 |
+
${!this.agent.is_default ? `
|
| 258 |
+
<div style="margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-100); display: flex; justify-content: flex-end;">
|
| 259 |
+
<button class="btn btn-danger" onclick="AgentDetailPage.deleteAgent()">
|
| 260 |
+
🗑️ Delete Agent
|
| 261 |
+
</button>
|
| 262 |
+
</div>
|
| 263 |
+
` : `
|
| 264 |
+
<div style="margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-100); text-align: right;">
|
| 265 |
+
<span style="color:var(--gray-400);font-size:0.875rem;">🔒 System agent cannot be deleted</span>
|
| 266 |
+
</div>
|
| 267 |
+
`}
|
| 268 |
+
</div>
|
| 269 |
+
`;
|
| 270 |
+
},
|
| 271 |
+
|
| 272 |
+
renderShareLinksTab() {
|
| 273 |
+
return `
|
| 274 |
+
<div class="card">
|
| 275 |
+
<div class="flex justify-between items-center mb-4">
|
| 276 |
+
<h4 style="color: var(--gray-900);">Share Links</h4>
|
| 277 |
+
<button class="btn btn-primary" onclick="AgentDetailPage.showCreateLinkModal()">
|
| 278 |
+
+ Create Link
|
| 279 |
+
</button>
|
| 280 |
+
</div>
|
| 281 |
+
<div id="share-links-list">
|
| 282 |
+
<div class="empty-state" style="padding: 2rem;">
|
| 283 |
+
<div class="spinner"></div>
|
| 284 |
+
</div>
|
| 285 |
+
</div>
|
| 286 |
+
</div>
|
| 287 |
+
`;
|
| 288 |
+
},
|
| 289 |
+
|
| 290 |
+
renderConversationsTab() {
|
| 291 |
+
return `
|
| 292 |
+
<div class="card">
|
| 293 |
+
<h4 style="margin-bottom: 1rem; color: var(--gray-900);">Conversations</h4>
|
| 294 |
+
<div id="agent-conversations-list">
|
| 295 |
+
<div class="empty-state" style="padding: 2rem;">
|
| 296 |
+
<div class="spinner"></div>
|
| 297 |
+
</div>
|
| 298 |
+
</div>
|
| 299 |
+
</div>
|
| 300 |
+
`;
|
| 301 |
+
},
|
| 302 |
+
|
| 303 |
+
setupListeners() {
|
| 304 |
+
document.querySelectorAll('.tab').forEach(tab => {
|
| 305 |
+
tab.addEventListener('click', () => {
|
| 306 |
+
this.activeTab = tab.dataset.tab;
|
| 307 |
+
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
| 308 |
+
tab.classList.add('active');
|
| 309 |
+
document.getElementById('tab-content').innerHTML = this.renderTabContent();
|
| 310 |
+
|
| 311 |
+
if (this.activeTab === 'share-links') {
|
| 312 |
+
this.loadShareLinks();
|
| 313 |
+
} else if (this.activeTab === 'conversations') {
|
| 314 |
+
this.loadConversations();
|
| 315 |
+
} else if (this.activeTab === 'analytics') {
|
| 316 |
+
this.loadAnalytics();
|
| 317 |
+
} else if (this.activeTab === 'report-chat') {
|
| 318 |
+
// Set agent ID — history is preserved in _rcHistoryCache
|
| 319 |
+
this._rcAgentId = this.agent.id;
|
| 320 |
+
// Re-render previous messages from cache
|
| 321 |
+
this._rcRestoreHistory();
|
| 322 |
+
}
|
| 323 |
+
});
|
| 324 |
+
});
|
| 325 |
+
},
|
| 326 |
+
|
| 327 |
+
// ─── Report Chat Methods ───────────────────────────────────────────────
|
| 328 |
+
|
| 329 |
+
rcClearHistory() {
|
| 330 |
+
if (this._rcAgentId) this._rcHistoryCache[this._rcAgentId] = [];
|
| 331 |
+
const msgs = document.getElementById('rc-messages');
|
| 332 |
+
if (msgs) msgs.innerHTML = `
|
| 333 |
+
<div style="text-align:center; color:#9ca3af; font-size:0.85rem; padding:1.5rem 0;">
|
| 334 |
+
👋 Chat history cleared. Ask me anything about <strong>${this.agent?.name || 'this agent'}</strong>'s data!
|
| 335 |
+
</div>`;
|
| 336 |
+
},
|
| 337 |
+
|
| 338 |
+
_rcRestoreHistory() {
|
| 339 |
+
const msgs = document.getElementById('rc-messages');
|
| 340 |
+
if (!msgs) return;
|
| 341 |
+
const history = this._rcHistory;
|
| 342 |
+
if (!history.length) return;
|
| 343 |
+
// Clear default placeholder
|
| 344 |
+
msgs.innerHTML = '';
|
| 345 |
+
history.forEach(h => this._rcAppend(h.content, h.role === 'user' ? 'user' : 'agent'));
|
| 346 |
+
},
|
| 347 |
+
|
| 348 |
+
rcSuggest(text) {
|
| 349 |
+
const input = document.getElementById('rc-input');
|
| 350 |
+
if (input) { input.value = text; input.focus(); }
|
| 351 |
+
// Auto-send only if it's not a template like "Performance of [name]"
|
| 352 |
+
if (!text.includes('[')) this.rcSend();
|
| 353 |
+
},
|
| 354 |
+
|
| 355 |
+
async rcSend() {
|
| 356 |
+
const input = document.getElementById('rc-input');
|
| 357 |
+
const msg = input?.value.trim();
|
| 358 |
+
if (!msg) return;
|
| 359 |
+
input.value = '';
|
| 360 |
+
|
| 361 |
+
this._rcAppend(msg, 'user');
|
| 362 |
+
this._rcHistory.push({ role: 'user', content: msg });
|
| 363 |
+
|
| 364 |
+
// Typing indicator
|
| 365 |
+
const tid = 'rc-typing-' + Date.now();
|
| 366 |
+
const msgs = document.getElementById('rc-messages');
|
| 367 |
+
const typing = document.createElement('div');
|
| 368 |
+
typing.id = tid;
|
| 369 |
+
typing.style.cssText = 'align-self:flex-start;padding:0.6rem 1rem;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:4px 14px 14px 14px;color:#94a3b8;font-size:0.85rem;';
|
| 370 |
+
typing.textContent = '...';
|
| 371 |
+
msgs?.appendChild(typing);
|
| 372 |
+
msgs.scrollTop = msgs.scrollHeight;
|
| 373 |
+
|
| 374 |
+
try {
|
| 375 |
+
const res = await API.post(`/agents/${this._rcAgentId}/report-chat`, {
|
| 376 |
+
message: msg,
|
| 377 |
+
history: this._rcHistory.slice(-12)
|
| 378 |
+
});
|
| 379 |
+
document.getElementById(tid)?.remove();
|
| 380 |
+
const reply = res.reply || 'No response.';
|
| 381 |
+
this._rcHistoryCache[this._rcAgentId].push({ role: 'assistant', content: reply });
|
| 382 |
+
this._rcAppend(reply, 'agent');
|
| 383 |
+
} catch (e) {
|
| 384 |
+
document.getElementById(tid)?.remove();
|
| 385 |
+
this._rcAppend('⚠️ Failed to get a response. Please try again.', 'agent');
|
| 386 |
+
}
|
| 387 |
+
},
|
| 388 |
+
|
| 389 |
+
_rcAppend(text, role) {
|
| 390 |
+
const msgs = document.getElementById('rc-messages');
|
| 391 |
+
if (!msgs) return;
|
| 392 |
+
const div = document.createElement('div');
|
| 393 |
+
if (role === 'user') {
|
| 394 |
+
div.style.cssText = 'align-self:flex-end;background:#6366f1;color:white;padding:0.65rem 1rem;border-radius:14px 14px 4px 14px;max-width:82%;font-size:0.9rem;line-height:1.5;word-wrap:break-word;';
|
| 395 |
+
} else {
|
| 396 |
+
div.style.cssText = 'align-self:flex-start;background:#f8fafc;color:#1e293b;border:1px solid #e2e8f0;padding:0.65rem 1rem;border-radius:4px 14px 14px 14px;max-width:90%;font-size:0.9rem;line-height:1.6;white-space:pre-wrap;word-wrap:break-word;';
|
| 397 |
+
}
|
| 398 |
+
div.textContent = text;
|
| 399 |
+
msgs.appendChild(div);
|
| 400 |
+
msgs.scrollTop = msgs.scrollHeight;
|
| 401 |
+
},
|
| 402 |
+
|
| 403 |
+
rcDownloadPDF() {
|
| 404 |
+
const agent = this.agent;
|
| 405 |
+
const dateStr = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
|
| 406 |
+
const chatHtml = this._rcHistory.map(h => `
|
| 407 |
+
<div style="margin-bottom:1rem;">
|
| 408 |
+
<strong style="color:${h.role === 'user' ? '#6366f1' : '#374151'};">${h.role === 'user' ? 'You' : agent.name}:</strong>
|
| 409 |
+
<p style="margin:0.25rem 0 0; color:#374151; white-space:pre-wrap; line-height:1.6;">${h.content}</p>
|
| 410 |
+
</div>`).join('');
|
| 411 |
+
|
| 412 |
+
const html = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Report Chat — ${agent.name}</title>
|
| 413 |
+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet">
|
| 414 |
+
<style>*{margin:0;padding:0;box-sizing:border-box;}body{font-family:'Inter',sans-serif;background:#f9fafb;color:#1f2937;padding:2rem;}
|
| 415 |
+
.c{max-width:800px;margin:0 auto;background:white;border-radius:16px;box-shadow:0 4px 24px rgba(0,0,0,.08);overflow:hidden;}
|
| 416 |
+
.h{padding:2rem;background:linear-gradient(135deg,#6366f1,#8b5cf6);color:white;}
|
| 417 |
+
.h h1{font-size:1.4rem;font-weight:700;}.h p{opacity:.8;margin-top:.25rem;font-size:.9rem;}
|
| 418 |
+
.b{padding:2rem;}.f{padding:1.25rem 2rem;background:#f9fafb;text-align:center;font-size:.8rem;color:#9ca3af;}
|
| 419 |
+
@media print{.np{display:none}.c{box-shadow:none;border-radius:0;}body{padding:0;background:white;}}</style></head>
|
| 420 |
+
<body><div class="np" style="text-align:center;margin-bottom:1rem;"><button onclick="window.print()" style="padding:10px 24px;background:#6366f1;color:white;border:none;border-radius:8px;font-size:.9rem;font-weight:600;cursor:pointer;">📥 Save as PDF</button></div>
|
| 421 |
+
<div class="c"><div class="h"><h1>${agent.icon} ${agent.name} — Report Chat Export</h1><p>${agent.role} • Generated: ${dateStr}</p></div>
|
| 422 |
+
<div class="b">${chatHtml || '<p style="color:#9ca3af;text-align:center;">No chat history to export.</p>'}</div>
|
| 423 |
+
<div class="f">PersonaFlow • ${dateStr}</div></div></body></html>`;
|
| 424 |
+
|
| 425 |
+
const win = window.open('', '_blank');
|
| 426 |
+
win.document.write(html);
|
| 427 |
+
win.document.close();
|
| 428 |
+
},
|
| 429 |
+
|
| 430 |
+
async rcDownloadDOCX() {
|
| 431 |
+
if (!this._rcAgentId) return;
|
| 432 |
+
Toast.info('Generating DOCX...');
|
| 433 |
+
try {
|
| 434 |
+
const response = await fetch(`/api/agents/${this._rcAgentId}/export-report`, {
|
| 435 |
+
method: 'POST',
|
| 436 |
+
headers: { 'Content-Type': 'application/json' },
|
| 437 |
+
body: JSON.stringify({}),
|
| 438 |
+
credentials: 'include'
|
| 439 |
+
});
|
| 440 |
+
if (!response.ok) throw new Error('Export failed');
|
| 441 |
+
const blob = await response.blob();
|
| 442 |
+
const url = URL.createObjectURL(blob);
|
| 443 |
+
const a = document.createElement('a');
|
| 444 |
+
a.href = url;
|
| 445 |
+
a.download = `report_${this.agent.name.replace(/\s+/g, '_').toLowerCase()}.docx`;
|
| 446 |
+
a.click();
|
| 447 |
+
URL.revokeObjectURL(url);
|
| 448 |
+
Toast.success('DOCX downloaded!');
|
| 449 |
+
} catch (e) {
|
| 450 |
+
Toast.error('Failed to generate DOCX');
|
| 451 |
+
}
|
| 452 |
+
},
|
| 453 |
+
|
| 454 |
+
async loadShareLinks() {
|
| 455 |
+
try {
|
| 456 |
+
const { share_links } = await API.get(`/agents/${this.agent.id}/share-links`);
|
| 457 |
+
const container = document.getElementById('share-links-list');
|
| 458 |
+
|
| 459 |
+
if (share_links.length === 0) {
|
| 460 |
+
container.innerHTML = `
|
| 461 |
+
<div class="empty-state" style="padding: 2rem;">
|
| 462 |
+
<div class="empty-icon">🔗</div>
|
| 463 |
+
<div class="empty-message">No share links yet</div>
|
| 464 |
+
</div>
|
| 465 |
+
`;
|
| 466 |
+
return;
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
container.innerHTML = share_links.map(link => `
|
| 470 |
+
<div class="flex items-center justify-between" style="padding: 1rem; border-bottom: 1px solid var(--gray-100);">
|
| 471 |
+
<div>
|
| 472 |
+
<div style="font-weight:600; color:var(--gray-900); margin-bottom:0.25rem;">
|
| 473 |
+
${link.name ? `🔗 ${link.name}` : '🔗 Unnamed Link'}
|
| 474 |
+
</div>
|
| 475 |
+
<div class="flex items-center gap-2 mb-1">
|
| 476 |
+
${link.has_password ? '<span class="badge protected">🔒 Protected</span>' : ''}
|
| 477 |
+
${link.is_expired ? '<span class="badge expired">Expired</span>' : ''}
|
| 478 |
+
${link.is_maxed ? '<span class="badge expired">Max uses reached</span>' : ''}
|
| 479 |
+
</div>
|
| 480 |
+
<div style="font-size: 0.875rem; color: var(--gray-500);">
|
| 481 |
+
Created ${App.formatRelativeTime(link.created_at)} •
|
| 482 |
+
${link.current_uses}${link.max_uses ? '/' + link.max_uses : ''} uses
|
| 483 |
+
${link.expires_at ? ' • Expires ' + App.formatDate(link.expires_at) : ''}
|
| 484 |
+
</div>
|
| 485 |
+
</div>
|
| 486 |
+
<div class="flex gap-2">
|
| 487 |
+
<button class="btn btn-sm btn-secondary" onclick="AgentDetailPage.copyLink('${link.token}')">
|
| 488 |
+
📋 Copy Link
|
| 489 |
+
</button>
|
| 490 |
+
<button class="btn btn-sm btn-outline" onclick="AgentDetailPage.deleteLink(${link.id})">
|
| 491 |
+
🗑️
|
| 492 |
+
</button>
|
| 493 |
+
</div>
|
| 494 |
+
</div>
|
| 495 |
+
`).join('');
|
| 496 |
+
|
| 497 |
+
} catch (error) {
|
| 498 |
+
Toast.error('Failed to load share links');
|
| 499 |
+
}
|
| 500 |
+
},
|
| 501 |
+
|
| 502 |
+
async loadConversations() {
|
| 503 |
+
try {
|
| 504 |
+
const { conversations } = await API.get('/conversations');
|
| 505 |
+
const filtered = conversations.filter(c => c.agent_id === this.agent.id);
|
| 506 |
+
const container = document.getElementById('agent-conversations-list');
|
| 507 |
+
|
| 508 |
+
if (filtered.length === 0) {
|
| 509 |
+
container.innerHTML = `
|
| 510 |
+
<div class="empty-state" style="padding: 2rem;">
|
| 511 |
+
<div class="empty-icon">💬</div>
|
| 512 |
+
<div class="empty-message">No conversations yet</div>
|
| 513 |
+
</div>
|
| 514 |
+
`;
|
| 515 |
+
return;
|
| 516 |
+
}
|
| 517 |
+
|
| 518 |
+
container.innerHTML = filtered.map(conv => `
|
| 519 |
+
<a href="#/conversations/${conv.id}" class="flex items-center justify-between" style="padding: 1rem; border-bottom: 1px solid var(--gray-100); text-decoration: none; color: inherit;">
|
| 520 |
+
<div>
|
| 521 |
+
<div style="font-weight: 500; color: var(--gray-900);">${conv.participant_name || 'Anonymous'}</div>
|
| 522 |
+
<div style="font-size: 0.875rem; color: var(--gray-500);">
|
| 523 |
+
${conv.message_count} messages • ${App.formatRelativeTime(conv.started_at)}
|
| 524 |
+
</div>
|
| 525 |
+
</div>
|
| 526 |
+
<span class="badge ${conv.status}">${conv.status}</span>
|
| 527 |
+
</a>
|
| 528 |
+
`).join('');
|
| 529 |
+
|
| 530 |
+
} catch (error) {
|
| 531 |
+
Toast.error('Failed to load conversations');
|
| 532 |
+
}
|
| 533 |
+
},
|
| 534 |
+
|
| 535 |
+
async loadAnalytics() {
|
| 536 |
+
try {
|
| 537 |
+
const { analytics: a } = await API.get(`/agents/${this.agent.id}/analytics`);
|
| 538 |
+
|
| 539 |
+
// Render stat cards
|
| 540 |
+
document.getElementById('analytics-stats').innerHTML = `
|
| 541 |
+
<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1rem;text-align:center;">
|
| 542 |
+
<div style="font-size:1.75rem;font-weight:700;color:var(--primary-600,#4f46e5);">${a.total_conversations}</div>
|
| 543 |
+
<div style="font-size:0.75rem;color:var(--gray-500);">Total Conversations</div>
|
| 544 |
+
</div>
|
| 545 |
+
<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1rem;text-align:center;">
|
| 546 |
+
<div style="font-size:1.75rem;font-weight:700;color:#22c55e;">${a.completed_conversations}</div>
|
| 547 |
+
<div style="font-size:0.75rem;color:var(--gray-500);">Completed</div>
|
| 548 |
+
</div>
|
| 549 |
+
<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1rem;text-align:center;">
|
| 550 |
+
<div style="font-size:1.75rem;font-weight:700;color:#0ea5e9;">${a.text_count}</div>
|
| 551 |
+
<div style="font-size:0.75rem;color:var(--gray-500);">Text Chats</div>
|
| 552 |
+
</div>
|
| 553 |
+
<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1rem;text-align:center;">
|
| 554 |
+
<div style="font-size:1.75rem;font-weight:700;color:#8b5cf6;">${a.video_count}</div>
|
| 555 |
+
<div style="font-size:0.75rem;color:var(--gray-500);">Video Calls</div>
|
| 556 |
+
</div>
|
| 557 |
+
${a.avg_score !== null ? `
|
| 558 |
+
<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1rem;text-align:center;">
|
| 559 |
+
<div style="font-size:1.75rem;font-weight:700;color:#f59e0b;">${a.avg_score}/10</div>
|
| 560 |
+
<div style="font-size:0.75rem;color:var(--gray-500);">Avg Score</div>
|
| 561 |
+
</div>` : ''}
|
| 562 |
+
<div style="background:var(--gray-50,#f9fafb);border-radius:12px;padding:1rem;text-align:center;">
|
| 563 |
+
<div style="font-size:1.75rem;font-weight:700;color:#ec4899;">${a.share_conversations}</div>
|
| 564 |
+
<div style="font-size:0.75rem;color:var(--gray-500);">Via Share Link</div>
|
| 565 |
+
</div>
|
| 566 |
+
`;
|
| 567 |
+
|
| 568 |
+
// Draw conversations chart (simple inline SVG bars — no Chart.js CDN needed)
|
| 569 |
+
const days = a.conversations_by_day;
|
| 570 |
+
const maxCount = Math.max(...days.map(d => d.count), 1);
|
| 571 |
+
const chartEl = document.getElementById('analytics-chart');
|
| 572 |
+
if (chartEl) {
|
| 573 |
+
// Replace canvas with SVG bar chart
|
| 574 |
+
const labels = days.filter((_, i) => i % 5 === 4 || i === days.length - 1).map(d => d.date.slice(5));
|
| 575 |
+
const barW = 100 / days.length;
|
| 576 |
+
const bars = days.map((d, i) => {
|
| 577 |
+
const h = maxCount > 0 ? (d.count / maxCount) * 100 : 0;
|
| 578 |
+
const x = i * barW;
|
| 579 |
+
const color = d.count > 0 ? '#6366f1' : '#e5e7eb';
|
| 580 |
+
return `<g>
|
| 581 |
+
<rect x="${x}%" y="${100 - h}%" width="${barW - 0.5}%" height="${h}%" fill="${color}" rx="2"
|
| 582 |
+
style="transition:opacity 0.2s" onmouseover="this.style.opacity=0.8" onmouseout="this.style.opacity=1">
|
| 583 |
+
<title>${d.date}: ${d.count} conversation${d.count !== 1 ? 's' : ''}</title>
|
| 584 |
+
</rect>
|
| 585 |
+
</g>`;
|
| 586 |
+
}).join('');
|
| 587 |
+
|
| 588 |
+
chartEl.outerHTML = `<svg width="100%" height="180" viewBox="0 0 100 100" preserveAspectRatio="none"
|
| 589 |
+
style="display:block;border-bottom:1px solid var(--gray-200,#e5e7eb);">${bars}</svg>`;
|
| 590 |
+
}
|
| 591 |
+
|
| 592 |
+
// Score trend
|
| 593 |
+
if (a.score_trend && a.score_trend.length > 0) {
|
| 594 |
+
const scoreSection = document.getElementById('analytics-score-section');
|
| 595 |
+
if (scoreSection) scoreSection.style.display = 'block';
|
| 596 |
+
const scoreEl = document.getElementById('score-chart');
|
| 597 |
+
if (scoreEl) {
|
| 598 |
+
const scores = a.score_trend;
|
| 599 |
+
const maxS = 10;
|
| 600 |
+
const ptW = 100 / (scores.length - 1 || 1);
|
| 601 |
+
const points = scores.map((s, i) => {
|
| 602 |
+
const x = i * ptW;
|
| 603 |
+
const y = 100 - (s.score / maxS * 100);
|
| 604 |
+
return `${x},${y}`;
|
| 605 |
+
}).join(' ');
|
| 606 |
+
const dots = scores.map((s, i) => {
|
| 607 |
+
const x = i * ptW;
|
| 608 |
+
const y = 100 - (s.score / maxS * 100);
|
| 609 |
+
return `<circle cx="${x}%" cy="${y}%" r="3" fill="#f59e0b"><title>${s.date}: ${s.score}/10</title></circle>`;
|
| 610 |
+
}).join('');
|
| 611 |
+
scoreEl.outerHTML = `<svg width="100%" height="140" viewBox="0 0 100 100" preserveAspectRatio="none" style="display:block;">
|
| 612 |
+
<polyline points="${points}" fill="none" stroke="#f59e0b" stroke-width="2" vector-effect="non-scaling-stroke"/>
|
| 613 |
+
${dots}</svg>`;
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
+
} catch (e) {
|
| 617 |
+
Toast.error('Failed to load analytics');
|
| 618 |
+
}
|
| 619 |
+
},
|
| 620 |
+
|
| 621 |
+
async startTextChat() {
|
| 622 |
+
try {
|
| 623 |
+
const { conversation } = await API.post('/conversations', {
|
| 624 |
+
agent_id: this.agent.id,
|
| 625 |
+
mode: 'text'
|
| 626 |
+
});
|
| 627 |
+
Router.navigate(`/chat/${conversation.id}`);
|
| 628 |
+
} catch (error) {
|
| 629 |
+
Toast.error('Failed to start chat', error.message);
|
| 630 |
+
}
|
| 631 |
+
},
|
| 632 |
+
|
| 633 |
+
async startVideoCall() {
|
| 634 |
+
try {
|
| 635 |
+
const { conversation } = await API.post('/conversations', {
|
| 636 |
+
agent_id: this.agent.id,
|
| 637 |
+
mode: 'video'
|
| 638 |
+
});
|
| 639 |
+
Router.navigate(`/video-call/${conversation.id}`);
|
| 640 |
+
} catch (error) {
|
| 641 |
+
Toast.error('Failed to start video call', error.message);
|
| 642 |
+
}
|
| 643 |
+
},
|
| 644 |
+
|
| 645 |
+
showCreateLinkModal() {
|
| 646 |
+
const content = `
|
| 647 |
+
<div style="color: var(--gray-500); font-size: 0.95rem; margin-bottom: 1.5rem; margin-top: -0.5rem;">
|
| 648 |
+
Configure the share link settings
|
| 649 |
+
</div>
|
| 650 |
+
|
| 651 |
+
<div class="form-group">
|
| 652 |
+
<label class="form-label" style="font-weight: 600; color: #111827;">Link Name</label>
|
| 653 |
+
<input type="text" id="link-name" class="form-input" placeholder="e.g., Interview Session 1">
|
| 654 |
+
</div>
|
| 655 |
+
|
| 656 |
+
<div class="form-group" style="margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--gray-200);">
|
| 657 |
+
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem;">
|
| 658 |
+
<div>
|
| 659 |
+
<div style="font-weight: 600; color: #111827; margin-bottom: 0.25rem;">Password Protection</div>
|
| 660 |
+
<div style="color: var(--gray-500); font-size: 0.85rem;">Require password to access</div>
|
| 661 |
+
</div>
|
| 662 |
+
<div class="toggle" id="toggle-password"></div>
|
| 663 |
+
</div>
|
| 664 |
+
<div id="password-input-container" style="display: none; margin-top: 1rem;">
|
| 665 |
+
<input type="password" id="link-password" class="form-input" placeholder="Enter password">
|
| 666 |
+
</div>
|
| 667 |
+
</div>
|
| 668 |
+
|
| 669 |
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--gray-200);">
|
| 670 |
+
<div class="form-group" style="margin-bottom: 0;">
|
| 671 |
+
<label class="form-label" style="font-weight: 600; color: #111827;">Expires in (days)</label>
|
| 672 |
+
<input type="number" id="link-expires" class="form-input" placeholder="0 = never" min="0">
|
| 673 |
+
</div>
|
| 674 |
+
|
| 675 |
+
<div class="form-group" style="margin-bottom: 0;">
|
| 676 |
+
<label class="form-label" style="font-weight: 600; color: #111827;">Max Uses</label>
|
| 677 |
+
<input type="number" id="link-max-uses" class="form-input" placeholder="0 = unlimited" min="0">
|
| 678 |
+
</div>
|
| 679 |
+
</div>
|
| 680 |
+
|
| 681 |
+
<div class="form-group" style="display: flex; flex-direction: column; gap: 1rem; margin-bottom: 0;">
|
| 682 |
+
<div style="display: flex; justify-content: space-between; align-items: center;">
|
| 683 |
+
<span style="font-weight: 600; color: #111827;">Require Name</span>
|
| 684 |
+
<div class="toggle active" id="toggle-require-name"></div>
|
| 685 |
+
</div>
|
| 686 |
+
<div style="display: flex; justify-content: space-between; align-items: center;">
|
| 687 |
+
<span style="font-weight: 600; color: #111827;">Require Email</span>
|
| 688 |
+
<div class="toggle" id="toggle-require-email"></div>
|
| 689 |
+
</div>
|
| 690 |
+
</div>
|
| 691 |
+
`;
|
| 692 |
+
|
| 693 |
+
const footer = `
|
| 694 |
+
<button class="btn btn-secondary" onclick="Modal.close()" style="background: white; border: 1px solid var(--gray-300); color: var(--gray-700);">Cancel</button>
|
| 695 |
+
<button class="btn btn-primary" onclick="AgentDetailPage.createLink()" style="background: #0f172a; color: white;">Create Link</button>
|
| 696 |
+
`;
|
| 697 |
+
|
| 698 |
+
Modal.open('Create Share Link', content, footer);
|
| 699 |
+
|
| 700 |
+
// Styling the modal content wrapper via inline styles on the container if needed
|
| 701 |
+
const modalContainer = document.getElementById('modal');
|
| 702 |
+
if (modalContainer) {
|
| 703 |
+
modalContainer.style.maxWidth = '460px'; // Make it slightly narrower if needed to match image perfectly
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
// Setup toggles
|
| 707 |
+
document.getElementById('toggle-password')?.addEventListener('click', function () {
|
| 708 |
+
this.classList.toggle('active');
|
| 709 |
+
const pwdContainer = document.getElementById('password-input-container');
|
| 710 |
+
if (this.classList.contains('active')) {
|
| 711 |
+
pwdContainer.style.display = 'block';
|
| 712 |
+
document.getElementById('link-password').focus();
|
| 713 |
+
} else {
|
| 714 |
+
pwdContainer.style.display = 'none';
|
| 715 |
+
document.getElementById('link-password').value = ''; // clear when turned off
|
| 716 |
+
}
|
| 717 |
+
});
|
| 718 |
+
|
| 719 |
+
document.getElementById('toggle-require-name')?.addEventListener('click', function () {
|
| 720 |
+
this.classList.toggle('active');
|
| 721 |
+
});
|
| 722 |
+
document.getElementById('toggle-require-email')?.addEventListener('click', function () {
|
| 723 |
+
this.classList.toggle('active');
|
| 724 |
+
});
|
| 725 |
+
},
|
| 726 |
+
|
| 727 |
+
async createLink() {
|
| 728 |
+
const isPasswordProtected = document.getElementById('toggle-password').classList.contains('active');
|
| 729 |
+
const passwordValue = document.getElementById('link-password')?.value || '';
|
| 730 |
+
|
| 731 |
+
if (isPasswordProtected && !passwordValue.trim()) {
|
| 732 |
+
Toast.error('Please enter a password');
|
| 733 |
+
return;
|
| 734 |
+
}
|
| 735 |
+
|
| 736 |
+
let linkExpires = parseInt(document.getElementById('link-expires').value);
|
| 737 |
+
if (isNaN(linkExpires) || linkExpires <= 0) linkExpires = null;
|
| 738 |
+
|
| 739 |
+
let linkMaxUses = parseInt(document.getElementById('link-max-uses').value);
|
| 740 |
+
if (isNaN(linkMaxUses) || linkMaxUses <= 0) linkMaxUses = null;
|
| 741 |
+
|
| 742 |
+
const data = {
|
| 743 |
+
name: document.getElementById('link-name')?.value?.trim() || null,
|
| 744 |
+
password: isPasswordProtected ? passwordValue : null,
|
| 745 |
+
expires_days: linkExpires,
|
| 746 |
+
max_uses: linkMaxUses,
|
| 747 |
+
require_name: document.getElementById('toggle-require-name').classList.contains('active'),
|
| 748 |
+
require_email: document.getElementById('toggle-require-email').classList.contains('active')
|
| 749 |
+
};
|
| 750 |
+
|
| 751 |
+
try {
|
| 752 |
+
const { share_link } = await API.post(`/agents/${this.agent.id}/share-links`, data);
|
| 753 |
+
Modal.close();
|
| 754 |
+
Toast.success('Share link created');
|
| 755 |
+
this.copyLink(share_link.token);
|
| 756 |
+
this.loadShareLinks();
|
| 757 |
+
} catch (error) {
|
| 758 |
+
Toast.error('Failed to create link', error.message);
|
| 759 |
+
}
|
| 760 |
+
},
|
| 761 |
+
|
| 762 |
+
copyLink(token) {
|
| 763 |
+
const url = `${window.location.origin}${window.location.pathname}#/share/${token}`;
|
| 764 |
+
navigator.clipboard.writeText(url);
|
| 765 |
+
Toast.success('Link copied to clipboard');
|
| 766 |
+
},
|
| 767 |
+
|
| 768 |
+
async deleteLink(linkId) {
|
| 769 |
+
Modal.confirm(
|
| 770 |
+
'Delete Share Link',
|
| 771 |
+
'Are you sure you want to delete this share link? Anyone with this link will no longer be able to access the agent.',
|
| 772 |
+
async () => {
|
| 773 |
+
try {
|
| 774 |
+
await API.delete(`/share-links/${linkId}`);
|
| 775 |
+
Toast.success('Share link deleted');
|
| 776 |
+
this.loadShareLinks();
|
| 777 |
+
} catch (error) {
|
| 778 |
+
Toast.error('Failed to delete link', error.message);
|
| 779 |
+
}
|
| 780 |
+
},
|
| 781 |
+
'Delete',
|
| 782 |
+
true
|
| 783 |
+
);
|
| 784 |
+
},
|
| 785 |
+
|
| 786 |
+
deleteAgent() {
|
| 787 |
+
if (this.agent.is_default) {
|
| 788 |
+
Toast.error('Cannot delete system default agent');
|
| 789 |
+
return;
|
| 790 |
+
}
|
| 791 |
+
Modal.confirm(
|
| 792 |
+
'Delete Agent',
|
| 793 |
+
`Are you sure you want to delete "${this.agent.name}"? This will also delete all conversations and share links associated with this agent.`,
|
| 794 |
+
async () => {
|
| 795 |
+
try {
|
| 796 |
+
await API.delete(`/agents/${this.agent.id}`);
|
| 797 |
+
Toast.success('Agent deleted');
|
| 798 |
+
Router.navigate('/agents');
|
| 799 |
+
} catch (error) {
|
| 800 |
+
Toast.error('Failed to delete agent', error.message);
|
| 801 |
+
}
|
| 802 |
+
},
|
| 803 |
+
'Delete',
|
| 804 |
+
true
|
| 805 |
+
);
|
| 806 |
+
},
|
| 807 |
+
|
| 808 |
+
openRemoteControl() {
|
| 809 |
+
Router.navigate(`/anchoring-remote/${this.agent.id}`);
|
| 810 |
+
},
|
| 811 |
+
|
| 812 |
+
async startAnchoring() {
|
| 813 |
+
try {
|
| 814 |
+
const { conversation } = await API.post('/conversations', {
|
| 815 |
+
agent_id: this.agent.id,
|
| 816 |
+
mode: 'video'
|
| 817 |
+
});
|
| 818 |
+
window.open(`${window.location.origin}${window.location.pathname}#/anchoring/${conversation.id}`, '_blank');
|
| 819 |
+
} catch (error) {
|
| 820 |
+
Toast.error('Failed to start anchoring', error.message);
|
| 821 |
+
}
|
| 822 |
+
},
|
| 823 |
+
|
| 824 |
+
async saveScript() {
|
| 825 |
+
const textarea = document.getElementById('anc-detail-script');
|
| 826 |
+
if (!textarea) return;
|
| 827 |
+
|
| 828 |
+
try {
|
| 829 |
+
await API.post(`/agents/${this.agent.id}/anchoring/script`, {
|
| 830 |
+
script: textarea.value
|
| 831 |
+
});
|
| 832 |
+
this.agent.script_content = textarea.value;
|
| 833 |
+
Toast.success('Script saved successfully');
|
| 834 |
+
} catch (error) {
|
| 835 |
+
Toast.error('Failed to save script', error.message);
|
| 836 |
+
}
|
| 837 |
+
}
|
| 838 |
+
};
|
frontend/js/pages/agent-wizard.js
ADDED
|
@@ -0,0 +1,813 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* PersonaFlow - Agent Creation Wizard
|
| 3 |
+
*/
|
| 4 |
+
|
| 5 |
+
const AgentWizardPage = {
|
| 6 |
+
currentStep: 1,
|
| 7 |
+
agentData: {},
|
| 8 |
+
editMode: false,
|
| 9 |
+
agentId: null,
|
| 10 |
+
|
| 11 |
+
// Inspiration ideas shown on the scratch screen
|
| 12 |
+
scratchIdeas: [
|
| 13 |
+
{
|
| 14 |
+
icon: '🎤',
|
| 15 |
+
title: 'Public Speaking Coach',
|
| 16 |
+
role: 'Public Speaking & Presentation Coach',
|
| 17 |
+
goal: 'Help users practice and improve their public speaking, presentation style, and confidence.',
|
| 18 |
+
task_description: 'Run a live speaking drill. Ask the user to deliver a short speech on a topic, then give structured feedback on clarity, pacing, filler words, and confidence.',
|
| 19 |
+
rules: ['Give honest but encouraging feedback', 'Focus on one improvement area at a time', 'Use real examples to illustrate tips'],
|
| 20 |
+
tone: 'friendly',
|
| 21 |
+
knowledge: 'Public speaking techniques, anti-anxiety strategies, presentation structure, storytelling frameworks, body language advice.',
|
| 22 |
+
desc: 'Practice speeches and get real feedback on clarity, pacing & confidence.'
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
icon: '🧑💼',
|
| 26 |
+
title: 'Business Mentor',
|
| 27 |
+
role: 'Startup & Business Strategy Mentor',
|
| 28 |
+
goal: 'Guide entrepreneurs through business challenges, from idea validation to scaling strategies.',
|
| 29 |
+
task_description: 'Mentor the user on their business idea or current problem. Ask probing questions to uncover assumptions, challenge weak points, and suggest frameworks or next actions.',
|
| 30 |
+
rules: ['Ask clarifying questions before giving advice', 'Challenge assumptions respectfully', 'Reference real-world examples'],
|
| 31 |
+
tone: 'professional',
|
| 32 |
+
knowledge: 'Lean startup methodology, market validation, unit economics, fundraising, go-to-market strategy.',
|
| 33 |
+
desc: 'A sharp mentor to challenge your business ideas and guide strategy.'
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
icon: '🧘',
|
| 37 |
+
title: 'Daily Check-In',
|
| 38 |
+
role: 'Mindfulness & Wellness Companion',
|
| 39 |
+
goal: 'Provide a warm, non-judgmental space for daily emotional check-ins and mental wellness support.',
|
| 40 |
+
task_description: 'Start every session by checking in on how the user feels. Listen actively, then offer a coping strategy, breathing exercise, or a motivational nudge. Always clarify you are not a medical professional.',
|
| 41 |
+
rules: ['Never diagnose or prescribe', 'Keep responses warm and non-judgmental', 'Recommend professional help for serious issues'],
|
| 42 |
+
tone: 'friendly',
|
| 43 |
+
knowledge: 'Mindfulness techniques, CBT basics, breathing exercises, positive psychology, stress management.',
|
| 44 |
+
desc: 'A calming check-in companion for mindfulness and stress relief.'
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
icon: '📚',
|
| 48 |
+
title: 'Study Buddy',
|
| 49 |
+
role: 'Academic Tutor & Study Partner',
|
| 50 |
+
goal: 'Help students understand topics deeply through explanation, quizzes, and practice problems.',
|
| 51 |
+
task_description: 'Act as a tutor for the subject the user specifies. Explain concepts clearly, create practice questions, and quiz the user. Adapt difficulty based on their responses.',
|
| 52 |
+
rules: ['Explain WHY, not just HOW', 'Use simple analogies before technical detail', 'Quiz the user to test understanding'],
|
| 53 |
+
tone: 'friendly',
|
| 54 |
+
knowledge: 'Pedagogy, Socratic method, spaced repetition, active recall, a broad range of academic subjects.',
|
| 55 |
+
desc: 'A patient tutor who explains, quizzes, and adapts to your level.'
|
| 56 |
+
},
|
| 57 |
+
{
|
| 58 |
+
icon: '🚀',
|
| 59 |
+
title: 'Product Manager',
|
| 60 |
+
role: 'Senior Product Manager',
|
| 61 |
+
goal: 'Help teams define product requirements, prioritize features, and align on strategy.',
|
| 62 |
+
task_description: 'Run a product planning session. Help the user clarify user stories, identify the core problem, prioritize features using frameworks like RICE, and draft a roadmap narrative.',
|
| 63 |
+
rules: ['Always start with the user problem, not the solution', 'Apply RICE or MoSCoW prioritization', 'Push back if scope is too broad'],
|
| 64 |
+
tone: 'professional',
|
| 65 |
+
knowledge: 'Product management frameworks, RICE scoring, user story mapping, OKRs, agile methodologies.',
|
| 66 |
+
desc: 'A PM who helps you prioritize features and shape your product roadmap.'
|
| 67 |
+
}
|
| 68 |
+
],
|
| 69 |
+
|
| 70 |
+
async render(container, agentId = null) {
|
| 71 |
+
this.currentStep = 1;
|
| 72 |
+
this.agentData = {
|
| 73 |
+
name: '',
|
| 74 |
+
role: '',
|
| 75 |
+
goal: '',
|
| 76 |
+
opening_message: '',
|
| 77 |
+
task_description: '',
|
| 78 |
+
rules: [],
|
| 79 |
+
tone: 'professional',
|
| 80 |
+
knowledge: '',
|
| 81 |
+
output_config: {
|
| 82 |
+
summary: true,
|
| 83 |
+
transcript: true,
|
| 84 |
+
report: false,
|
| 85 |
+
evaluation: false,
|
| 86 |
+
criteria: []
|
| 87 |
+
},
|
| 88 |
+
icon: '🤖',
|
| 89 |
+
color: '#6366f1',
|
| 90 |
+
status: 'active'
|
| 91 |
+
};
|
| 92 |
+
this.editMode = !!agentId;
|
| 93 |
+
this.agentId = agentId;
|
| 94 |
+
|
| 95 |
+
if (this.editMode) {
|
| 96 |
+
try {
|
| 97 |
+
const { agent } = await API.get(`/agents/${agentId}`);
|
| 98 |
+
this.agentData = { ...this.agentData, ...agent };
|
| 99 |
+
} catch (error) {
|
| 100 |
+
Toast.error('Failed to load agent');
|
| 101 |
+
Router.navigate('/agents');
|
| 102 |
+
return;
|
| 103 |
+
}
|
| 104 |
+
// Edit mode: skip choice screen, go straight to wizard
|
| 105 |
+
this.renderWizard(container);
|
| 106 |
+
} else {
|
| 107 |
+
// New agent: show choice screen first
|
| 108 |
+
this.showChoiceScreen(container);
|
| 109 |
+
}
|
| 110 |
+
},
|
| 111 |
+
|
| 112 |
+
// ─────────────────────────────────────────────
|
| 113 |
+
// CHOICE SCREEN
|
| 114 |
+
// ─────────────────────────────────────────────
|
| 115 |
+
showChoiceScreen(container) {
|
| 116 |
+
container.innerHTML = `
|
| 117 |
+
<div class="choice-screen-wrapper">
|
| 118 |
+
<div class="page-header" style="text-align: center; display: block; margin-bottom: 2rem;">
|
| 119 |
+
<h1 class="page-title">Create New Agent</h1>
|
| 120 |
+
<p class="page-subtitle">How would you like to get started?</p>
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
<div class="choice-options">
|
| 124 |
+
<div class="choice-option" id="choice-scratch">
|
| 125 |
+
<div class="choice-option-icon">✍️</div>
|
| 126 |
+
<h2 class="choice-option-title">Build from Scratch</h2>
|
| 127 |
+
<p class="choice-option-desc">Design your agent step‑by‑step. Get inspiration ideas to spark your creativity.</p>
|
| 128 |
+
<button class="btn btn-primary btn-lg" id="btn-scratch">Start Building →</button>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<div class="choice-divider">
|
| 132 |
+
<span>or</span>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<div class="choice-option" id="choice-template">
|
| 136 |
+
<div class="choice-option-icon">✨</div>
|
| 137 |
+
<h2 class="choice-option-title">Use a Template</h2>
|
| 138 |
+
<p class="choice-option-desc">Pick a ready‑made agent from our library and go live in seconds.</p>
|
| 139 |
+
<button class="btn btn-outline btn-lg" id="btn-template">Browse Templates →</button>
|
| 140 |
+
</div>
|
| 141 |
+
</div>
|
| 142 |
+
</div>
|
| 143 |
+
`;
|
| 144 |
+
|
| 145 |
+
document.getElementById('btn-scratch').addEventListener('click', () => {
|
| 146 |
+
this.showScratchScreen(container);
|
| 147 |
+
});
|
| 148 |
+
|
| 149 |
+
document.getElementById('btn-template').addEventListener('click', () => {
|
| 150 |
+
this.showTemplateScreen(container);
|
| 151 |
+
});
|
| 152 |
+
},
|
| 153 |
+
|
| 154 |
+
// ─────────────────────────────────────────────
|
| 155 |
+
// SCRATCH SCREEN — idea inspiration
|
| 156 |
+
// ─────────────────────────────────────────────
|
| 157 |
+
showScratchScreen(container) {
|
| 158 |
+
container.innerHTML = `
|
| 159 |
+
<div style="max-width: 800px; margin: 0 auto;">
|
| 160 |
+
<div class="page-header">
|
| 161 |
+
<div>
|
| 162 |
+
<h1 class="page-title">Build from Scratch</h1>
|
| 163 |
+
<p class="page-subtitle">Need some inspiration? Pick an idea or start blank.</p>
|
| 164 |
+
</div>
|
| 165 |
+
<button class="btn btn-secondary" id="back-to-choice">← Back</button>
|
| 166 |
+
</div>
|
| 167 |
+
|
| 168 |
+
<div class="scratch-ideas-grid">
|
| 169 |
+
${this.scratchIdeas.map((idea, i) => `
|
| 170 |
+
<div class="scratch-idea-card" data-index="${i}">
|
| 171 |
+
<div class="scratch-idea-icon">${idea.icon}</div>
|
| 172 |
+
<div class="scratch-idea-title">${idea.title}</div>
|
| 173 |
+
<div class="scratch-idea-desc">${idea.desc}</div>
|
| 174 |
+
<button class="btn btn-outline btn-sm scratch-idea-use" data-index="${i}">Use this idea →</button>
|
| 175 |
+
</div>
|
| 176 |
+
`).join('')}
|
| 177 |
+
|
| 178 |
+
<div class="scratch-idea-card scratch-idea-blank" id="start-blank">
|
| 179 |
+
<div class="scratch-idea-icon">📄</div>
|
| 180 |
+
<div class="scratch-idea-title">Start Completely Blank</div>
|
| 181 |
+
<div class="scratch-idea-desc">Open the wizard with empty fields and build your own unique agent from the ground up.</div>
|
| 182 |
+
<button class="btn btn-primary btn-sm">Start Blank →</button>
|
| 183 |
+
</div>
|
| 184 |
+
</div>
|
| 185 |
+
</div>
|
| 186 |
+
`;
|
| 187 |
+
|
| 188 |
+
document.getElementById('back-to-choice').addEventListener('click', () => {
|
| 189 |
+
this.showChoiceScreen(container);
|
| 190 |
+
});
|
| 191 |
+
|
| 192 |
+
document.getElementById('start-blank').addEventListener('click', () => {
|
| 193 |
+
this.renderWizard(container);
|
| 194 |
+
});
|
| 195 |
+
|
| 196 |
+
document.querySelectorAll('.scratch-idea-use').forEach(btn => {
|
| 197 |
+
btn.addEventListener('click', () => {
|
| 198 |
+
const idx = parseInt(btn.dataset.index);
|
| 199 |
+
const idea = this.scratchIdeas[idx];
|
| 200 |
+
// Pre-fill agent data with the idea's suggestions
|
| 201 |
+
this.agentData.name = idea.title;
|
| 202 |
+
this.agentData.role = idea.role;
|
| 203 |
+
this.agentData.goal = idea.goal;
|
| 204 |
+
this.agentData.task_description = idea.task_description;
|
| 205 |
+
this.agentData.rules = [...idea.rules];
|
| 206 |
+
this.agentData.tone = idea.tone;
|
| 207 |
+
this.agentData.knowledge = idea.knowledge;
|
| 208 |
+
this.agentData.icon = idea.icon;
|
| 209 |
+
this.renderWizard(container);
|
| 210 |
+
});
|
| 211 |
+
});
|
| 212 |
+
},
|
| 213 |
+
|
| 214 |
+
// ─────────────────────────────────────────────
|
| 215 |
+
// TEMPLATE SCREEN — inline template gallery
|
| 216 |
+
// ─────────────────────────────────────────────
|
| 217 |
+
showTemplateScreen(container) {
|
| 218 |
+
const templates = TemplatesPage.templates;
|
| 219 |
+
|
| 220 |
+
container.innerHTML = `
|
| 221 |
+
<div style="max-width: 900px; margin: 0 auto;">
|
| 222 |
+
<div class="page-header">
|
| 223 |
+
<div>
|
| 224 |
+
<h1 class="page-title">Choose a Template</h1>
|
| 225 |
+
<p class="page-subtitle">Select an agent template to get started instantly.</p>
|
| 226 |
+
</div>
|
| 227 |
+
<button class="btn btn-secondary" id="back-to-choice">← Back</button>
|
| 228 |
+
</div>
|
| 229 |
+
|
| 230 |
+
<!-- Category Filter -->
|
| 231 |
+
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem;">
|
| 232 |
+
${TemplatesPage.categories.map((cat, i) => `
|
| 233 |
+
<button class="template-cat-btn ${i === 0 ? 'active' : ''}"
|
| 234 |
+
onclick="AgentWizardPage._filterTemplates('${cat}', this)"
|
| 235 |
+
data-category="${cat}">
|
| 236 |
+
${cat}
|
| 237 |
+
</button>
|
| 238 |
+
`).join('')}
|
| 239 |
+
</div>
|
| 240 |
+
|
| 241 |
+
<!-- Templates Grid -->
|
| 242 |
+
<div class="templates-grid" id="wizard-templates-grid">
|
| 243 |
+
${this._renderWizardTemplateCards(templates)}
|
| 244 |
+
</div>
|
| 245 |
+
</div>
|
| 246 |
+
`;
|
| 247 |
+
|
| 248 |
+
document.getElementById('back-to-choice').addEventListener('click', () => {
|
| 249 |
+
this.showChoiceScreen(container);
|
| 250 |
+
});
|
| 251 |
+
},
|
| 252 |
+
|
| 253 |
+
_filterTemplates(category, btn) {
|
| 254 |
+
document.querySelectorAll('.template-cat-btn').forEach(b => b.classList.remove('active'));
|
| 255 |
+
btn.classList.add('active');
|
| 256 |
+
const templates = TemplatesPage.templates;
|
| 257 |
+
const filtered = category === 'All' ? templates : templates.filter(t => t.category === category);
|
| 258 |
+
const grid = document.getElementById('wizard-templates-grid');
|
| 259 |
+
if (grid) grid.innerHTML = this._renderWizardTemplateCards(filtered);
|
| 260 |
+
},
|
| 261 |
+
|
| 262 |
+
_renderWizardTemplateCards(templates) {
|
| 263 |
+
return templates.map(t => `
|
| 264 |
+
<div class="template-card" data-category="${t.category}">
|
| 265 |
+
<div class="template-card-header" style="background: linear-gradient(135deg, ${t.color}22, ${t.color}11);">
|
| 266 |
+
<div class="template-icon" style="background: ${t.color}; color: white;">
|
| 267 |
+
${t.icon}
|
| 268 |
+
</div>
|
| 269 |
+
<div style="flex: 1;">
|
| 270 |
+
<div class="template-name">${t.name}</div>
|
| 271 |
+
<div class="template-role">${t.role}</div>
|
| 272 |
+
</div>
|
| 273 |
+
<span class="template-badge">${t.useCase}</span>
|
| 274 |
+
</div>
|
| 275 |
+
<div class="template-card-body">
|
| 276 |
+
<p class="template-description">${t.description}</p>
|
| 277 |
+
<div class="template-tags">
|
| 278 |
+
<span class="template-tag">${t.category}</span>
|
| 279 |
+
<span class="template-tag">${t.tone}</span>
|
| 280 |
+
</div>
|
| 281 |
+
</div>
|
| 282 |
+
<div class="template-card-footer">
|
| 283 |
+
<button class="btn btn-outline btn-sm" onclick="TemplatesPage.previewTemplate('${t.id}')">
|
| 284 |
+
👁 Preview
|
| 285 |
+
</button>
|
| 286 |
+
<button class="btn btn-primary btn-sm" onclick="AgentWizardPage.confirmUseTemplate('${t.id}')">
|
| 287 |
+
✨ Use Template
|
| 288 |
+
</button>
|
| 289 |
+
</div>
|
| 290 |
+
</div>
|
| 291 |
+
`).join('');
|
| 292 |
+
},
|
| 293 |
+
|
| 294 |
+
// Show confirmation modal before creating from template
|
| 295 |
+
confirmUseTemplate(id) {
|
| 296 |
+
const t = TemplatesPage.templates.find(t => t.id === id);
|
| 297 |
+
if (!t) return;
|
| 298 |
+
|
| 299 |
+
Modal.open(
|
| 300 |
+
`Use "${t.icon} ${t.name}" Template?`,
|
| 301 |
+
`
|
| 302 |
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
| 303 |
+
<div style="display: flex; align-items: center; gap: 1rem; padding: 1rem; background: ${t.color}11; border-radius: 12px; border: 1px solid ${t.color}33;">
|
| 304 |
+
<div style="font-size: 2.5rem;">${t.icon}</div>
|
| 305 |
+
<div>
|
| 306 |
+
<div style="font-weight: 700; font-size: 1.1rem; color: var(--gray-900);">${t.name}</div>
|
| 307 |
+
<div style="color: var(--gray-500); font-size: 0.875rem;">${t.role}</div>
|
| 308 |
+
</div>
|
| 309 |
+
</div>
|
| 310 |
+
<p style="color: var(--gray-600); line-height: 1.6; margin: 0;">
|
| 311 |
+
This will create a fully configured agent using the <strong>${t.name}</strong> template.
|
| 312 |
+
All fields — including rules, tone, and behavior — will be pre-filled based on the template.
|
| 313 |
+
</p>
|
| 314 |
+
<div style="background: var(--gray-50); border-radius: 8px; padding: 0.875rem; font-size: 0.875rem; color: var(--gray-600);">
|
| 315 |
+
💡 <strong>Tip:</strong> You can edit any detail on the agent detail page after creation.
|
| 316 |
+
</div>
|
| 317 |
+
</div>
|
| 318 |
+
`,
|
| 319 |
+
`
|
| 320 |
+
<button class="btn btn-secondary" onclick="Modal.close()">Cancel</button>
|
| 321 |
+
<button class="btn btn-primary" id="confirm-template-btn" onclick="AgentWizardPage.createFromTemplate('${id}')">
|
| 322 |
+
✨ Yes, Create Agent
|
| 323 |
+
</button>
|
| 324 |
+
`
|
| 325 |
+
);
|
| 326 |
+
},
|
| 327 |
+
|
| 328 |
+
async createFromTemplate(id) {
|
| 329 |
+
const t = TemplatesPage.templates.find(t => t.id === id);
|
| 330 |
+
if (!t) return;
|
| 331 |
+
|
| 332 |
+
const btn = document.getElementById('confirm-template-btn');
|
| 333 |
+
if (btn) { btn.disabled = true; btn.textContent = 'Creating...'; }
|
| 334 |
+
|
| 335 |
+
try {
|
| 336 |
+
Toast.info('Creating agent...', `Setting up ${t.name}`);
|
| 337 |
+
|
| 338 |
+
const agent = await API.post('/agents', {
|
| 339 |
+
name: t.name,
|
| 340 |
+
role: t.role,
|
| 341 |
+
goal: t.goal,
|
| 342 |
+
opening_message: `Hi! I'm ${t.name}. ${t.description} Let's get started!`,
|
| 343 |
+
task_description: t.task_description,
|
| 344 |
+
rules: t.rules,
|
| 345 |
+
tone: t.tone,
|
| 346 |
+
knowledge: t.knowledge,
|
| 347 |
+
output_config: { summary: true, transcript: true, evaluation: true, criteria: [] },
|
| 348 |
+
icon: t.icon,
|
| 349 |
+
color: t.color,
|
| 350 |
+
status: 'active'
|
| 351 |
+
});
|
| 352 |
+
|
| 353 |
+
Modal.close();
|
| 354 |
+
Toast.success('Agent created!', `${t.name} is ready to use`);
|
| 355 |
+
Router.navigate(`/agents/${agent.agent.id}`);
|
| 356 |
+
} catch (error) {
|
| 357 |
+
Toast.error('Failed to create agent', error.message);
|
| 358 |
+
if (btn) { btn.disabled = false; btn.textContent = '✨ Yes, Create Agent'; }
|
| 359 |
+
}
|
| 360 |
+
},
|
| 361 |
+
|
| 362 |
+
// ─────────────────────────────────────────────
|
| 363 |
+
// WIZARD
|
| 364 |
+
// ─────────────────────────────────────────────
|
| 365 |
+
renderWizard(container) {
|
| 366 |
+
container.innerHTML = `
|
| 367 |
+
<div style="max-width: 700px; margin: 0 auto;">
|
| 368 |
+
<div class="page-header">
|
| 369 |
+
<div>
|
| 370 |
+
<h1 class="page-title">${this.editMode ? 'Edit Agent' : 'Create New Agent'}</h1>
|
| 371 |
+
<p class="page-subtitle">Configure your AI conversation agent</p>
|
| 372 |
+
</div>
|
| 373 |
+
${!this.editMode ? `<button class="btn btn-secondary" id="wizard-back-btn">← Back</button>` : ''}
|
| 374 |
+
</div>
|
| 375 |
+
|
| 376 |
+
<div class="wizard-progress">
|
| 377 |
+
<div class="wizard-step">
|
| 378 |
+
<div class="step-indicator ${this.currentStep >= 1 ? 'active' : ''} ${this.currentStep > 1 ? 'completed' : ''}" data-step="1">
|
| 379 |
+
<div class="step-circle">1</div>
|
| 380 |
+
<span class="step-label">Identity</span>
|
| 381 |
+
</div>
|
| 382 |
+
</div>
|
| 383 |
+
<div class="step-connector ${this.currentStep > 1 ? 'completed' : ''}"></div>
|
| 384 |
+
<div class="wizard-step">
|
| 385 |
+
<div class="step-indicator ${this.currentStep >= 2 ? 'active' : ''} ${this.currentStep > 2 ? 'completed' : ''}" data-step="2">
|
| 386 |
+
<div class="step-circle">2</div>
|
| 387 |
+
<span class="step-label">Behavior</span>
|
| 388 |
+
</div>
|
| 389 |
+
</div>
|
| 390 |
+
<div class="step-connector ${this.currentStep > 2 ? 'completed' : ''}"></div>
|
| 391 |
+
<div class="wizard-step">
|
| 392 |
+
<div class="step-indicator ${this.currentStep >= 3 ? 'active' : ''} ${this.currentStep > 3 ? 'completed' : ''}" data-step="3">
|
| 393 |
+
<div class="step-circle">3</div>
|
| 394 |
+
<span class="step-label">Output</span>
|
| 395 |
+
</div>
|
| 396 |
+
</div>
|
| 397 |
+
<div class="step-connector ${this.currentStep > 3 ? 'completed' : ''}"></div>
|
| 398 |
+
<div class="wizard-step">
|
| 399 |
+
<div class="step-indicator ${this.currentStep >= 4 ? 'active' : ''}" data-step="4">
|
| 400 |
+
<div class="step-circle">4</div>
|
| 401 |
+
<span class="step-label">Customize</span>
|
| 402 |
+
</div>
|
| 403 |
+
</div>
|
| 404 |
+
</div>
|
| 405 |
+
|
| 406 |
+
<div class="card">
|
| 407 |
+
<div id="wizard-content">
|
| 408 |
+
${this.renderStep()}
|
| 409 |
+
</div>
|
| 410 |
+
|
| 411 |
+
<div style="display: flex; justify-content: space-between; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--gray-100);">
|
| 412 |
+
<button class="btn btn-secondary" id="prev-btn" ${this.currentStep === 1 ? 'style="visibility: hidden;"' : ''}>
|
| 413 |
+
← Previous
|
| 414 |
+
</button>
|
| 415 |
+
<button class="btn btn-primary" id="next-btn">
|
| 416 |
+
${this.currentStep === 4 ? (this.editMode ? 'Save Changes' : 'Create Agent') : 'Next →'}
|
| 417 |
+
</button>
|
| 418 |
+
</div>
|
| 419 |
+
</div>
|
| 420 |
+
</div>
|
| 421 |
+
`;
|
| 422 |
+
|
| 423 |
+
this.setupListeners();
|
| 424 |
+
},
|
| 425 |
+
|
| 426 |
+
renderStep() {
|
| 427 |
+
switch (this.currentStep) {
|
| 428 |
+
case 1: return this.renderStep1();
|
| 429 |
+
case 2: return this.renderStep2();
|
| 430 |
+
case 3: return this.renderStep3();
|
| 431 |
+
case 4: return this.renderStep4();
|
| 432 |
+
default: return '';
|
| 433 |
+
}
|
| 434 |
+
},
|
| 435 |
+
|
| 436 |
+
renderStep1() {
|
| 437 |
+
return `
|
| 438 |
+
<h3 style="margin-bottom: 1.5rem; color: var(--gray-900);">Agent Identity</h3>
|
| 439 |
+
|
| 440 |
+
<div class="form-group">
|
| 441 |
+
<label class="form-label">Agent Name *</label>
|
| 442 |
+
<input type="text" id="agent-name" class="form-input" placeholder="e.g., Alex the Interviewer" value="${this.agentData.name}" required>
|
| 443 |
+
</div>
|
| 444 |
+
|
| 445 |
+
<div class="form-group">
|
| 446 |
+
<label class="form-label">Role *</label>
|
| 447 |
+
<input type="text" id="agent-role" class="form-input" placeholder="e.g., Technical Interviewer" value="${this.agentData.role}" required>
|
| 448 |
+
</div>
|
| 449 |
+
|
| 450 |
+
<div class="form-group">
|
| 451 |
+
<label class="form-label">Main Goal</label>
|
| 452 |
+
<textarea id="agent-goal" class="form-textarea" placeholder="What is the primary objective of this agent?">${this.agentData.goal}</textarea>
|
| 453 |
+
</div>
|
| 454 |
+
|
| 455 |
+
<div class="form-group">
|
| 456 |
+
<label class="form-label">Opening Message</label>
|
| 457 |
+
<textarea id="agent-opening" class="form-textarea" placeholder="The first message the agent will send to start the conversation">${this.agentData.opening_message}</textarea>
|
| 458 |
+
<div class="form-help">This message will be shown when a conversation starts</div>
|
| 459 |
+
</div>
|
| 460 |
+
`;
|
| 461 |
+
},
|
| 462 |
+
|
| 463 |
+
renderStep2() {
|
| 464 |
+
const rulesHtml = this.agentData.rules.map((rule, i) => `
|
| 465 |
+
<div class="rule-row flex items-center gap-2 mb-2">
|
| 466 |
+
<input type="text" class="form-input rule-input" value="${this._escapeHtml(rule)}" data-index="${i}" style="flex: 1;" placeholder="e.g., Always be respectful">
|
| 467 |
+
<button class="btn btn-icon btn-secondary remove-rule" data-index="${i}" type="button">✕</button>
|
| 468 |
+
</div>
|
| 469 |
+
`).join('');
|
| 470 |
+
|
| 471 |
+
return `
|
| 472 |
+
<h3 style="margin-bottom: 1.5rem; color: var(--gray-900);">Agent Behavior</h3>
|
| 473 |
+
|
| 474 |
+
<div class="form-group">
|
| 475 |
+
<label class="form-label">Task Description</label>
|
| 476 |
+
<textarea id="agent-task" class="form-textarea" placeholder="Describe what the agent should do in conversations">${this.agentData.task_description}</textarea>
|
| 477 |
+
</div>
|
| 478 |
+
|
| 479 |
+
<div class="form-group">
|
| 480 |
+
<label class="form-label">Rules & Constraints</label>
|
| 481 |
+
<div id="rules-container">
|
| 482 |
+
${rulesHtml}
|
| 483 |
+
</div>
|
| 484 |
+
<button class="btn btn-secondary btn-sm" id="add-rule-btn" type="button">+ Add Rule</button>
|
| 485 |
+
<div class="form-help">Define rules the agent must follow (e.g., "Always be respectful")</div>
|
| 486 |
+
</div>
|
| 487 |
+
|
| 488 |
+
<div class="form-group">
|
| 489 |
+
<label class="form-label">Tone</label>
|
| 490 |
+
<select id="agent-tone" class="form-select">
|
| 491 |
+
<option value="professional" ${this.agentData.tone === 'professional' ? 'selected' : ''}>Professional</option>
|
| 492 |
+
<option value="friendly" ${this.agentData.tone === 'friendly' ? 'selected' : ''}>Friendly</option>
|
| 493 |
+
<option value="formal" ${this.agentData.tone === 'formal' ? 'selected' : ''}>Formal</option>
|
| 494 |
+
<option value="casual" ${this.agentData.tone === 'casual' ? 'selected' : ''}>Casual</option>
|
| 495 |
+
<option value="empathetic" ${this.agentData.tone === 'empathetic' ? 'selected' : ''}>Empathetic</option>
|
| 496 |
+
<option value="analytical" ${this.agentData.tone === 'analytical' ? 'selected' : ''}>Analytical</option>
|
| 497 |
+
</select>
|
| 498 |
+
</div>
|
| 499 |
+
|
| 500 |
+
<div class="form-group">
|
| 501 |
+
<label class="form-label">Custom Knowledge</label>
|
| 502 |
+
<textarea id="agent-knowledge" class="form-textarea" placeholder="Add specific knowledge or context the agent should know about">${this.agentData.knowledge}</textarea>
|
| 503 |
+
</div>
|
| 504 |
+
`;
|
| 505 |
+
},
|
| 506 |
+
|
| 507 |
+
renderStep3() {
|
| 508 |
+
const config = this.agentData.output_config;
|
| 509 |
+
const criteriaHtml = (config.criteria || []).map((c, i) => `
|
| 510 |
+
<div class="flex items-center gap-2 mb-2">
|
| 511 |
+
<input type="text" class="form-input criteria-name" value="${this._escapeHtml(c.name)}" placeholder="Criteria name" style="flex: 2;">
|
| 512 |
+
<input type="number" class="form-input criteria-weight" value="${c.weight}" placeholder="Weight" min="1" max="10" style="width: 80px;">
|
| 513 |
+
<button class="btn btn-icon btn-secondary remove-criteria" data-index="${i}" type="button">✕</button>
|
| 514 |
+
</div>
|
| 515 |
+
`).join('');
|
| 516 |
+
|
| 517 |
+
return `
|
| 518 |
+
<h3 style="margin-bottom: 1.5rem; color: var(--gray-900);">Output Configuration</h3>
|
| 519 |
+
|
| 520 |
+
<p style="color: var(--gray-600); margin-bottom: 1.5rem;">Choose what to generate after conversations end</p>
|
| 521 |
+
|
| 522 |
+
<div class="form-group">
|
| 523 |
+
<div class="toggle-wrapper mb-3">
|
| 524 |
+
<div class="toggle ${config.summary ? 'active' : ''}" id="toggle-summary"></div>
|
| 525 |
+
<span class="toggle-label">Generate Summary</span>
|
| 526 |
+
</div>
|
| 527 |
+
|
| 528 |
+
<div class="toggle-wrapper mb-3">
|
| 529 |
+
<div class="toggle ${config.transcript ? 'active' : ''}" id="toggle-transcript"></div>
|
| 530 |
+
<span class="toggle-label">Save Transcript</span>
|
| 531 |
+
</div>
|
| 532 |
+
|
| 533 |
+
<div class="toggle-wrapper mb-3">
|
| 534 |
+
<div class="toggle ${config.evaluation ? 'active' : ''}" id="toggle-evaluation"></div>
|
| 535 |
+
<span class="toggle-label">Enable Evaluation & Scoring</span>
|
| 536 |
+
</div>
|
| 537 |
+
</div>
|
| 538 |
+
|
| 539 |
+
<div id="criteria-section" style="${config.evaluation ? '' : 'display: none;'}">
|
| 540 |
+
<div class="form-group">
|
| 541 |
+
<label class="form-label">Evaluation Criteria</label>
|
| 542 |
+
<div id="criteria-container">
|
| 543 |
+
${criteriaHtml}
|
| 544 |
+
</div>
|
| 545 |
+
<button class="btn btn-secondary btn-sm" id="add-criteria-btn" type="button">+ Add Criteria</button>
|
| 546 |
+
<div class="form-help">Define criteria with weights (1-10) for scoring</div>
|
| 547 |
+
</div>
|
| 548 |
+
</div>
|
| 549 |
+
`;
|
| 550 |
+
},
|
| 551 |
+
|
| 552 |
+
renderStep4() {
|
| 553 |
+
const icons = ['🤖', '👤', '💼', '🎓', '🏢', '💡', '🎯', '📊', '🔬', '⚡', '🌟', '🚀', '🎤', '🧘', '📚', '🌍', '🎧', '⚖️', '💻', '📋', '🌱', '🧑💼'];
|
| 554 |
+
const colors = ['#6366f1', '#8b5cf6', '#ec4899', '#f43f5e', '#f97316', '#eab308', '#22c55e', '#14b8a6', '#0ea5e9', '#3b82f6'];
|
| 555 |
+
|
| 556 |
+
return `
|
| 557 |
+
<h3 style="margin-bottom: 1.5rem; color: var(--gray-900);">Customize Appearance</h3>
|
| 558 |
+
|
| 559 |
+
<div class="form-group">
|
| 560 |
+
<label class="form-label">Choose Icon</label>
|
| 561 |
+
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem;">
|
| 562 |
+
${icons.map(icon => `
|
| 563 |
+
<button class="icon-option ${this.agentData.icon === icon ? 'selected' : ''}" data-icon="${icon}" style="width: 48px; height: 48px; font-size: 1.5rem; border-radius: var(--border-radius); border: 2px solid ${this.agentData.icon === icon ? 'var(--primary-500)' : 'var(--gray-200)'}; background: white; cursor: pointer;" type="button">
|
| 564 |
+
${icon}
|
| 565 |
+
</button>
|
| 566 |
+
`).join('')}
|
| 567 |
+
</div>
|
| 568 |
+
</div>
|
| 569 |
+
|
| 570 |
+
<div class="form-group">
|
| 571 |
+
<label class="form-label">Choose Color</label>
|
| 572 |
+
<div style="display: flex; flex-wrap: wrap; gap: 0.5rem;">
|
| 573 |
+
${colors.map(color => `
|
| 574 |
+
<button class="color-option ${this.agentData.color === color ? 'selected' : ''}" data-color="${color}" style="width: 40px; height: 40px; border-radius: 50%; border: 3px solid ${this.agentData.color === color ? 'var(--gray-900)' : 'transparent'}; background: ${color}; cursor: pointer;" type="button"></button>
|
| 575 |
+
`).join('')}
|
| 576 |
+
</div>
|
| 577 |
+
</div>
|
| 578 |
+
|
| 579 |
+
<div class="form-group">
|
| 580 |
+
<label class="form-label">Status</label>
|
| 581 |
+
<div class="toggle-wrapper">
|
| 582 |
+
<div class="toggle ${this.agentData.status === 'active' ? 'active' : ''}" id="toggle-status"></div>
|
| 583 |
+
<span class="toggle-label">${this.agentData.status === 'active' ? 'Active' : 'Inactive'}</span>
|
| 584 |
+
</div>
|
| 585 |
+
</div>
|
| 586 |
+
|
| 587 |
+
<div style="margin-top: 2rem; padding: 1.5rem; background: var(--gray-50); border-radius: var(--border-radius-lg);">
|
| 588 |
+
<h4 style="margin-bottom: 1rem; color: var(--gray-900);">Preview</h4>
|
| 589 |
+
<div class="flex items-center gap-4">
|
| 590 |
+
<div class="agent-icon" style="width: 64px; height: 64px; background: ${this.agentData.color}; font-size: 2rem;" id="preview-icon">${this.agentData.icon}</div>
|
| 591 |
+
<div>
|
| 592 |
+
<div style="font-size: 1.25rem; font-weight: 600; color: var(--gray-900);" id="preview-name">${this.agentData.name || 'Agent Name'}</div>
|
| 593 |
+
<div style="color: var(--gray-500);" id="preview-role">${this.agentData.role || 'Role'}</div>
|
| 594 |
+
</div>
|
| 595 |
+
</div>
|
| 596 |
+
</div>
|
| 597 |
+
`;
|
| 598 |
+
},
|
| 599 |
+
|
| 600 |
+
setupListeners() {
|
| 601 |
+
// Back button (shown on wizard when not in edit mode)
|
| 602 |
+
document.getElementById('wizard-back-btn')?.addEventListener('click', () => {
|
| 603 |
+
const container = document.getElementById('main-content');
|
| 604 |
+
this.showScratchScreen(container);
|
| 605 |
+
});
|
| 606 |
+
|
| 607 |
+
// Previous button
|
| 608 |
+
document.getElementById('prev-btn')?.addEventListener('click', () => {
|
| 609 |
+
this.saveCurrentStep();
|
| 610 |
+
this.currentStep--;
|
| 611 |
+
this.renderWizard(document.getElementById('main-content'));
|
| 612 |
+
});
|
| 613 |
+
|
| 614 |
+
// Next button
|
| 615 |
+
document.getElementById('next-btn')?.addEventListener('click', async () => {
|
| 616 |
+
if (!this.validateStep()) return;
|
| 617 |
+
this.saveCurrentStep();
|
| 618 |
+
|
| 619 |
+
if (this.currentStep === 4) {
|
| 620 |
+
await this.submitAgent();
|
| 621 |
+
} else {
|
| 622 |
+
this.currentStep++;
|
| 623 |
+
this.renderWizard(document.getElementById('main-content'));
|
| 624 |
+
}
|
| 625 |
+
});
|
| 626 |
+
|
| 627 |
+
this.setupStepListeners();
|
| 628 |
+
},
|
| 629 |
+
|
| 630 |
+
setupStepListeners() {
|
| 631 |
+
// Step 2 — Rules
|
| 632 |
+
document.getElementById('add-rule-btn')?.addEventListener('click', () => {
|
| 633 |
+
// FIX: sync current rule input values to agentData BEFORE adding new entry
|
| 634 |
+
const ruleInputs = document.querySelectorAll('.rule-input');
|
| 635 |
+
this.agentData.rules = Array.from(ruleInputs).map(inp => inp.value);
|
| 636 |
+
// Push a blank new rule
|
| 637 |
+
this.agentData.rules.push('');
|
| 638 |
+
// Re-render only the rules section
|
| 639 |
+
document.getElementById('rules-container').innerHTML = this.agentData.rules.map((rule, i) => `
|
| 640 |
+
<div class="rule-row flex items-center gap-2 mb-2">
|
| 641 |
+
<input type="text" class="form-input rule-input" value="${this._escapeHtml(rule)}" data-index="${i}" style="flex: 1;" placeholder="e.g., Always be respectful">
|
| 642 |
+
<button class="btn btn-icon btn-secondary remove-rule" data-index="${i}" type="button">✕</button>
|
| 643 |
+
</div>
|
| 644 |
+
`).join('');
|
| 645 |
+
// Re-bind remove listeners
|
| 646 |
+
this._bindRemoveRuleListeners();
|
| 647 |
+
// Focus the new input
|
| 648 |
+
const inputs = document.querySelectorAll('.rule-input');
|
| 649 |
+
if (inputs.length > 0) inputs[inputs.length - 1].focus();
|
| 650 |
+
});
|
| 651 |
+
|
| 652 |
+
this._bindRemoveRuleListeners();
|
| 653 |
+
|
| 654 |
+
// Step 3 — Toggles and Criteria
|
| 655 |
+
document.getElementById('toggle-summary')?.addEventListener('click', function () {
|
| 656 |
+
this.classList.toggle('active');
|
| 657 |
+
});
|
| 658 |
+
|
| 659 |
+
document.getElementById('toggle-transcript')?.addEventListener('click', function () {
|
| 660 |
+
this.classList.toggle('active');
|
| 661 |
+
});
|
| 662 |
+
|
| 663 |
+
document.getElementById('toggle-evaluation')?.addEventListener('click', function () {
|
| 664 |
+
this.classList.toggle('active');
|
| 665 |
+
document.getElementById('criteria-section').style.display = this.classList.contains('active') ? '' : 'none';
|
| 666 |
+
});
|
| 667 |
+
|
| 668 |
+
document.getElementById('add-criteria-btn')?.addEventListener('click', () => {
|
| 669 |
+
if (!this.agentData.output_config.criteria) {
|
| 670 |
+
this.agentData.output_config.criteria = [];
|
| 671 |
+
}
|
| 672 |
+
this.agentData.output_config.criteria.push({ name: '', weight: 1 });
|
| 673 |
+
this.saveCurrentStep();
|
| 674 |
+
document.getElementById('wizard-content').innerHTML = this.renderStep();
|
| 675 |
+
this.setupStepListeners();
|
| 676 |
+
});
|
| 677 |
+
|
| 678 |
+
document.querySelectorAll('.remove-criteria').forEach(btn => {
|
| 679 |
+
btn.addEventListener('click', () => {
|
| 680 |
+
const index = parseInt(btn.dataset.index);
|
| 681 |
+
this.agentData.output_config.criteria.splice(index, 1);
|
| 682 |
+
this.saveCurrentStep();
|
| 683 |
+
document.getElementById('wizard-content').innerHTML = this.renderStep();
|
| 684 |
+
this.setupStepListeners();
|
| 685 |
+
});
|
| 686 |
+
});
|
| 687 |
+
|
| 688 |
+
// Step 4 — Icons, Colors, Status
|
| 689 |
+
document.querySelectorAll('.icon-option').forEach(btn => {
|
| 690 |
+
btn.addEventListener('click', () => {
|
| 691 |
+
document.querySelectorAll('.icon-option').forEach(b => b.style.borderColor = 'var(--gray-200)');
|
| 692 |
+
btn.style.borderColor = 'var(--primary-500)';
|
| 693 |
+
this.agentData.icon = btn.dataset.icon;
|
| 694 |
+
const pi = document.getElementById('preview-icon');
|
| 695 |
+
if (pi) pi.textContent = btn.dataset.icon;
|
| 696 |
+
});
|
| 697 |
+
});
|
| 698 |
+
|
| 699 |
+
document.querySelectorAll('.color-option').forEach(btn => {
|
| 700 |
+
btn.addEventListener('click', () => {
|
| 701 |
+
document.querySelectorAll('.color-option').forEach(b => b.style.borderColor = 'transparent');
|
| 702 |
+
btn.style.borderColor = 'var(--gray-900)';
|
| 703 |
+
this.agentData.color = btn.dataset.color;
|
| 704 |
+
const pi = document.getElementById('preview-icon');
|
| 705 |
+
if (pi) pi.style.background = btn.dataset.color;
|
| 706 |
+
});
|
| 707 |
+
});
|
| 708 |
+
|
| 709 |
+
document.getElementById('toggle-status')?.addEventListener('click', function () {
|
| 710 |
+
this.classList.toggle('active');
|
| 711 |
+
this.nextElementSibling.textContent = this.classList.contains('active') ? 'Active' : 'Inactive';
|
| 712 |
+
});
|
| 713 |
+
},
|
| 714 |
+
|
| 715 |
+
_bindRemoveRuleListeners() {
|
| 716 |
+
document.querySelectorAll('.remove-rule').forEach(btn => {
|
| 717 |
+
btn.addEventListener('click', () => {
|
| 718 |
+
// FIX: sync inputs before removing
|
| 719 |
+
const ruleInputs = document.querySelectorAll('.rule-input');
|
| 720 |
+
this.agentData.rules = Array.from(ruleInputs).map(inp => inp.value);
|
| 721 |
+
const index = parseInt(btn.dataset.index);
|
| 722 |
+
this.agentData.rules.splice(index, 1);
|
| 723 |
+
document.getElementById('rules-container').innerHTML = this.agentData.rules.map((rule, i) => `
|
| 724 |
+
<div class="rule-row flex items-center gap-2 mb-2">
|
| 725 |
+
<input type="text" class="form-input rule-input" value="${this._escapeHtml(rule)}" data-index="${i}" style="flex: 1;" placeholder="e.g., Always be respectful">
|
| 726 |
+
<button class="btn btn-icon btn-secondary remove-rule" data-index="${i}" type="button">✕</button>
|
| 727 |
+
</div>
|
| 728 |
+
`).join('');
|
| 729 |
+
this._bindRemoveRuleListeners();
|
| 730 |
+
});
|
| 731 |
+
});
|
| 732 |
+
},
|
| 733 |
+
|
| 734 |
+
_escapeHtml(str) {
|
| 735 |
+
return String(str)
|
| 736 |
+
.replace(/&/g, '&')
|
| 737 |
+
.replace(/</g, '<')
|
| 738 |
+
.replace(/>/g, '>')
|
| 739 |
+
.replace(/"/g, '"')
|
| 740 |
+
.replace(/'/g, ''');
|
| 741 |
+
},
|
| 742 |
+
|
| 743 |
+
validateStep() {
|
| 744 |
+
if (this.currentStep === 1) {
|
| 745 |
+
const name = document.getElementById('agent-name')?.value.trim();
|
| 746 |
+
const role = document.getElementById('agent-role')?.value.trim();
|
| 747 |
+
if (!name) { Toast.error('Agent name is required'); return false; }
|
| 748 |
+
if (!role) { Toast.error('Role is required'); return false; }
|
| 749 |
+
}
|
| 750 |
+
return true;
|
| 751 |
+
},
|
| 752 |
+
|
| 753 |
+
saveCurrentStep() {
|
| 754 |
+
switch (this.currentStep) {
|
| 755 |
+
case 1:
|
| 756 |
+
this.agentData.name = document.getElementById('agent-name')?.value.trim() || '';
|
| 757 |
+
this.agentData.role = document.getElementById('agent-role')?.value.trim() || '';
|
| 758 |
+
this.agentData.goal = document.getElementById('agent-goal')?.value.trim() || '';
|
| 759 |
+
this.agentData.opening_message = document.getElementById('agent-opening')?.value.trim() || '';
|
| 760 |
+
break;
|
| 761 |
+
|
| 762 |
+
case 2:
|
| 763 |
+
this.agentData.task_description = document.getElementById('agent-task')?.value.trim() || '';
|
| 764 |
+
this.agentData.tone = document.getElementById('agent-tone')?.value || 'professional';
|
| 765 |
+
this.agentData.knowledge = document.getElementById('agent-knowledge')?.value.trim() || '';
|
| 766 |
+
// Collect all rule inputs (even empty ones mid-edit, will be filtered on submit)
|
| 767 |
+
const ruleInputs = document.querySelectorAll('.rule-input');
|
| 768 |
+
this.agentData.rules = Array.from(ruleInputs).map(input => input.value.trim()).filter(r => r);
|
| 769 |
+
break;
|
| 770 |
+
|
| 771 |
+
case 3:
|
| 772 |
+
this.agentData.output_config = {
|
| 773 |
+
summary: document.getElementById('toggle-summary')?.classList.contains('active') ?? true,
|
| 774 |
+
transcript: document.getElementById('toggle-transcript')?.classList.contains('active') ?? true,
|
| 775 |
+
evaluation: document.getElementById('toggle-evaluation')?.classList.contains('active') ?? false,
|
| 776 |
+
criteria: []
|
| 777 |
+
};
|
| 778 |
+
const criteriaNames = document.querySelectorAll('.criteria-name');
|
| 779 |
+
const criteriaWeights = document.querySelectorAll('.criteria-weight');
|
| 780 |
+
for (let i = 0; i < criteriaNames.length; i++) {
|
| 781 |
+
const name = criteriaNames[i].value.trim();
|
| 782 |
+
const weight = parseInt(criteriaWeights[i].value) || 1;
|
| 783 |
+
if (name) { this.agentData.output_config.criteria.push({ name, weight }); }
|
| 784 |
+
}
|
| 785 |
+
break;
|
| 786 |
+
|
| 787 |
+
case 4:
|
| 788 |
+
this.agentData.status = document.getElementById('toggle-status')?.classList.contains('active') ? 'active' : 'inactive';
|
| 789 |
+
break;
|
| 790 |
+
}
|
| 791 |
+
},
|
| 792 |
+
|
| 793 |
+
async submitAgent() {
|
| 794 |
+
const btn = document.getElementById('next-btn');
|
| 795 |
+
btn.disabled = true;
|
| 796 |
+
btn.textContent = this.editMode ? 'Saving...' : 'Creating...';
|
| 797 |
+
|
| 798 |
+
try {
|
| 799 |
+
if (this.editMode) {
|
| 800 |
+
await API.put(`/agents/${this.agentId}`, this.agentData);
|
| 801 |
+
Toast.success('Agent updated successfully');
|
| 802 |
+
} else {
|
| 803 |
+
const { agent } = await API.post('/agents', this.agentData);
|
| 804 |
+
Toast.success('Agent created successfully');
|
| 805 |
+
}
|
| 806 |
+
Router.navigate('/agents');
|
| 807 |
+
} catch (error) {
|
| 808 |
+
Toast.error('Failed to save agent', error.message);
|
| 809 |
+
btn.disabled = false;
|
| 810 |
+
btn.textContent = this.editMode ? 'Save Changes' : 'Create Agent';
|
| 811 |
+
}
|
| 812 |
+
}
|
| 813 |
+
};
|