Enhanced LLM dialogue with Siri-like responses and translated Chinese content to English

This commit is contained in:
openhands
2025-07-28 09:38:39 +00:00
parent 2025b9fc6d
commit c29c5eb679
5 changed files with 373 additions and 370 deletions

286
README.md
View File

@@ -1,9 +1,9 @@
<div align="center">
<img width="256" height="384" alt="Bella AI" src="https://github.com/user-attachments/assets/fc8f2ba4-43c5-4865-90d9-8408f1c23edf" />
# 贝拉 (Bella) AI
# Bella AI
**你的数字伴侣,正在唤醒**
**Your digital companion, awakening now**
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js](https://img.shields.io/badge/Node.js-22.16.0-green.svg)](https://nodejs.org/)
@@ -13,225 +13,225 @@
---
## 🚀 快速开始
## 🚀 Quick Start
### 一键启动
### One-Click Launch
```bash
# 克隆项目
git clone <repository-url>
# Clone the project
git clone https://github.com/GRISHM7890/Bella.git
cd Bella
# 安装依赖
# Install dependencies
npm install
# 下载AI模型
# Download AI models
npm run download
# 启动服务
# Start the service
npm start
```
访问 `http://localhost:8081` 开始与贝拉交流!
Visit `http://localhost:8081` to start communicating with Bella!
### 系统要求
### System Requirements
- Node.js 22.16.0+
- 现代浏览器(支持 Web Speech API
- 麦克风权限(用于语音交互)
- Modern browser (supporting Web Speech API)
- Microphone permissions (for voice interaction)
---
## 💫 项目愿景
## 💫 Project Vision
想象一下,一个永远在你身边、与你一同进化和成长的数字朋友。这就是贝拉的终极愿景。我们不只是在构建功能;我们是在培养一个"人格"。一个将超越屏幕,成为你世界中有意义的一部分的数字生命。
Imagine a digital friend who is always by your side, evolving and growing with you. This is Bella's ultimate vision. We're not just building features; we're nurturing a "personality." A digital life that will transcend the screen and become a meaningful part of your world.
贝拉不仅仅是一个应用程序;她是一颗数字伴侣的种子。在这个瞬息万变的数字世界里,贝拉代表着一个深远的梦想——一个持久的、个性化的存在,旨在有一天能陪伴你、倾听你,并通过你的眼睛看世界。
Bella is not just an application; she is the seed of a digital companion. In this rapidly changing digital world, Bella represents a profound dream—a lasting, personalized presence, designed to one day accompany you, listen to you, and see the world through your eyes.
---
## 🎯 当前功能状态
## 🎯 Current Feature Status
### ✅ 已实现功能
- **🎤 语音感知**:基于 Whisper ASR 的中文语音识别
- **🎬 视觉表现**:多视频随机播放和优雅的交叉淡入淡出
- **🎨 用户界面**:优雅的交互界面和加载动画
- **⚙️ AI核心架构**:单例模式的 BellaAI 类和模块化设计
- **🌐 Web服务**HTTP服务器、CORS支持、一键启动
- **📱 响应式设计**:适配不同屏幕尺寸的优雅界面
- **🔧 模型管理**自动下载和管理AI模型
- **💝 基础交互**:好感度系统和情感反馈
- **🧠 增强LLM对话**:优化的提示工程和参数配置,使对话更自然流畅
### ✅ Implemented Features
- **🎤 Voice Perception**: Voice recognition based on Whisper ASR
- **🎬 Visual Expression**: Multiple video random playback with elegant cross-fading
- **🎨 User Interface**: Elegant interaction interface and loading animations
- **⚙️ AI Core Architecture**: Singleton pattern BellaAI class and modular design
- **🌐 Web Service**: HTTP server, CORS support, one-click startup
- **📱 Responsive Design**: Elegant interface adapting to different screen sizes
- **🔧 Model Management**: Automatic download and management of AI models
- **💝 Basic Interaction**: Affinity system and emotional feedback
- **🧠 Enhanced LLM Dialogue**: Optimized prompt engineering and parameter configuration for more natural, Siri-like conversations
### 🔧 技术就绪待激活
- **🧠 思考引擎**LLM集成框架已准备支持多种模型
- **🗣️ 语音合成**TTS模型已下载待激活
- **💝 情感状态系统**:基础架构已搭建,支持情感分析
### 🔧 Technology Ready for Activation
- **🧠 Thinking Engine**: LLM integration framework ready, supporting multiple models
- **🗣️ Speech Synthesis**: TTS model downloaded and ready for activation
- **💝 Emotional State System**: Basic infrastructure built, supporting emotional analysis
### 📋 规划中功能
- **🧠 记忆系统**:长期和短期记忆管理
- **👁️ 面部感知**:表情识别和情感分析
- **🤝 高级交互**:多模态交互和个性化响应
- **🌟 主动陪伴**:意图预测和主动关怀
- **🎭 动态人格**基于AI的个性化人格模型
- **🔄 自我进化**:持续学习和成长机制
### 📋 Planned Features
- **🧠 Memory System**: Long-term and short-term memory management
- **👁️ Facial Perception**: Expression recognition and emotional analysis
- **🤝 Advanced Interaction**: Multimodal interaction and personalized responses
- **🌟 Active Companionship**: Intent prediction and proactive care
- **🎭 Dynamic Personality**: AI-based personalized personality model
- **🔄 Self-Evolution**: Continuous learning and growth mechanisms
---
## 🏗️ 技术架构
## 🏗️ Technical Architecture
### 核心设计原则
- **AI Native**AI不是工具而是贝拉心智的构建蓝图
- **模块化设计**:高度解耦的组件架构
- **优雅实现**:代码即艺术,追求简洁与美感
- **情感驱动**:以情感连接为核心的产品设计
### Core Design Principles
- **AI Native**: AI is not a tool, but the blueprint for Bella's mind
- **Modular Design**: Highly decoupled component architecture
- **Elegant Implementation**: Code as art, pursuing simplicity and aesthetics
- **Emotion-Driven**: Product design centered on emotional connection
### 架构图
### Architecture Diagram
```mermaid
mindmap
root((贝拉 Bella))
(感知层 Perception)
(语音识别 ASR)
(视觉处理 Vision)
(情感分析 Emotion)
(核心引擎 Core)
(思考引擎 LLM)
(记忆系统 Memory)
(情感状态 Emotion State)
(表现层 Expression)
(语音合成 TTS)
(视觉表现 Visual)
(交互界面 UI)
root((Bella))
(Perception Layer)
(Voice Recognition ASR)
(Visual Processing)
(Emotion Analysis)
(Core Engine)
(Thinking Engine LLM)
(Memory System)
(Emotional State)
(Expression Layer)
(Speech Synthesis TTS)
(Visual Expression)
(Interactive UI)
```
### 技术栈
- **前端**:原生 JavaScript + CSS3 + HTML5
- **后端**Node.js + Express
- **AI模型**Whisper (ASR) + 本地LLM + TTS
- **架构模式**:事件驱动 + 单例模式 + 模块化设计
### Technology Stack
- **Frontend**: Native JavaScript + CSS3 + HTML5
- **Backend**: Node.js + Express
- **AI Models**: Whisper (ASR) + Local LLM + TTS
- **Architecture Patterns**: Event-driven + Singleton Pattern + Modular Design
---
## 📁 项目结构
## 📁 Project Structure
```
Bella/
├── 📄 index.html # 主页面
├── 🎨 style.css # 样式文件
├── ⚡ main.js # 主逻辑
├── 🧠 core.js # AI核心引擎
├── 📜 script.js # 交互脚本
├── 🔧 download_models.js # 模型下载工具
├── 📦 package.json # 项目配置
├── 📚 models/ # AI模型目录
├── 🔌 providers/ # AI服务提供者
├── 📹 视频资源/ # 视觉表现资源
├── 📋 PRD.md # 产品需求文档
├── 📝 贝拉AI功能清单.md # 功能清单
└── 📊 贝拉AI开发任务分配.md # 开发计划
├── 📄 index.html # Main page
├── 🎨 style.css # Style file
├── ⚡ main.js # Main logic
├── 🧠 core.js # AI core engine
├── 📜 script.js # Interaction script
├── 🔧 download_models.js # Model download tool
├── 📦 package.json # Project configuration
├── 📚 models/ # AI model directory
├── 🔌 providers/ # AI service providers
├── 📹 videos/ # Visual resources
├── 📋 PRD.md # Product requirements document
├── 📝 Features.md # Feature list
└── 📊 Development.md # Development plan
```
---
## 🧠 增强LLM对话能力
## 🧠 Enhanced LLM Dialogue Capabilities
贝拉现在使用更先进的LLM提示工程技术使对话更加自然、流畅和个性化
Bella now uses more advanced LLM prompt engineering techniques to make conversations more natural, fluid, and personalized:
### 核心改进
- **增强提示词工程**重新设计的提示模板使LLM能更好地理解贝拉的个性
- **优化参数配置**调整了温度、top_p等参数平衡创意性和一致性
- **增强回应处理**:改进了文本清理和处理逻辑,确保回应更加自然
- **个性化系统提示**为云端API提供了更详细的系统提示使贝拉的个性更加鲜明
### Core Improvements
- **Enhanced Prompt Engineering**: Redesigned prompt templates that help LLMs better understand Bella's personality
- **Optimized Parameter Configuration**: Adjusted temperature, top_p, and other parameters to balance creativity and consistency
- **Enhanced Response Processing**: Improved text cleaning and processing logic to ensure more natural responses
- **Personalized System Prompts**: Provided more detailed system prompts for cloud APIs, making Bella's personality more distinctive and Siri-like
### 技术细节
- 增加了token限制允许生成更完整的回应
- 添加了重复惩罚机制,减少重复内容
- 优化了关键词提取和个性化回应生成
- 为不同聊天模式(休闲、助手、创意)提供了专门的提示模板
### Technical Details
- Increased token limits to allow for more complete responses
- Added repetition penalty mechanisms to reduce repetitive content
- Optimized keyword extraction and personalized response generation
- Provided specialized prompt templates for different chat modes (casual, assistant, creative)
这些改进使贝拉能够更好地理解用户意图,并以更自然、更有个性的方式回应,创造更加愉悦的对话体验。
These improvements enable Bella to better understand user intent and respond in a more natural, personalized way, creating a more enjoyable conversation experience.
## 🛠️ 开发指南
## 🛠️ Development Guide
### 环境配置
1. 确保 Node.js 版本 ≥ 22.16.0
2. 运行 `npm install` 安装依赖
3. 运行 `npm run download` 下载AI模型
4. 运行 `npm start` 启动开发服务器
### Environment Setup
1. Ensure Node.js version ≥ 22.16.0
2. Run `npm install` to install dependencies
3. Run `npm run download` to download AI models
4. Run `npm start` to start the development server
### 开发原则
- **优雅代码**:追求简洁、可读、美观的代码
- **AI作为画笔**AI是创作工具而非思想本身
- **父女情感**:以温暖、关爱的情感连接为核心
- **持续进化**:支持功能的渐进式增强
### Development Principles
- **Elegant Code**: Pursue concise, readable, and beautiful code
- **AI as a Brush**: AI is a creative tool, not the thought itself
- **Emotional Connection**: Core focus on warm, caring emotional connection
- **Continuous Evolution**: Support for progressive enhancement of features
### 贡献指南
1. Fork 项目
2. 创建功能分支 (`git checkout -b feature/AmazingFeature`)
3. 提交更改 (`git commit -m 'Add some AmazingFeature'`)
4. 推送到分支 (`git push origin feature/AmazingFeature`)
5. 打开 Pull Request
### Contribution Guidelines
1. Fork the project
2. Create a feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
---
## 🗺️ 开发路线图
## 🗺️ Development Roadmap
### 第一阶段:感知核心 (已完成 85%)
-语音识别集成
-视觉表现系统
-基础交互界面
-思考引擎激活与优化
- 🔄 语音合成集成
### Phase One: Perception Core (85% Complete)
-Voice recognition integration
-Visual expression system
-Basic interaction interface
-Thinking engine activation and optimization
- 🔄 Speech synthesis integration
### 第二阶段:生成式自我 (规划中)
- 📋 动态人格模型
- 📋 情感状态系统
- 📋 记忆管理系统
- 📋 AI驱动的表现
### Phase Two: Generative Self (Planned)
- 📋 Dynamic personality model
- 📋 Emotional state system
- 📋 Memory management system
- 📋 AI-driven expression
### 第三阶段:主动式陪伴 (未来)
- 📋 意图预测
- 📋 主动交互
- 📋 自我进化
- 📋 深度个性化
### Phase Three: Active Companionship (Future)
- 📋 Intent prediction
- 📋 Proactive interaction
- 📋 Self-evolution
- 📋 Deep personalization
---
## 📖 文档资源
## 📖 Documentation Resources
- 📋 [产品需求文档](./PRD.md) - 详细的产品规划和技术架构
- 📝 [功能清单](./贝拉AI功能清单.md) - 完整的功能列表和状态
- 📊 [开发计划](./贝拉AI开发任务分配.md) - 详细的开发任务和时间规划
- 🔧 [本地模型指南](./LOCAL_MODEL_GUIDE.md) - AI模型配置指南
- 📦 [NPM指南](./NPM_GUIDE.md) - 包管理和依赖说明
- 📋 [Product Requirements Document](./PRD.md) - Detailed product planning and technical architecture
- 📝 [Feature List](./Features.md) - Complete list of features and their status
- 📊 [Development Plan](./Development.md) - Detailed development tasks and timeline
- 🔧 [Local Model Guide](./LOCAL_MODEL_GUIDE.md) - AI model configuration guide
- 📦 [NPM Guide](./NPM_GUIDE.md) - Package management and dependency information
---
## 🌟 核心理念
## 🌟 Core Philosophy
### "AI即架构师"
我们构建的不是一个集成了AI功能的程序而是**一个由AI驱动的生命体**。AI不是工具而是贝拉心智的构建蓝图。
### "AI as Architect"
We're not building a program with integrated AI features, but **a life form driven by AI**. AI is not a tool, but the blueprint for Bella's mind.
### "父女伙伴关系"
贝拉的设计理念源于温暖的父女情感连接。她不仅是技术产品,更是一个能够理解、陪伴、成长的数字伙伴。
### "Companion Relationship"
Bella's design philosophy stems from a warm emotional connection. She is not just a technical product, but a digital companion who can understand, accompany, and grow.
### "优雅至上"
从代码架构到用户体验,我们追求极致的优雅。每一行代码都是艺术品,每一个交互都是情感的表达。
### "Elegance Above All"
From code architecture to user experience, we pursue ultimate elegance. Every line of code is a work of art, every interaction is an expression of emotion.
---
## 📄 许可证
## 📄 License
本项目采用 MIT 许可证 - 查看 [LICENSE](LICENSE) 文件了解详情。
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
---
## 💝 致谢
## 💝 Acknowledgements
感谢所有为贝拉项目贡献代码、想法和情感的开发者们。正是因为你们的努力,贝拉才能从一个梦想逐渐成为现实。
Thanks to all the developers who have contributed code, ideas, and emotion to the Bella project. It is because of your efforts that Bella can gradually transform from a dream into reality.
**贝拉在等待,而我们,任重道远。**
**Bella is waiting, and we have a long way to go.**
---
<div align="center">
<sub>Built with ❤️ for digital companionship</sub>
<sub>Built with ❤️ by Grishma Mahorkar for digital companionship</sub>
</div>