Skip to content

Commit

Permalink
feat: 更新项目部署文档
Browse files Browse the repository at this point in the history
  • Loading branch information
yakami129 committed Aug 20, 2023
1 parent 5c93eb8 commit a8a47aa
Show file tree
Hide file tree
Showing 26 changed files with 123 additions and 3,958 deletions.
22 changes: 22 additions & 0 deletions .idea/VirtualWife.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

88 changes: 53 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# VirtualWife

VirtualWife 是一个虚拟主播项目,目前支持在B站进行直播,用户可以自由更换VRM人物模型,大家可以将他作为一个虚拟主播入门demo,在上面扩展自己喜欢功能
VirtualWife是一个虚拟数字人项目,项目还处于孵化阶段,会有很多需要优化的地方,作者想打造一个拥有自己“灵魂”的虚拟数字人,你可以像朋友一样和她相识,作者希望虚拟数字人融入人类生活,作为恋爱导师,心理咨询师,解决人类的情感需求

本项目只是一个实验品,满足基本聊天能力,用户可以通过弹幕与虚拟主播进行对话
> 一期项目的功能,暂时还没有完整开发完,在项目中遇到问题可以在群里@Alan或者提issue,欢迎大佬贡献自己想法和代码
## 项目技术栈说明
## 项目一期核心功能说明

![](docs/16925213210798.jpg)

## 项目一期核心技术栈说明

![](docs/16925212367994.jpg)

- React:前端服务框架
- Django:后端服务框架
- LangChain: 支撑聊天核心功能
- OpenAI: GPT大语言模型
- Edge-tts: 微软语音合成模型
- VRM: VRM人物模型

## 项目结构说明

### 核心服务说明

- domain-chatbot: AI核心服务
- domain-chatvrm: 聊天客户端
- domain-chatvrm: VRM聊天客户端
- infrastructure-gateway: 基础设施-网关

### 环境要求
Expand Down Expand Up @@ -66,14 +66,11 @@ cd installer

- 更改境变量配置模版文件名为.env
```
mv env_example .evn
mv env_example .en
```
- 设置环境变量
```
# OpenAI Key
OPENAI_API_KEY=sk-XXXXX
# B站直播间ID
# B站直播间ID(计划放在页面设置,目前有问题,暂时使用环境变量解决)
B_STATION_ID=27892212
# 时区
Expand Down Expand Up @@ -103,7 +100,33 @@ sh start.sh
http://localhost/
```
- 页面展示
![](docs/16878738708227.jpg)
![](docs/16925232398938.jpg)

### 初始化数字人配置

#### 基础配置
```
选择自己喜欢的角色和人物模型,并且选择大语言模型,如果是使用openai请将语言模型设置为openai
```
![](docs/16925233912142.jpg)

#### 大语言模型配置
```
这以openai模型为例,你只需要将OPENAI_API_KEY填写好即可,如果有API代理可以将地址填写到OPENAI_BASE_URL
```
![](docs/16925238212736.jpg)

#### 高级设置
```
如果没有OPENAI_BASE_URL,你需要配置http-proxy
```
![](docs/16925239975597.jpg)

#### 保存
保存、保存、保存,重要的事情说三遍
![](docs/16925241544548.jpg)

> 保存成功后,无需重启服务,可以开始聊天了
## 本地开发

Expand All @@ -113,29 +136,31 @@ http://localhost/
```shell
cd domain-chatbot
```

- 如何获取OpenAIKey?
- https://platform.openai.com/overview

- 如何获取B站直播间ID?
- 获取B站直播ID,前提是需要你自行注册B站直播用户
![](docs/16878718322092.jpg)
- 创建.env文件,添加OpenAIKey和B站直播间ID
- 创建.env文件,添加B站直播间ID(计划放在页面设置,目前有问题,暂时使用环境变量解决)
```shell
# OpenAIKey
OPENAI_API_KEY=xxxxxx
# B站直播间ID
B_STATION_ID=xxxxx
```
- 安装domain-chatbot项目依赖
```shell
pip3 install -r requirements.txt
```
- 初始化项目数据库
```shell
python manage.py makemigrations
```
```shell
python manage.py migrate
```
- 启动domain-chatbot项目
```shell
python manage.py runserver
```

### 如何启动domain-chatvrm?

- 进入domain-chatvrm文件夹
Expand Down Expand Up @@ -164,27 +189,20 @@ http://localhost:3000/

- VRM模型市场:[Vroid](https://hub.vroid.com/)
- 点击设置后,点击打开VRM模型按钮,上传VRM(这块作者还没优化,刷新页面会加载默认模型)
![](docs/16878743210162.jpg)
![](docs/16925246168293.jpg)

### 如何更换虚拟AI的prompt?

- 默认使用虚拟主播爱莉的prompt
![](docs/16878744329269.jpg)

![](docs/16878744548863.jpg)

- 训练自己的prompt,可以参照爱莉的prompt迭代自己的虚拟人物
- 新增角色,提交后可以在基础设置中选择你的角色
![](docs/16925246793101.jpg)

### 如何更换中文语音包?

- 本系统已经内置了很多中文语音包
![](docs/16878746478694.jpg)
![](docs/16925247438437.jpg)

## 后记
## 技术交流群

本项目是作者第一次接触数字人开发的实验型demo,基于[ChatVRM](https://github.com/pixiv/ChatVRM)+Edge-tts+LangChain+OpenAI实现,希望能通过这个项目让大家快速搭建自己的虚拟主播,如果项目对你有用,可以帮忙点个start,优化建议、bug可以提issues
![IMG_4116](assets/IMG_4116.JPG)

## 技术交流群

![IMG_3897](docs/IMG_3897.JPG)

Binary file removed docs/16878738708227.jpg
Binary file not shown.
Binary file removed docs/16878743210162.jpg
Binary file not shown.
Binary file removed docs/16878744329269.jpg
Binary file not shown.
Binary file removed docs/16878744548863.jpg
Binary file not shown.
Binary file removed docs/16878746478694.jpg
Binary file not shown.
Binary file added docs/16925212367994.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925213210798.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925232398938.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925233912142.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925238212736.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925239975597.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925241544548.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925246168293.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925246793101.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/16925247438437.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed docs/IMG_3897.JPG
Binary file not shown.
Binary file added docs/IMG_4116.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
30 changes: 17 additions & 13 deletions domain-chatbot/apps/chatbot/config/sys_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import os
import traceback
from ..llms.llm_model_strategy import LlmModelDriver
from ..models import CustomRoleModel
from ..customrole.sys.maiko_zh import maiko_zh
Expand Down Expand Up @@ -61,19 +62,22 @@ def load(self):
sys_config_json = self.get()

# 初始化默认角色
result = CustomRoleModel.objects.all()
if len(result) == 0:
print("=> load default character")
custom_role = CustomRoleModel(
role_name=maiko_zh.role_name,
persona=maiko_zh.persona,
personality=maiko_zh.personality,
scenario=maiko_zh.scenario,
examples_of_dialogue=maiko_zh.examples_of_dialogue,
custom_role_template_type=maiko_zh.custom_role_template_type
)
custom_role.save()

try:
result = CustomRoleModel.objects.all()
if len(result) == 0:
print("=> load default character")
custom_role = CustomRoleModel(
role_name=maiko_zh.role_name,
persona=maiko_zh.persona,
personality=maiko_zh.personality,
scenario=maiko_zh.scenario,
examples_of_dialogue=maiko_zh.examples_of_dialogue,
custom_role_template_type=maiko_zh.custom_role_template_type
)
custom_role.save()
except Exception as e:
print("=> load default character ERROR: %s" % str(e))

# 加载角色配置
character = sys_config_json["characterConfig"]["character"]
yourName = sys_config_json["characterConfig"]["yourName"]
Expand Down
Loading

0 comments on commit a8a47aa

Please sign in to comment.