VirtualKimi commited on
Commit
5feb37d
Β·
verified Β·
1 Parent(s): 9aa357b

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +432 -1
README.md CHANGED
@@ -9,4 +9,435 @@ pinned: true
9
  short_description: AI girlfriend and companion with evolving personality
10
  ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  short_description: AI girlfriend and companion with evolving personality
10
  ---
11
 
12
+ <div align="center">
13
+
14
+ <b>Virtual Kimi</b>
15
+
16
+ [![Open Source](https://img.shields.io/badge/Open%20Source-GitHub-brightgreen?style=flat-square&logo=github)](https://github.com/virtualkimi)
17
+ [![No Commercial Use](https://img.shields.io/badge/No%20Commercial%20Use-%F0%9F%9A%AB-red?style=flat-square)](#license)
18
+
19
+ </div>
20
+
21
+ # Virtual Kimi - AI Companion Application πŸ’–
22
+
23
+ Web-based AI girlfriend and companion featuring adaptive personalities, intelligent memory systems, and immersive conversational experiences.
24
+
25
+ ## Overview
26
+
27
+ Virtual Kimi is an advanced virtual companion application that combines modern web technologies with state-of-the-art AI models to create meaningful, evolving relationships between users and AI girlfriend personalities.
28
+
29
+ - **Lightweight:** ~800 KB of pure JavaScript, HTML, and CSS (no frameworks)
30
+ - **Local-first:** All data is stored in your browser's IndexedDB (managed by Dexie.js)
31
+ - **No tracking:** The only external calls are to FontAwesome (for icons) and the OpenRouter API (for AI)
32
+
33
+ Built with vanilla JavaScript and modern web APIs, it offers a rich, responsive experience across devices.
34
+
35
+ ---
36
+
37
+ ## 🌐 Support & Links
38
+
39
+ - **Website**: [virtualkimi.com](https://virtual-kimi.com)
40
+ - **Email**: [ijohn@virtualkimi.com](ijohn@virtualkimi.com)
41
+ - **X (Twitter)**: [x.com/virtualkimi](https://x.com/virtualkimi)
42
+ - **GitHub**: [github.com/virtualkimi](https://github.com/virtualkimi)
43
+ - **HuggingFace**: [huggingface.co/VirtualKimi](https://huggingface.co/VirtualKimi)
44
+ - **YouTube**: [YouTube Channel](https://www.youtube.com/@VirtualKimi)
45
+
46
+ - **Support the project**: [ko-fi.com/virtualkimi](https://ko-fi.com/virtualkimi)
47
+ _If you like this project or want to help me (I'm currently without a permanent job), you can buy me a coffee or make a donation. Every bit helps keep Virtual Kimi alive and evolving!_
48
+
49
+ - **ETH Wallet**: 0x836C9D2e605f98Bc7144C62Bef837627b1a9C30c
50
+
51
+ ---
52
+
53
+ ## Key Features
54
+
55
+ ### πŸ€– **Advanced AI Integration**
56
+
57
+ Recommended models (IDs and short notes β€” updated Aug 2025):
58
+
59
+ - mistralai/mistral-small-3.2-24b-instruct β€” Mistral-small-3.2 (128k context, economical)
60
+ - qwen/qwen3-30b-a3b-instruct-2507 β€” Qwen3 30b (131k context)
61
+ - nousresearch/hermes-4-70b β€” Nous Hermes 4 70B (131k context)
62
+ - x-ai/grok-3-mini β€” Grok 3 mini (131k context)
63
+ - cohere/command-r-08-2024 β€” Cohere Command-R (128k context)
64
+ - qwen/qwen3-235b-a22b-2507 β€” Qwen3-235b (262k context)
65
+ - anthropic/claude-3-haiku β€” Claude 3 Haiku (large context)
66
+ - local/ollama β€” Local Model (Ollama, experimental, 4k context)
67
+
68
+ Notes: model IDs in the app are authoritative; pricing/context values are indicative and may change with providers.
69
+
70
+ ### πŸ‘₯ **Multiple AI Personalities**
71
+
72
+ - **Kimi**: Cosmic dreamer and astrophysicist with ethereal sensibilities
73
+ - **Bella**: Nurturing botanist who sees people as plants needing care
74
+ - **Rosa**: Chaotic prankster thriving on controlled chaos
75
+ - **Stella**: Digital artist transforming reality through pixelated vision
76
+ - **2Blanche**: Stoic android combat unit hiding deep emotional vulnerability
77
+ - **Jasmine**: Goddess of Love versed in the traditions of the Kamasutra
78
+
79
+ ### Personality Trait Ranges
80
+
81
+ All personality traits operate on a 0-100 scale:
82
+
83
+ - **Affection**: Emotional warmth and attachment
84
+ - **Playfulness**: Fun-loving and spontaneous behavior
85
+ - **Intelligence**: Analytical and thoughtful responses
86
+ - **Empathy**: Understanding and emotional support
87
+ - **Humor**: Wit and lighthearted interactions
88
+ - **Romance**: Romantic and intimate expressions
89
+
90
+ ### 🧠 **Intelligent Memory System**
91
+
92
+ - Automatic extraction and categorization of conversation memories
93
+ - Seven memory categories: Personal, Preferences, Relationships, Activities, Goals, Experiences, Events
94
+ - Persistent memory across sessions with search and management capabilities
95
+ - Character-specific memory isolation
96
+
97
+ ### πŸ’« **Dynamic Personality Evolution**
98
+
99
+ - Six personality traits that evolve based on interactions:
100
+ - Affection, Playfulness, Intelligence, Empathy, Humor, Romance
101
+ - Real-time trait adjustments based on conversation tone and content
102
+ - Visual personality indicators and progression tracking
103
+ - Intelligent model selection and switching
104
+ - Real-time emotion detection and analysis
105
+ - Contextually-aware responses
106
+
107
+ ### 🎬 **Emotion-Driven Visual Experience**
108
+
109
+ - Real-time video responses matching detected emotions
110
+ - Smooth transitions between emotional states
111
+ - Character-specific visual libraries with ~360 video clips (approx. 60 per main character)
112
+ - Context-aware video selection system
113
+
114
+ ### 🎨 **Customizable Interface**
115
+
116
+ - Five professionally designed themes
117
+ - Adjustable interface transparency
118
+ - Responsive design optimized for desktop, tablet, and mobile
119
+ - Accessibility features and keyboard navigation
120
+
121
+ ### 🌍 **Multilingual Support**
122
+
123
+ - Full localization in 7 languages: English, French, Spanish, German, Italian, Japanese, Chinese
124
+ - Automatic language detection from user input
125
+ - Culturally-aware responses and emotion keywords
126
+
127
+ ### πŸ”Œ **Extensible Plugin System**
128
+
129
+ - Theme plugins for visual customization (currently, only the color theme plugin is functional)
130
+ - Voice plugins for speech synthesis options (planned)
131
+ - Behavior plugins for personality modifications (planned)
132
+ - Secure plugin loading with validation
133
+
134
+ ### πŸ›‘οΈ **Security & Privacy**
135
+
136
+ - Input validation and sanitization
137
+ - Secure API key handling
138
+ - Local data storage with IndexedDB
139
+ - No server dependencies for core functionality
140
+
141
+ ## πŸ—οΈ Technical Architecture
142
+
143
+ ### 🧩 Core Technologies
144
+
145
+ - **Frontend**: Vanilla JavaScript (ES6+), HTML5, CSS3
146
+ - **Database**: IndexedDB with Dexie.js
147
+ - **AI Integration**: OpenRouter (default), OpenAI-compatible, Cohere, Anthropic, Groq, Together, or local Ollama
148
+ - **Speech**: Web Speech API
149
+ - **Audio**: Web Audio API
150
+
151
+ ---
152
+
153
+ ## ✨ Inspiration & Assets
154
+
155
+ This project was originally inspired by the [JackyWine GitHub repository](https://github.com/Jackywine).
156
+ @Jackywine on X (Twitter)
157
+
158
+ The six main characters are visually based on images from creators on X (Twitter):
159
+
160
+ - @JulyFox33 (Kimi)
161
+ - @BelisariaNew (Bella)
162
+ - @JuliAIkiko (Rosa and Stella)
163
+ - Custom designs inspired by NieR:Automata (2Blanche) and Godness aesthetics (Jasmine)
164
+
165
+ All character videos were generated using the image-to-video AI from Kling.ai, specifically with the Kling v2.1 model.
166
+
167
+ Get 50% bonus Credits in your first month with this code referral 7BR9GT2WQ6JF - link: [https://klingai.com](https://klingai.com/h5-app/invitation?code=7BR9GT2WQ6JF)
168
+
169
+ ---
170
+
171
+ ### Project Structure (current)
172
+
173
+ Top-level files and main modules:
174
+
175
+ - index.html β€” Main application entry
176
+ - virtual-kimi (static assets & landing): virtual-kimi\*.html
177
+ - kimi-js/
178
+ - kimi-script.js β€” App initialization & orchestration
179
+ - kimi-database.js β€” IndexedDB persistence (Dexie)
180
+ - kimi-config.js β€” Runtime configuration
181
+ - kimi-security.js β€” Security utilities
182
+ - kimi-llm-manager.js β€” LLM integration and model list
183
+ - kimi-emotion-system.js β€” Emotion analysis
184
+ - kimi-memory-system.js β€” Memory extraction & storage
185
+ - kimi-memory-ui.js β€” Memory management UI
186
+ - kimi-appearance.js, kimi-voices.js, kimi-utils.js, kimi-module.js, etc.
187
+ - kimi-css/ β€” styles and themes
188
+ - kimi-plugins/ β€” local plugins (sample-theme, sample-behavior, sample-voice)
189
+ - kimi-locale/ β€” translations and i18n files
190
+ - dexie.min.js β€” local DB helper
191
+
192
+ ### Data Flow
193
+
194
+ 1. **Input Processing**: User input β†’ Security validation β†’ Language detection
195
+ 2. **AI Analysis**: Emotion detection β†’ Memory extraction β†’ LLM processing
196
+ 3. **Response Generation**: Personality-aware response β†’ Emotion mapping β†’ Visual selection
197
+ 4. **Memory Update**: Trait evolution β†’ Memory storage β†’ UI synchronization
198
+
199
+ ## Installation & Setup
200
+
201
+ ### Prerequisites
202
+
203
+ - Modern web browser (Chrome, Edge or recent Firefox recommended). The app is plain HTML/CSS/JS and runs locally in a browser β€” no build step is required.
204
+ - (Optional) OpenRouter API key or another compatible provider API key if you want remote LLM access. The app can run without a key using local-only features, but AI responses will be limited.
205
+ - HTTPS is required for microphone access and some browser TTS features. For full voice/microphone features, open the app via a local server (see Quick Start). If you only open `index.html` directly, most features still work but microphone may be blocked by the browser.
206
+ - Dexie.js is included for IndexedDB persistence (no installation required; file `dexie.min.js` is bundled).
207
+
208
+ ### Quick Start
209
+
210
+ 1. **Clone the repository**
211
+
212
+ ```bash
213
+ git clone https://github.com/virtualkimi/virtual-kimi.git
214
+ cd virtual-kimi
215
+ ```
216
+
217
+ 2. **Open the application**
218
+
219
+ - Open `index.html` in your web browser
220
+ - Or serve via local web server for optimal performance:
221
+ ```bash
222
+ python -m http.server 8000
223
+ # Navigate to http://localhost:8000
224
+ ```
225
+
226
+ 3. **Configure API access**
227
+
228
+ - Open Settings β†’ AI & Models
229
+ - Provider: choose the LLM provider to use. Supported options in the app include `openrouter` (recommended), `openai`/OpenAI-compatible endpoints, and `ollama` (local). The selected provider is saved in the app preferences.
230
+ - API key: paste your provider API key into the API Key field. Keys are saved locally in your browser's IndexedDB (preferences) so they never leave your machine except when the app sends requests to the selected provider.
231
+ - Base URL: if you use a non‑default provider or an OpenAI-compatible endpoint, set the provider base URL (Settings β†’ AI & Models β†’ Base URL). This overrides the built-in default endpoints.
232
+ - Model selection: choose a model ID from the list. The app's authoritative model list is defined in `kimi-js/kimi-llm-manager.js`. If the provider does not support the selected model, the app will attempt a best-match fallback or show an error.
233
+ - Test API key: use the app's built-in test function (Settings β†’ Test API) to validate your key; this performs a minimal request and reports success or the provider error message.
234
+ - Local (Ollama) usage: to use a local model with `ollama`, run your local Ollama-compatible server (the app uses `http://localhost:11434/api/chat`). Select provider `ollama` and set model ID accordingly. Local models are experimental and work only if the local server is running.
235
+ - No key behavior: the app runs without an API key for local UI features and stored data, but remote LLM responses require a valid provider/key. If no key is configured the app will return friendly fallback messages for AI features.
236
+
237
+ Troubleshooting notes:
238
+
239
+ - If you see HTTP 401: verify the API key for the selected provider.
240
+ - If you see HTTP 429 or rate-limit errors: wait a moment or choose a different model/provider account.
241
+ - If the model is reported as unavailable (422-like errors): verify the model ID and, if needed, refresh the remote model list in Settings.
242
+ - For OpenRouter-specific issues: check the Base URL is `https://openrouter.ai/api/v1/chat/completions` (default) unless you use a custom endpoint.
243
+
244
+ 4. **Customize your experience**
245
+ - Choose your language and preferred voice
246
+ - Choose a character in Personality tab
247
+ - Enable memory system in Data tab
248
+ - Adjust themes and UI opacity in Appearance tab
249
+
250
+ ### Production Deployment
251
+
252
+ For production deployment, ensure:
253
+
254
+ - HTTPS is enabled (required for microphone access)
255
+ - Gzip compression for assets
256
+ - Proper cache headers
257
+ - CSP headers for enhanced security
258
+
259
+ ## βš™οΈ Configuration
260
+
261
+ ### API Integration
262
+
263
+ The application supports multiple AI providers; choose and configure your provider in Settings β†’ AI & Models.
264
+
265
+ - Mistral models
266
+ - Nous Hermes models
267
+ - Qwen3 models
268
+ - xAI models
269
+ - Open-source alternatives
270
+
271
+ ### Memory System Configuration
272
+
273
+ ```javascript
274
+ // Memory categories can be customized
275
+ const memoryCategories = [
276
+ "personal", // Personal information
277
+ "preferences", // Likes and dislikes
278
+ "relationships", // People and connections
279
+ "activities", // Hobbies and activities
280
+ "goals", // Aspirations and plans
281
+ "experiences", // Past events
282
+ "important" // Significant moments
283
+ ];
284
+ ```
285
+
286
+ ## πŸ› οΈ Development
287
+
288
+ ### Project Structure
289
+
290
+ ```
291
+ <repo root>
292
+ β”œβ”€β”€ index.html
293
+ β”œβ”€β”€ README.md
294
+ β”œβ”€β”€ LICENSE.md
295
+ β”œβ”€β”€ package.json
296
+ β”œβ”€β”€ kimi-js/ # core JS modules (kimi-*.js)
297
+ β”œβ”€β”€ kimi-locale/ # translations (en.json, fr.json, ...)
298
+ β”œβ”€β”€ kimi-plugins/ # plugin examples
299
+ β”œβ”€β”€ kimi-videos/ # character video clips
300
+ β”œβ”€β”€ kimi-icons/ # image assets and favicons
301
+ └── dexie.min.js # IndexedDB helper
302
+ ```
303
+
304
+ ### Adding New Features
305
+
306
+ #### Creating a New Plugin
307
+
308
+ ```javascript
309
+ // manifest.json
310
+ {
311
+ "name": "Custom Theme",
312
+ "version": "1.0.0",
313
+ "type": "theme",
314
+ "style": "theme.css",
315
+ "main": "theme.js",
316
+ "enabled": true
317
+ }
318
+ ```
319
+
320
+ > **Note:** As of version 1.0, only the color theme plugin is fully functional. Voice and behavior plugins are planned for future releases. See `kimi-plugins/sample-theme/` for a working example.
321
+
322
+ #### Extending Memory Categories
323
+
324
+ ```javascript
325
+ // Add to kimi-memory-system.js
326
+ const customCategory = {
327
+ name: "custom",
328
+ icon: "fas fa-star",
329
+ keywords: ["keyword1", "keyword2"],
330
+ confidence: 0.7
331
+ };
332
+ ```
333
+
334
+ ### Health Check System
335
+
336
+ The application includes a comprehensive health check system:
337
+
338
+ ```javascript
339
+ // Run health check
340
+ const healthCheck = new KimiHealthCheck();
341
+ const report = await healthCheck.runAllChecks();
342
+ console.log(report.status); // 'HEALTHY' or 'NEEDS_ATTENTION'
343
+ ```
344
+
345
+ ## Browser Compatibility
346
+
347
+ | Browser | Voice Recognition | Full Features | Notes |
348
+ | ----------- | ----------------- | ------------- | ------------------------- |
349
+ | Chrome 90+ | βœ… | βœ… | Recommended |
350
+ | Edge 90+ | βœ… | βœ… | Optimal voice performance |
351
+ | Firefox 88+ | ⚠️ | βœ… | Limited voice support |
352
+ | Safari 14+ | ⚠️ | βœ… | iOS limitations |
353
+
354
+ ## Performance
355
+
356
+ ### Optimization Features
357
+
358
+ - Lazy loading of non-critical modules
359
+ - Efficient batch database operations
360
+ - Debounced UI interactions
361
+ - Memory management with cleanup
362
+ - Optimized video preloading
363
+
364
+ ### Resource Usage
365
+
366
+ - Memory footprint: ~15-30MB active usage
367
+ - Storage: Scales with conversation history
368
+ - Network: API calls only, no tracking
369
+ - CPU: Minimal background processing
370
+
371
+ ## Privacy & Security
372
+
373
+ ### Data Handling
374
+
375
+ - All data stored locally in browser
376
+ - No telemetry or analytics
377
+ - API keys in your local storage
378
+ - User content never sent to external servers (except chosen AI provider)
379
+
380
+ ### Security Measures
381
+
382
+ - Input validation and sanitization
383
+ - XSS protection
384
+ - Safe plugin loading
385
+ - Secure API communication
386
+
387
+ ## Troubleshooting
388
+
389
+ ### Common Issues
390
+
391
+ - **Microphone not working**: Ensure HTTPS and browser permissions
392
+ - **API errors / provider issues**: Verify the API key and selected provider for the chosen model. This app supports multiple providers (OpenRouter, OpenAI-compatible endpoints, Groq, Together, Cohere, Anthropic, local/Ollama, etc.). Make sure the provider-specific base URL, model ID and API key are correctly configured in Settings β†’ AI & Models.
393
+ - **Text-to-Speech (TTS) voices**: The app uses the browser Web Speech API for TTS. For best voice support, use modern Chromium-based browsers (Edge or Chrome) which generally provide better built-in voices and compatibility. If voices are missing or sound low quality, try Edge/Chrome or install additional TTS engines on your system.
394
+ - **Performance issues**: Clear browser cache, check available memory
395
+ - **Memory system not learning**: Ensure system is enabled in Data tab
396
+
397
+ ## Contributing
398
+
399
+ We welcome contributions! Please see our contributing guidelines:
400
+
401
+ 1. Fork the repository
402
+ 2. Create a feature branch
403
+ 3. Make your changes with appropriate tests
404
+ 4. Submit a pull request with detailed description
405
+
406
+ ### Development Guidelines
407
+
408
+ - Follow existing code style and patterns
409
+ - Add comments for complex functionality
410
+ - Test across multiple browsers
411
+ - Update documentation for new features
412
+
413
+ ## πŸ”„ TODO / Roadmap (current priorities)
414
+
415
+ - [ ] Full support for local models (Ollama integration β€” currently experimental)
416
+ - [ ] Voice plugin system (custom voices, TTS engines) β€” planned
417
+ - [ ] Behavior plugin system (custom AI behaviors) β€” planned
418
+ - [ ] Improve advanced memory management UI and ranked memory snapshot features (in-progress)
419
+ - [ ] More character personalities and backgrounds
420
+ - [ ] In-app onboarding and help system
421
+ - [ ] Better mobile UI/UX and accessibility improvements
422
+ - [ ] More granular privacy controls and explicit user consent flows
423
+ - [ ] Automated testing and CI/CD pipeline (unit + basic UI tests)
424
+ - [ ] Performance profiling and optimization for large conversation histories
425
+ - [ ] Documentation updates to reflect implemented features (models, API handling, plugin validation)
426
+
427
+ ## πŸ“œ License
428
+
429
+ This project is distributed under a custom license. **Any commercial use, resale, or monetization of this application or its derivatives is strictly prohibited without the explicit written consent of the author.**
430
+
431
+ See the [LICENSE](LICENSE.md) file for details.
432
+
433
+ [![Open Source](https://img.shields.io/badge/Open%20Source-GitHub-brightgreen?style=flat-square&logo=github)](https://github.com/virtualkimi)
434
+ [![No Commercial Use](https://img.shields.io/badge/No%20Commercial%20Use-%F0%9F%9A%AB-red?style=flat-square)](#license)
435
+
436
+ ---
437
+
438
+ **Virtual Kimi** - Creating meaningful connections between humans and AI, one conversation at a time.
439
+
440
+ > _"Love is the most powerful code"_ πŸ’•
441
+ >
442
+ > β€” 2025 Virtual Kimi - Created with πŸ’œ by Jean & Kimi
443
+