首页 / 最新技术项目架构 / 正文

AI陪伴智能系统项目架构

作者:wsp188 | 发布时间:2026-06-11 14:41 | 分类:最新技术项目架构

项目架构(工程版)

AI Companion Intelligence System

AI陪伴智能系统

这个架构遵循你一直强调的原则:

一、整体架构

                    
       AI Companion Intelligence System

┌──────────────────────────────────┐
│          Client Layer            │
│          客户端层                │
└───────────────┬──────────────────┘
                │
                ▼

┌──────────────────────────────────┐
│            API Gateway           │
│            API网关               │
└───────────────┬──────────────────┘
                │
                ▼

┌──────────────────────────────────┐
│         Core Service Layer       │
│         核心服务层               │
└───────────────┬──────────────────┘

 ├─ Identity Service
 ├─ Intent Service
 ├─ Rule Service
 ├─ Memory Service
 ├─ Personality Service
 ├─ Relationship Service
 ├─ Knowledge Service
 ├─ Prompt Service
 ├─ AI Service
 └─ Voice Service

                │
                ▼

┌──────────────────────────────────┐
│            Data Layer            │
│            数据层                │
└──────────────────────────────────┘

 MySQL
 Redis
 Vector Store(V2)
 File Storage

二、第一版目录结构

acis/
│
├── app/
│
├── api/
│
├── core/
│
├── modules/
│
├── storage/
│
├── database/
│
├── config/
│
├── logs/
│
├── public/
│
├── cron/
│
└── docs/

三、核心目录

app/

控制器层

app/

├── Controllers/

│   ├── ChatController.php

│   ├── UserController.php

│   ├── MemoryController.php

│   ├── DeviceController.php

│   └── KnowledgeController.php

api/

接口层

api/

├── chat.php

├── memory.php

├── relationship.php

├── personality.php

├── knowledge.php

└── device.php

core/

基础核心

core/

├── Database.php

├── Redis.php

├── Router.php

├── Request.php

├── Response.php

├── Auth.php

└── Logger.php

四、业务模块

modules/

modules/

├── Identity/

├── Intent/

├── Rule/

├── Memory/

├── Personality/

├── Relationship/

├── Knowledge/

├── Prompt/

├── AI/

└── Voice/

五、Identity Engine

用户身份引擎

modules/Identity/

├── IdentityService.php

├── UserProfile.php

└── UserTags.php

负责:

姓名

年龄

兴趣

宠物

家庭成员

标签管理

六、Intent Engine

意图识别引擎

modules/Intent/

├── IntentService.php

├── IntentRules.php

└── IntentClassifier.php

V1直接规则识别:

我叫什么
讲故事
唱歌
你好
天气

后续再接AI分类。


七、Rule Engine

系统核心

modules/Rule/

├── RuleEngine.php

├── RuleManager.php

├── RuleMatcher.php

└── RuleActions.php

示例:

用户:

我叫什么?

匹配:

MEMORY_NAME_QUERY

执行:

MemoryService

直接返回。

不调用AI。


八、Memory Engine

最核心模块

modules/Memory/

├── MemoryService.php

├── MemoryStore.php

├── MemorySearch.php

├── MemoryScore.php

└── MemoryDecay.php

功能:

长期记忆

短期记忆

记忆召回

记忆衰减

记忆评分

九、概率记忆模型

公式:

MemoryScore=BaseWeight×DecayFactor×UsageFactor×RelationFactorMemoryScore=BaseWeight\times DecayFactor\times UsageFactor\times RelationFactor


例如:

用户姓名

100分

永不衰减

昨天看电影

20分

7天后自动归档

十、Personality Engine

人格系统

modules/Personality/

├── PersonalityService.php

├── PersonalityManager.php

└── PersonalityTemplates.php

支持:

朋友人格

老师人格

姐姐人格

宠物人格

品牌人格

十一、Relationship Engine

关系成长系统

modules/Relationship/

├── RelationshipService.php

├── LevelCalculator.php

└── RelationshipRules.php

等级:

LV1

LV5

LV10

LV20

依据:

聊天次数

连续登录

互动时长

十二、Knowledge Engine

知识引擎

modules/Knowledge/

├── KnowledgeService.php

├── FAQSearch.php

├── RAGSearch.php

└── ContentSearch.php

支持:

企业知识库

故事库

百科库

教育库

十三、Prompt Engine

Prompt构建器

modules/Prompt/

├── PromptBuilder.php

├── MemoryPrompt.php

├── PersonalityPrompt.php

└── KnowledgePrompt.php

生成:

用户信息
+
重要记忆
+
人格
+
知识
+
当前问题

十四、AI Gateway

模型网关

modules/AI/

├── AIService.php

├── GLMProvider.php

├── DeepSeekProvider.php

├── OpenAIProvider.php

└── Router.php

统一调用。


十五、Voice Engine

语音引擎

modules/Voice/

├── TTSService.php

├── VoiceProvider.php

└── VoiceCache.php

支持:

儿童声

女声

男声

品牌声音

十六、数据库

V1仅需10张表

users

devices

chat_history

memory

memory_scores

relationships

personalities

knowledge

api_logs

system_logs

十七、API

核心接口

POST /api/chat

POST /api/memory/save

GET /api/memory/search

GET /api/relationship

GET /api/personality

POST /api/device/action

十八、开发阶段

Phase 1

MVP

聊天

记忆

人格

AI接口

预计:

3000~5000行代码

Phase 2

商业版

关系成长

知识库

设备管理

权限管理

预计:

10000~20000行代码

Phase 3

平台版

多租户

企业知识库

设备授权

计费系统

开放平台

预计:

30000+行代码

最终定位

ACIS™ = AI Companion Intelligence System

不是聊天机器人。

不是玩具软件。

而是一套:

身份引擎
+
规则引擎
+
记忆引擎
+
人格引擎
+
关系引擎
+
知识引擎
+
AI生成引擎

组成的 AI 陪伴智能体平台,可授权给玩具公司、机器人公司、教育设备公司和各种智能硬件厂商。

联系我们

欢迎咨询AI系统开发、网站建设、搜索优化、项目定制合作

联系方式

  • 电话:15089196448
  • 邮箱:1602401899@qq.com
  • 地址:陕西省渭南市
  • 服务时间:周一至周五 09:00 - 18:00 | 7×24小时技术值守