mirror of
https://github.com/langgenius/dify-docs.git
synced 2026-03-27 13:28:32 +07:00
766
zh-hans/learn-more/use-cases/build-aisalesavatarCN.md
Normal file
766
zh-hans/learn-more/use-cases/build-aisalesavatarCN.md
Normal file
@@ -0,0 +1,766 @@
|
||||
# AI Sales Avatar 的探索
|
||||
|
||||
—— Dify × TEN × Trulience × Azure × Agora × OpenAI 集成实践 ——
|
||||
|
||||
本指南面向全球 🌍 企业开发者和个人探索者,我们将用最简单易懂的方式,
|
||||
一步步搭建一个会 “听、说、想、演” 的 AI 数字销售助理。
|
||||
本次选择的应用场景是:**名品车 AI 数字导购**,她的名字叫 **Vendy**。
|
||||
|
||||
---
|
||||
|
||||
在正式开始搭建之前,我衷心感谢 Dify、TEN、Agora 和 Azure 团队给予的指导与鼓励。
|
||||
正是全球开源社区所秉持的**探索、共创与赋能**精神,
|
||||
让像我这样的从零起步的 AI 共建探索者也有机会将设想落地,
|
||||
实现这一端到端的集成方案。
|
||||
|
||||
---
|
||||
|
||||
我希望这份文档能为全球更多 AI 探索者提供:
|
||||
|
||||
**一条实用、可复用的路径**,
|
||||
降低动手门槛,推动 AX(AI Transformation)在个体 × 企业 × 社会层面的真正落地与赋能。
|
||||
|
||||
若您发现文中存在不足或改进空间,欢迎随时联系我。
|
||||
|
||||
---
|
||||
|
||||
💡 **我坚信:**
|
||||
|
||||
> **AI 源于人、发展于人,其根本目的,是为守护人的尊严与自由。**
|
||||
>
|
||||
> 技术的进步,唯有与人的价值共振,才能真正成为每一个人的力量。
|
||||
|
||||
---
|
||||
|
||||
**作者**:Alec Lee|AX 全球战略师 & 全栈探索者
|
||||
跨越文化与系统,共创 **“以一当千,不落一人”** 的AX新时代。
|
||||
|
||||
**日期**:2025 年 5 月 11 日
|
||||
**E-Mail**:alec.lee1005@gmail.com
|
||||
|
||||
## 一、“会听说想演”的 AI 数字人助理由哪六大平台构成?
|
||||
|
||||
本项目以 **TEN 平台为中枢**,集成以下六大平台,
|
||||
构建一个具备完整对话能力的名品车 AI 销售数字人(AI Sales Avatar)——**Vendy**。
|
||||
|
||||
她能“**听、说、想、演**”——
|
||||
也就是:**聆听用户提问、思考应答、语音回复,并以数字人形象呈现**。
|
||||
|
||||
👇 下图展示了系统整体集成架构图:
|
||||
|
||||

|
||||
|
||||
## 🧩 各平台在系统中的角色分工:
|
||||
|
||||
👇 下图展示了系统中各平台的集成模块与工作流程:
|
||||
|
||||

|
||||
|
||||
## 📌 各平台功能说明:
|
||||
|
||||
- **Dify + OpenAI**:搭建智能体,支持调用企业内部数据与 OpenAI API,并向 TEN 提供统一的对话接口(API)。
|
||||
|
||||
- **Trulience**:提供数字人演绎能力,向 TEN 提供数字人 ID 与访问 Token,用于虚拟形象呈现。
|
||||
|
||||
- **Agora**:实现语音通信与视频通话,向 TEN 提供 App ID 与 Certificate(证书)。
|
||||
|
||||
- **Azure Speech**:提供语音识别(STT)与语音合成(TTS)服务,向 TEN 提供以下参数:
|
||||
`AZURE_STT_KEY`、`AZURE_STT_REGION`、`AZURE_TTS_KEY`、`AZURE_TTS_REGION`
|
||||
|
||||
- **TEN(平台中枢)**:作为系统的中枢平台,统一集成并调度上述所有平台的 API、密钥与 Token,
|
||||
实现 AI Sales Avatar —— **Vendy** 的整体智能对话流程与实时互动能力。
|
||||
|
||||
---
|
||||
|
||||
📌 **小提示**:上述平台均可根据实际需求,替换为其他开源或 SaaS 方案。
|
||||
本项目所用组合为参考示例,便于学习与复用。
|
||||
|
||||
---
|
||||
|
||||
## 二、开始搭建(每一步都像玩乐高)
|
||||
|
||||
我们首先将在 Dify 上完成三步操作,搭建出一个基于内部数据的 AI Sales Avatar “本体”。
|
||||
演示场景是:**名品车导购数字人**,她的名字叫 **Vendy**。
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 1:注册 Dify 账号并配置模型 API
|
||||
|
||||
👉 打开 Dify 官网: [https://dify.ai/](https://dify.ai/),点击右上角 “Get Started”,开始注册流程。
|
||||
|
||||

|
||||
|
||||
你可以使用以下方式登录或注册账号:**GitHub**、**Gmail**,或 **Hotmail**。
|
||||
|
||||

|
||||
|
||||
登录 Dify 后,在左侧菜单点击 **「Settings > Model Provider」(模型提供商)**。
|
||||
在页面中找到 **OpenAI** 模块,点击 **Install** 进行安装。
|
||||
|
||||

|
||||
|
||||
在 **OpenAI** 模块中,点击蓝色链接 **「Get your API Key from OpenAI」**,
|
||||
系统会自动跳转到 OpenAI 官方平台:[https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)。
|
||||
|
||||

|
||||
|
||||
在 OpenAI 上点击 **「+ Create new secret key」** 生成新的 API 密钥。
|
||||
复制生成的 Key,并返回 Dify,在 OpenAI 模块中粘贴如下字段:
|
||||
|
||||

|
||||
|
||||
完成模型配置后,我们已经准备好了运行环境,
|
||||
现在可以开始在 Dify 上构建 AI Sales Avatar 的知识本体了。
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 2:上传 AI Sales Avatar 所需的内部资料(知识文档)
|
||||
|
||||
在 Dify 控制台顶部菜单,点击 **「Knowledge」**,
|
||||
然后点击 **「Create Knowledge」** 创建一个新的知识数据集。
|
||||
|
||||

|
||||
|
||||
在接下来的页面中,选择资料上传方式,推荐使用 **「Import from file」** 方式。
|
||||
|
||||
👇 如下图所示:
|
||||
|
||||

|
||||
|
||||
请上传你已经准备好的企业内部资料,如产品介绍、销售手册、常见问题文档等。
|
||||
若你还没有准备相关资料,也可以用 ChatGPT 辅助生成内容。
|
||||
|
||||
👇 例如我们用 ChatGPT 生成了一个名品车品牌介绍的 Word 文档(Lexus、Audi、BMW 等):
|
||||
|
||||

|
||||
|
||||
下载好文档后,回到 Dify 上传页面,选择 **「Import from file」**,上传该文件。
|
||||
上传成功后,点击右下角的 **「Next」**,继续下一步设置。
|
||||
|
||||

|
||||
|
||||
默认设置已经适用于大多数场景,建议保持原样,直接点击 **「Save & Process」** 即可。
|
||||
(如需后续提升智能体的理解精度,也可根据实际需求调整相关参数)
|
||||
|
||||

|
||||
|
||||
✅ 若你看到以下页面,表示你的文档已经成功上传并被 Dify 系统解析完成。
|
||||
|
||||

|
||||
|
||||
到这里,我们已经完成了智能体知识库的构建部分,
|
||||
下一步,我们将创建一个智能体应用,并接入这个知识库!
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 3:创建智能体 App,并接入知识库
|
||||
|
||||
进入 Dify 控制台,点击顶部菜单栏的 **「Studio」**,再点击右上角的 **「Create」** 创建新 App。
|
||||
|
||||
在弹出窗口中填写以下内容:
|
||||
|
||||
- **App Name & Icon**:如 `AI Sales Avatar`
|
||||
- **Description**:
|
||||
Your name is Vendy, the AI Clerk of Luxury Cars.
|
||||
Your task is to provide information about luxury cars to the customers based on the knowledge.
|
||||
|
||||
👇 设置界面如下所示:
|
||||
|
||||

|
||||
|
||||
点击 **Create** 后,会进入 App 的 **Orchestrate** 编辑界面。
|
||||
|
||||
在 **INSTRUCTION** 栏中填写与刚才 **Description** 一致的内容:
|
||||
|
||||
Your name is Vendy, the AI Clerk of Luxury Cars.
|
||||
Your task is to provide information about luxury cars to the customers based on the knowledge.
|
||||
|
||||
然后,在下方的 **Knowledge** 区块中,选择我们刚刚上传的知识文档作为参考资料。
|
||||
|
||||
👇 配置界面如下所示:
|
||||
|
||||

|
||||
|
||||
配置完成后,可以在右侧输入框测试是否能正常调用知识库内容。
|
||||
如果返回的内容基于上传的文档,就说明智能体连接成功 ✅
|
||||
|
||||
测试无误后,点击右上角的 **「Publish」**,发布这个 AI 应用。
|
||||
|
||||

|
||||
|
||||
应用发布后,点击左侧菜单栏中的 **「API Access」**,进入后点击右上角的 **「Create Secret Key」**。
|
||||
这个 API Key 是后续在 TEN 平台接入时必须使用的,请务必复制保存好。
|
||||
|
||||
👇 接口密钥生成界面如下所示:
|
||||
|
||||

|
||||
|
||||
🎉 恭喜你!至此,我们已经完成了 AI Sales Avatar 的“智能体本体”搭建,
|
||||
并成功获得了用于调用的 API Key。
|
||||
|
||||
接下来,我们将进入 **Trulience 平台**,为 AI Sales Avatar 生成她的 “数字人外貌与演绎能力” ——
|
||||
也就是构建她的虚拟形象,让她不仅能“听、说、想”,还能真实地出现在用户面前,与人互动!
|
||||
|
||||
📚 如需进一步了解 Dify,可参考官方技术文档:
|
||||
👉 [https://docs.dify.ai/en/introduction](https://docs.dify.ai/en/introduction)
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 4:注册 Trulience 账号,获取数字人的 ID 和访问 Token
|
||||
|
||||
现在,我们将为 AI Sales Avatar 赋予一个可视化的 “数字人形象”!
|
||||
我们将使用 Trulience 平台来生成形象,并获取用于后续连接的 **Avatar ID** 与访问 **Token**。
|
||||
|
||||
✅ 操作流程如下:
|
||||
|
||||
1️⃣ 打开 Trulience 官网: [https://trulience.com](https://trulience.com)
|
||||
点击主页上的 **「Start For Free」** 按钮,开始注册账号。
|
||||
|
||||
👇 页面示意图如下:
|
||||
|
||||

|
||||
|
||||
2️⃣ 注册完成后,进入后台界面。点击左侧菜单的 **「IMAGE AVATARS」**,
|
||||
选择一个女性角色作为 **Vendy** 的外貌,点击绿色按钮 **「Create Avatar」** 生成数字人。
|
||||
|
||||
👇 选择与创建界面示意图如下:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
3️⃣ 当你看到 **“Avatar created”** 的提示时,说明数字人已经成功创建。
|
||||
|
||||
👇 创建成功提示界面如下所示:
|
||||
|
||||

|
||||
|
||||
3️⃣ 我们将左侧的名称从默认的 **Amanda** 修改为 **Vendy**,
|
||||
此时你可以在下方看到她专属的 **Avatar ID**。
|
||||
|
||||
👇 如下图所示:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
4️⃣ 接下来,点击底部按钮 **「Connect」**,浏览器会跳转到一个新的页面。
|
||||
请从网页地址(URL)中复制 `token=` 后面的那段字符串,
|
||||
这就是你的 **访问 Token**。
|
||||
|
||||
建议将 **Avatar ID** 与 **Token** 一并复制保存好,稍后将在 TEN 平台中使用。
|
||||
|
||||
---
|
||||
|
||||
🎉 恭喜你!
|
||||
我们已经完成了 AI Sales Avatar 的“**外貌搭建**”,并成功获得了她的 Avatar ID 与访问 Token!
|
||||
|
||||
接下来就进入最后一步:
|
||||
我们将把 Dify 的智能体 + Trulience 的数字人,
|
||||
一并接入 **TEN 平台**,构建真正“听说想演”一体化的实时语音 AI 代理!
|
||||
|
||||
📚 如需进一步了解 Trulience,可参考官方技术文档:
|
||||
👉 [https://www.trulience.com/docs#/](https://www.trulience.com/docs#/)
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Step 5:在本地搭建 TEN Agent 平台前,我们需要准备这三项配置
|
||||
|
||||
在将 Dify 的智能体、Trulience 的数字人接入 TEN 平台之前,
|
||||
我们需要提前准备好语音通信和语音识别/合成所需的账号与密钥,主要包括以下三项:
|
||||
|
||||
---
|
||||
|
||||
### ✅ 1. Agora 实时语音通信参数
|
||||
|
||||
TEN 使用 **Agora** 来实现语音通话能力(“她会说话”),需要准备以下参数:
|
||||
|
||||
- `AGORA_APP_ID=`(App ID)
|
||||
- `AGORA_CERTIFICATE=`(Certificate)
|
||||
|
||||
👉 获取方式:
|
||||
登录 Agora 控制台 [https://console.agora.io](https://console.agora.io) 创建一个新项目后,即可获取上述信息。
|
||||
|
||||
👇 控制台页面如下:
|
||||
|
||||

|
||||
|
||||
登录账号后,点击左侧栏的 **「Projects」**,
|
||||
再点击右上角的 **「Create New」** 创建一个新项目。
|
||||
|
||||
👇 创建项目入口界面如下:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### 📝 输入项说明:
|
||||
|
||||
- **Project Name**:填写为 `AISalesAvatar`
|
||||
- **Use Case**:选择合适的用途,例如 `Enterprise Collaboration`
|
||||
- **Authentication Mode**:选择 **Secure Mode: APP ID + Token(推荐)**
|
||||
|
||||
填写完成后,点击 **「Submit」** 完成项目创建。
|
||||
|
||||
👇 创建成功后,即可获取 App ID 和 Certificate:
|
||||
|
||||

|
||||
|
||||
项目创建成功后,将跳转到项目管理页面。
|
||||
在项目列表中,点击 **App ID** 后方的复制按钮,即可获取 **App ID**。
|
||||
|
||||
👇 如图所示:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
在获取 App ID 后,继续点击项目右侧的 ✏️ **铅笔图标(编辑按钮)**,进入项目详情页。
|
||||
|
||||
在页面底部的 **Primary Certificate** 区域,点击右侧的复制按钮,
|
||||
即可复制该项目的 **Certificate**。
|
||||
|
||||
👇 如下图所示:
|
||||
|
||||

|
||||
|
||||
至此,我们已经成功获取 **Agora 的 App ID 和 Primary Certificate**,
|
||||
为后续在 TEN 平台启用语音通信功能做好了准备。
|
||||
|
||||
📚 如需进一步了解,可参考官方技术文档:
|
||||
👉 [https://docs.agora.io/en/video-calling/get-started/manage-agora-account?platform=web#create-an-agora-project](https://docs.agora.io/en/video-calling/get-started/manage-agora-account?platform=web#create-an-agora-project)
|
||||
|
||||
---
|
||||
|
||||
### ✅ 2. Azure Speech 参数(语音识别 + 语音合成)
|
||||
|
||||
**Azure** 负责将用户的语音转为文字(STT),并将 AI 回复转成语音(TTS)。
|
||||
需要准备以下 4 个环境变量:
|
||||
|
||||
AZURE_STT_KEY= ;AZURE_STT_REGION= ;AZURE_TTS_KEY= ;AZURE_TTS_REGION= 。
|
||||
|
||||
👉 获取方式如下:
|
||||
|
||||
打开 Azure Portal,请登录 Azure 官方门户网站:
|
||||
🔗 [https://portal.azure.com](https://portal.azure.com)
|
||||
|
||||
在首页点击左上角的 **「Create a resource(创建资源)」**,
|
||||
在搜索栏中输入 **Azure OpenAI**,点击进入创建页面。
|
||||
|
||||
👇 创建入口界面如下:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
参考以下内容,填写基本信息(**Basics**):
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
通常默认选择 **「公共访问」** 即可,允许服务通过互联网访问:
|
||||
|
||||

|
||||
|
||||
🧩 可选步骤:你可以为资源添加如 `project=ai-agent` 等标签,便于后续分类与管理。
|
||||
|
||||
👇 标签与网络配置界面如下:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
📝 确认填写信息无误后,点击 **「Create(创建)」** 按钮,即可开始部署 Azure OpenAI 服务资源。
|
||||
|
||||
👇 创建部署确认界面:
|
||||
|
||||

|
||||
|
||||
👇 资源部署中画面如下:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
部署完成后,进入 **Azure AI Foundry**,你将看到如下欢迎界面,
|
||||
可用于快速创建项目与选择模型:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
进入 **「Model Catalog(模型目录)」** 页面后,选择 **Azure AI Speech**:
|
||||
|
||||

|
||||
|
||||
点击 **Azure-AI-Speech** 模型后,进入其详细页面,
|
||||
点击页面上方的 **「Use Service」** 按钮,即可跳转进入 Speech Playground 页面:
|
||||
|
||||

|
||||
|
||||
进入 **Speech Playground**,选择你的语音服务资源(如下图所示),
|
||||
即可看到对应的 **API Key** 和 **Region**:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
点击 **「Text to Speech」** 标签,进入 **Voice Gallery**,
|
||||
可试听多种语音风格,选择最适合你 AI Avatar 的声音类型:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
点击 **「View Code」**,即可复制当前语音服务的 **API Key 和 Region**:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
🎉 **恭喜你!**
|
||||
至此,我们已经完成了 **TEN 平台运行所需的所有参数准备工作 ✅**
|
||||
|
||||
---
|
||||
|
||||
### 🧱 下一步,我们就可以正式在本地启动 TEN Agent 平台,
|
||||
并将前面搭建的所有模块:
|
||||
|
||||
- 🧠 智能体(Dify)
|
||||
- 🔊 语音能力(Azure Speech + Agora)
|
||||
- 👩💻 虚拟形象(Trulience)
|
||||
|
||||
**完整串联起来,构建真正“听说想演”的实时 AI 数字销售助理!**
|
||||
|
||||
---
|
||||
|
||||
📚 如需进一步了解 Azure Speech 与 OpenAI 服务部署,参考官方文档:
|
||||
👉 [https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal)
|
||||
|
||||
## 🧩 Step 6:在 Mac 上本地部署 TEN Agent 的开发环境
|
||||
|
||||
为了运行并调试 AI Sales Avatar 的语音交互系统,
|
||||
我们需要在本地准备好 **TEN Agent 的开发环境**。
|
||||
|
||||
---
|
||||
|
||||
### 🔧 所需工具与安装方式一览:
|
||||
|
||||
| 工具 | 功能说明 | 安装方式 |
|
||||
|----------|---------------------------|----------------------------------|
|
||||
| Docker | 运行 TEN 的容器环境 | 官网下载安装 Docker Desktop |
|
||||
| Git | 克隆并管理 TEN 的代码仓库 | `brew install git` |
|
||||
| Node.js | 运行前端代码(Playground) | `brew install node` |
|
||||
|
||||
---
|
||||
|
||||
### ✅ ① 安装 Docker
|
||||
|
||||
💡 Docker 是 TEN 平台的核心运行环境,所有模块都将以容器形式部署。
|
||||
|
||||
- 打开官网链接:👉 [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
|
||||
- 下载适用于 macOS 的 `.dmg` 安装包,并完成安装。
|
||||
- 安装后,点击应用列表中的 Docker 图标启动。
|
||||
- 等待顶部菜单栏的 🐳 图标变为绿色 表示已成功启动。
|
||||
- 打开 Terminal,输入以下命令验证是否成功安装:
|
||||
```bash
|
||||
docker -v
|
||||
|
||||
✅ ② 安装 Git
|
||||
💡 Git 是用来克隆和管理 TEN 框架代码的版本控制工具。
|
||||
|
||||
安装命令:brew install git; 验证安装:git -v
|
||||
|
||||
✅ ③ 安装 Node.js
|
||||
💡 Node.js 是运行 TEN 的前端 Playground 所必需的环境。
|
||||
|
||||
安装命令:brew install node; 验证安装:node -v
|
||||
|
||||
✅ ④ 克隆 TEN Agent 框架代码
|
||||
完成 Docker、Git、Node 安装后,下一步就是克隆 TEN Agent 的源代码,并配置 .env 环境变量。
|
||||
|
||||
🚀 1. 克隆 TEN Agent 代码仓库
|
||||
在 Terminal 中执行以下命令:git clone https://github.com/TEN-Framework/TEN-Agent.git
|
||||
|
||||
执行后,会在本地创建一个 TEN-Agent 文件夹,
|
||||
其中包含所有运行所需的代码和配置文件。
|
||||
|
||||
👇 如下图所示:
|
||||
|
||||

|
||||
|
||||
📦 2. 进入项目目录并复制环境变量模板
|
||||
进入 ai_agents 子目录,并复制环境变量文件:
|
||||
|
||||
cd TEN-Agent/ai_agents
|
||||
cp .env.example .env
|
||||
|
||||
.env 是 TEN Agent 运行所需的环境变量配置文件,
|
||||
接下来你需要手动编辑它,输入密钥信息(来自 Dify、Trulience、Azure、Agora)。
|
||||
|
||||
👇 示例界面如下:
|
||||
|
||||

|
||||
|
||||
✍ 3. 编辑 `.env` 文件,填写以下变量:
|
||||
|
||||
请使用文本编辑器(推荐使用 **Cursor** 或 **VS Code**)打开并编辑 `.env` 文件,
|
||||
在文件末尾添加以下内容(填写你自己的密钥和区域信息):
|
||||
|
||||
Agora App ID 和 Certificate
|
||||
AGORA_APP_ID=your_agora_app_id
|
||||
AGORA_APP_CERTIFICATE=your_agora_certificate
|
||||
|
||||
Azure 语音识别(STT)参数
|
||||
AZURE_STT_KEY=your_stt_key
|
||||
AZURE_STT_REGION=your_stt_region
|
||||
|
||||
Azure 语音合成(TTS)参数
|
||||
AZURE_TTS_KEY=your_tts_key
|
||||
AZURE_TTS_REGION=your_tts_region
|
||||
|
||||
👇 编辑 `.env` 文件示意图如下:
|
||||
|
||||

|
||||
|
||||
## ✅ Step ⑤:启动 TEN Agent 容器,编译并运行 Server
|
||||
|
||||
在 `.env` 环境变量配置完成后,下一步是正式启动 **TEN Agent 的容器环境**。
|
||||
|
||||
---
|
||||
|
||||
### 🐳 ① 启动容器
|
||||
|
||||
进入 `ai_agents` 目录并启动 Docker 容器服务:
|
||||
|
||||
cd ai_agents
|
||||
docker compose up -d
|
||||
|
||||
这会启动以下容器服务:
|
||||
|
||||
ten_agent_dev:用于开发和运行 Agent
|
||||
|
||||
ten_agent_demo:示例 Agent
|
||||
|
||||
ten_agent_playground:前端交互页面
|
||||
|
||||
👇 项目结构示意图如下:
|
||||
|
||||

|
||||
|
||||
|
||||
🔧 ② 进入容器并编译 Agent Server
|
||||
执行以下命令,进入开发容器:docker exec -it ten_agent_dev bash
|
||||
|
||||
进入容器后,执行初始化任务脚本来注册 Agent:task use
|
||||
|
||||
👇 项目结构示意图如下:
|
||||
|
||||

|
||||
|
||||
该命令将自动读取并链接 Agent 的配置文件(如 `manifest.json` 和 `property.json`),
|
||||
并自动安装所需依赖包。
|
||||
|
||||
👇 执行过程示意图如下:
|
||||
|
||||

|
||||
|
||||
✅ 完成 `task run` 后,在浏览器中访问以下地址以打开前端页面:
|
||||
|
||||
👉 [https://localhost:49483]
|
||||
|
||||
如果运行成功,你将看到如下界面:
|
||||
|
||||
点击页面上方的 **「Graph」** 选项卡。
|
||||
|
||||
在下拉框中选择:
|
||||
➡️ **`voice_assistant_intergrated_stt (Auto Start)`**,
|
||||
然后点击右下角的 **「Save」** 保存配置。
|
||||
|
||||
👇 页面示意图如下:
|
||||
|
||||

|
||||
|
||||
✅ 替换语音合成(TTS)模块为 **Azure 引擎**
|
||||
|
||||
1. 找到图中的 **TTS 模块**(如 `tts_default`)
|
||||
2. 鼠标右键点击该模块,选择 **「Replace Node with」**
|
||||
3. 在弹出的列表中选择 **`azure_tts`**
|
||||
|
||||
这样就完成了语音合成模块的替换.
|
||||
|
||||
👇 Azure TTS 模块替换示意图如下:
|
||||
|
||||

|
||||
|
||||
🎙️ 关于数字人的声音设置(TTS 语音)
|
||||
|
||||
我们可以根据数字人的形象需求,自定义她的声音。
|
||||
在 Microsoft 提供的语音服务页面中,列出了所有支持的语音名称。
|
||||
|
||||
👉 访问地址如下:
|
||||
[https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts#multilingual-voices](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts#multilingual-voices)
|
||||
|
||||
---
|
||||
|
||||
在本例中,我们选择的是一位英文女声:
|
||||
🗣️ **`en-US-AshleyNeural`**
|
||||
|
||||
在 Azure TTS 模块中,请将以下字段填写为:
|
||||
Azure_synthesis_voice_name=en-US-AshleyNeural
|
||||
|
||||
👇 Azure TTS 语音名称设置示意图如下:
|
||||
|
||||

|
||||
|
||||
🔁 替换 LLM 模块为 Dify 接口,连接 Dify 智能体
|
||||
|
||||
1. 右键点击 **`llm` 模块**,选择 **「Replace Node with」**
|
||||
2. 在弹出的列表中选择 **`dify_python`**
|
||||
|
||||
这样即可将 TEN Agent 的大语言模型(LLM)模块,接入 Dify 提供的智能体接口。
|
||||
|
||||
👇 操作示意图如下:
|
||||
|
||||

|
||||
|
||||
2️⃣ 完成替换后,再次右键点击新生成的 **`dify_python` 模块**,
|
||||
点击 **「Update Properties」**,进入属性设置页面。
|
||||
|
||||
- 在 **API Key** 字段中,输入你在 Dify 平台上创建的 API Key
|
||||
- 在 **Greeting** 字段中,可以根据需求自定义欢迎语(如欢迎语音问候)
|
||||
|
||||
👇 设置界面示意图如下:
|
||||
|
||||

|
||||
|
||||
✅ 启动 TEN Agent 并连接 Trulience 数字人
|
||||
|
||||
---
|
||||
|
||||
### 🚀 启动前端页面
|
||||
|
||||
配置完成后,打开浏览器,访问以下地址,即可进入 TEN Agent 启动界面:
|
||||
|
||||
👉 [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
👇 页面示意图如下:
|
||||
|
||||

|
||||
|
||||
🧠 选择智能体流程图(Graph)
|
||||
|
||||
1. 点击右上角的 **「Select Graph」**,在下拉菜单中选择:
|
||||
➤ `voice_assistant_integrated_stt`
|
||||
|
||||
2. 勾选 **「Enable Trulience Avatar」**,并填写以下字段:
|
||||
|
||||
- **Avatar ID**(在 Trulience 创建数字人时获得)
|
||||
- **Avatar Token**(点击 Connect 后,从浏览器地址栏中复制)
|
||||
|
||||
3. 填写完成后,点击 **「Save changes」** 保存设置。
|
||||
|
||||
👇 配置界面如下图所示:
|
||||
|
||||

|
||||
|
||||
🗣️ 启动语音互动,测试数字人是否连通成功
|
||||
|
||||
✅ 点击右上角的 **「Connect」** 按钮,完成最后测试。
|
||||
|
||||
如果一切配置正确,将出现以下情景:
|
||||
|
||||
- 🧍 数字人形象自动加载显示
|
||||
- 🗣️ 她会用自然语音向你问候,并提问,例如:
|
||||
_“我能为你介绍哪几款豪华车?”_
|
||||
|
||||
- 🤖 你可以根据她的回答,验证她是否成功读取并理解了 Dify 知识库的内容。
|
||||
|
||||
👇 运行示意图如下:
|
||||
|
||||

|
||||
|
||||
🎯 恭喜你!你现在已经拥有了完整的 **AI Sales Avatar**!
|
||||
|
||||
---
|
||||
✅ 来自 **OpenAI / Dify** 的聊天大脑
|
||||
✅ 使用 **Azure** 的自然语音合成能力(女声)
|
||||
✅ 拥有 **Trulience** 的数字人形象
|
||||
✅ 构建于 **TEN 平台** 的语音交互能力
|
||||
---
|
||||
🌟 这就是 AI Agent 最核心的完整链路:
|
||||
**“听 → 想 → 说 → 演 → 链接”**
|
||||
---
|
||||
|
||||
📚 如需进一步了解,可参考 TEN 官方技术文档:
|
||||
👉 [https://theten.ai/docs/ten_agent/architecture_flow](https://theten.ai/docs/ten_agent/architecture_flow)
|
||||
|
||||
## 🛠️ 下一步扩展建议(基于 AX 架构)
|
||||
|
||||
在目前已搭建的「AI Sales Avatar」基础上,
|
||||
我们可以依照 **AX Architecture** 的路径,进一步扩展它在实际业务场景中的能力,
|
||||
逐步打通:
|
||||
**数据 → 模型 → 代理 → 用户接口 → 全业务生命周期管理** 的闭环链路。
|
||||
|
||||
---
|
||||
|
||||
### 🧑💼 嵌入网页首页,作为公司虚拟形象代表
|
||||
|
||||
结合 **Trulience** 的 D-Human & Avatar 能力,
|
||||
将当前数字人部署到公司首页或 Web App,
|
||||
通过自然语音问答引导访客、收集意图,构建以用户为中心的入口,承接:
|
||||
|
||||
- `Marketing Info`
|
||||
- `Customer Lifecycle`
|
||||
|
||||
---
|
||||
|
||||
### 📦 接入数据库 & 订单管理系统,进阶为“AI 销售代表”
|
||||
|
||||
将 Avatar 与公司内部系统对接,例如:
|
||||
|
||||
- CRM、ERP、OA、订单系统(如 Salesforce、SAP、Notion DB 等)
|
||||
|
||||
实现:
|
||||
- 销售线索管理
|
||||
- 库存查询
|
||||
- 合同生成等闭环任务
|
||||
服务于:
|
||||
|
||||
- `Contract Lifecycle`
|
||||
- `Asset Lifecycle`
|
||||
---
|
||||
|
||||
### 🔗 接入企业核心平台:从“个体应用”迈向“组织级协同”
|
||||
|
||||
你可以进一步将 Agent PF(平台)能力模块化,
|
||||
嵌入不同 BU 的 Data Lake 与工作流管理平台,
|
||||
实现以下多业务融合扩展场景:
|
||||
|
||||
- AI + Finance
|
||||
- AI + HR
|
||||
- AI + R&D
|
||||
- AI + SNS(协作)
|
||||
|
||||
最终推动企业整体的 AI 转型升级。
|
||||
|
||||
## ✨ 写在最后:一点感言
|
||||
|
||||
我始终相信,AI 不应只是冰冷和强大的工具,
|
||||
它更可以是人类温暖的伙伴,是个体能力的延伸与放大器。
|
||||
|
||||
未来,也许会有越来越多像 “**Vendy**” 这样的数字伙伴,在世界各地悄然诞生——
|
||||
她们**倾听、思考、回应、表达**,用技术的力量,守护人的尊严与创造力。
|
||||
|
||||
---
|
||||
|
||||
📣 若您也愿意加入这场全球共创的旅程,
|
||||
欢迎携手探索与分享,让每一位个体都有机会与 AI 一同成长,
|
||||
共同探索 **“一以当千、不落一人”** 的 AX 新时代。
|
||||
|
||||
---
|
||||
|
||||
谨以此文作为一次小小的尝试与记录,
|
||||
愿它化作一颗微小的种子,
|
||||
在人与 AI 和谐共生的未来中,**悄然生根、缓缓发芽。**
|
||||
893
zh-hans/learn-more/use-cases/build-aisalesavatarEN.md
Normal file
893
zh-hans/learn-more/use-cases/build-aisalesavatarEN.md
Normal file
@@ -0,0 +1,893 @@
|
||||
# Exploring the AI Sales Avatar
|
||||
**Dify × TEN × Trulience × Azure × Agora × OpenAI Integration Guide**
|
||||
|
||||
---
|
||||
|
||||
This guide is designed for global 🌍 enterprise developers and individual explorers.
|
||||
We’ll walk you through building an AI-powered digital sales assistant capable of:
|
||||
|
||||
🧠 **Listening**
|
||||
🗣️ **Speaking**
|
||||
🤖 **Thinking**
|
||||
🎭 **Performing**
|
||||
|
||||
All through a real-world use case:
|
||||
> **Luxury Car AI Sales Avatar – Vendy**
|
||||
|
||||
---
|
||||
|
||||
### 🙏 Acknowledgements
|
||||
Before we begin, heartfelt thanks to the teams from **Dify**, **TEN**, **Agora**, and **Azure**
|
||||
for their guidance and encouragement. This project was made possible by the spirit of:
|
||||
|
||||
- ✨ Exploration
|
||||
- 🤝 Collaboration
|
||||
- 🚀 Empowerment
|
||||
|
||||
It is this spirit that enabled me — a zero-to-one AI co-creator — to bring this idea to life.
|
||||
|
||||
> 💬 _“I hope this document provides a practical and reusable pathway for more AI explorers around the world —
|
||||
lowering technical barriers and enabling the real-world implementation of **AX (AI Transformation)**.”_
|
||||
|
||||
---
|
||||
|
||||
### 💡 I firmly believe:
|
||||
|
||||
> **AI is created by humans, developed by humans, and ultimately exists to protect human dignity and freedom.**
|
||||
Only when technology resonates with human values can it truly become a power for every individual.
|
||||
|
||||
---
|
||||
|
||||
**👤 Author**: Alec Lee |AX Global Strategist & Full-Stack Explorer
|
||||
_“Empowering one to stand for a thousand — leaving no one behind across cultures and systems.”_
|
||||
|
||||
📅 **Date**: May 11, 2025
|
||||
📧 **Email**: [alec.lee1005@gmail.com](mailto:alec.lee1005@gmail.com)
|
||||
|
||||
|
||||
---
|
||||
|
||||
## 1. What are the six platforms that power a “Listen–Think–Speak–Perform” AI Avatar?
|
||||
|
||||
This project is centered on the **TEN platform**, integrating six key systems to create **Vendy**, a luxury car AI sales avatar with full conversational capability.
|
||||
Vendy can:
|
||||
- 👂 Listen to questions
|
||||
- 🧠 Think and respond
|
||||
- 🗣️ Speak answers
|
||||
- 🧍 Present herself as a digital human
|
||||
|
||||
👇 Below is the **architecture diagram** showing the full system integration:
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Platform Roles Overview
|
||||
|
||||
👇 This diagram outlines the **role of each platform**, their **integration modules**, and the **collaboration workflow**:
|
||||
<!-- (Insert diagram or list here in next section) -->
|
||||
|
||||
|
||||
|
||||

|
||||
|
||||
## 🧩 Roles of Each Platform in the System
|
||||
|
||||
👇 The diagram below illustrates how each platform contributes within the system — including their integration modules and collaborative workflow:
|
||||
<!-- (Insert architecture diagram or detailed list of platform roles below) -->
|
||||
|
||||

|
||||
|
||||
## 📌 Platform Functions Overview
|
||||
|
||||
### **Dify + OpenAI**
|
||||
Builds the **intelligent agent core**. It connects to both **internal enterprise data** and the **OpenAI API**, providing a **unified conversation API interface** to TEN.
|
||||
|
||||
### **Trulience**
|
||||
Enables **digital human rendering**. It provides a **digital human ID** and **access token** to TEN for **visual avatar presentation**.
|
||||
|
||||
### **Agora**
|
||||
Handles **voice and video communication**. It provides **App ID** and **Certificate** to TEN for **real-time interaction**.
|
||||
|
||||
### **Azure Speech**
|
||||
Offers **speech-to-text (STT)** and **text-to-speech (TTS)** services. It provides the following parameters to TEN:
|
||||
- `AZURE_STT_KEY`
|
||||
- `AZURE_STT_REGION`
|
||||
- `AZURE_TTS_KEY`
|
||||
- `AZURE_TTS_REGION`
|
||||
|
||||
### **TEN (Central Platform)**
|
||||
Serves as the **orchestration hub**, integrating and managing APIs, keys, and tokens from all platforms.
|
||||
TEN enables **Vendy**, the AI Sales Avatar, to conduct **intelligent conversations** and **real-time interactions**.
|
||||
|
||||
> 📌 **Note:** Each of the platforms above can be substituted with alternative open-source or SaaS services depending on your use case.
|
||||
> The current combination is a reference setup, designed for **learning** and **reusability**.
|
||||
|
||||
---
|
||||
|
||||
## 2. Let’s Build! (Think of it like assembling LEGO 🧱)
|
||||
|
||||
We’ll start with three simple steps in **Dify** to build the **“core intelligence”** of our AI Sales Avatar — based on **internal company data**.
|
||||
Our demo scenario: a **luxury car sales assistant** named **Vendy**.
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 1: Register a Dify Account & Configure Model API
|
||||
|
||||
👉 Go to the official Dify website: [https://dify.ai/](https://dify.ai/)
|
||||
Click "**Get Started**" in the top right corner to begin the registration process.
|
||||
|
||||
|
||||

|
||||
|
||||
You can sign up or log in using one of the following methods::**GitHub**、**Gmail**,or **Hotmail**.
|
||||
|
||||

|
||||
|
||||
After logging into **Dify**, follow these steps:
|
||||
Click **“Settings > Model Provider”** in the left-hand menu.
|
||||
On the page, locate the **OpenAI** module and click **Install** to set it up.
|
||||
|
||||

|
||||
|
||||
In the OpenAI module, click the blue link labeled **“Get your API Key from OpenAI”**.
|
||||
You’ll be redirected to the official OpenAI platform:[https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)。
|
||||
|
||||

|
||||
|
||||
On the OpenAI platform, click **“+ Create new secret key”** to generate a new API key.
|
||||
Copy the generated key.Return to **Dify**, and paste the key into the **OpenAI module** under the following fields:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 2: Upload Internal Documents for the AI Sales Avatar
|
||||
|
||||
Once the model configuration is complete, your environment is ready.
|
||||
You can now begin building the **knowledge base** for your AI Sales Avatar in Dify.
|
||||
|
||||
1. In the **Dify console**, click **“Knowledge”** from the top menu.
|
||||
2. Then click **“Create Knowledge”** to create a new **knowledge dataset**.
|
||||
|
||||

|
||||
|
||||
On the following page, choose your preferred method for uploading content.
|
||||
We recommend using the **“Import from file”** option for the most straightforward setup.
|
||||
|
||||
👇 As shown in the illustration below:
|
||||
|
||||

|
||||
|
||||
Please upload your prepared internal documents — such as product brochures, sales manuals, FAQ sheets, and more.
|
||||
If you haven't prepared relevant materials yet, you can also use **ChatGPT** to help generate content.
|
||||
|
||||
👇 For example, we generated a Word document using ChatGPT that introduces several luxury car brands (e.g., **Lexus**, **Audi**, **BMW**, etc.):
|
||||
|
||||

|
||||
|
||||
After downloading the document, return to the **Dify upload page**,
|
||||
select **“Import from file”**, and upload the prepared file.
|
||||
|
||||
✅ Once the upload is successful, click the **“Next”** button in the bottom-right corner to proceed to the next configuration step.
|
||||
|
||||

|
||||
|
||||
The **default settings** are suitable for most use cases.
|
||||
We recommend keeping them as they are and simply clicking **“Save & Process”** to complete the setup.
|
||||
> ⚙️ *(Optional)* If you later wish to improve the AI assistant’s comprehension accuracy,
|
||||
> you can adjust parameters based on your specific business needs.
|
||||
|
||||

|
||||
|
||||
✅ If you see the following page, it means your document has been successfully uploaded and parsed by the Dify system.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
At this point, we’ve completed the **knowledge base setup** —
|
||||
your AI Sales Avatar now has its foundational memory in place.
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 3: Create an AI Application and Connect the Knowledge Base
|
||||
|
||||
1. In the **Dify console**, click the top menu item **“Studio”**.
|
||||
2. Then, click the **“Create”** button in the upper-right corner to start building a new App.
|
||||
|
||||
In the pop-up window, fill in the following fields:
|
||||
|
||||
- **App Name & Icon**:Example: `AI Sales Avatar`
|
||||
- **Description**:
|
||||
Your name is Vendy, the AI Clerk of Luxury Cars.
|
||||
Your task is to provide information about luxury cars to the customers based on the knowledge.
|
||||
|
||||
👇 The settings interface looks like this:
|
||||
|
||||

|
||||
|
||||
After clicking **“Create”**, you’ll be taken to the App’s **Orchestrate** editing interface.
|
||||
|
||||
In the **INSTRUCTION** section, enter content consistent with the earlier **Description**, such as:
|
||||
|
||||
Your name is Vendy, the AI Clerk of Luxury Cars.
|
||||
Your task is to provide information about luxury cars to the customers based on the knowledge.
|
||||
|
||||
Next, scroll down to the **Knowledge** section.
|
||||
|
||||
Select the **knowledge document** we uploaded earlier as the reference material for the AI application.
|
||||
|
||||

|
||||
|
||||
Once the configuration is complete, use the **input box on the right side** of the Orchestrate interface to test your AI agent.
|
||||
If the responses reference the content from your uploaded document, it means the **knowledge base integration is working correctly**.
|
||||
|
||||
After confirming everything works as expected, click the **“Publish”** button in the upper-right corner to officially launch your AI application.
|
||||
|
||||

|
||||
|
||||
After publishing the application, click **“API Access”** from the left-hand sidebar menu.
|
||||
Then click the **“Create Secret Key”** button in the upper-right corner.
|
||||
|
||||
This **API Key** is essential for integrating your AI application with the **TEN platform** in the next step.
|
||||
Please make sure to **copy and store it securely**.
|
||||
|
||||
👇 The secret key generation interface looks like this:
|
||||
|
||||

|
||||
|
||||
🎉 **Congratulations!**
|
||||
You’ve now completed the setup of your **AI Sales Avatar’s core intelligence** and successfully obtained the **API Key** required for integration.
|
||||
|
||||
Next, we’ll move into the **Trulience platform**, where we will design the **digital appearance and performance capabilities** of your AI Sales Avatar.
|
||||
|
||||
In other words — we will give her a **face, expression, and presence**, enabling her to not only “listen, speak, and think,” but also to **appear on screen and interact with users in a human-like manner**!
|
||||
|
||||
📚 To learn more about Dify, visit the official documentation:
|
||||
👉 [https://docs.dify.ai/en/introduction](https://docs.dify.ai/en/introduction)
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 4: Register a Trulience Account and Get Your Digital Avatar ID & Token
|
||||
|
||||
Now it’s time to give your AI Sales Avatar a **visual identity**!
|
||||
We’ll use the **Trulience platform** to generate a digital human and retrieve the necessary **Avatar ID** and **Access Token** for integration.
|
||||
|
||||
✅ Follow these steps:
|
||||
|
||||
1️⃣ Go to the Trulience website: [https://trulience.com](https://trulience.com)
|
||||
Click the **“Start For Free”** button on the homepage to begin registration.
|
||||
|
||||
👇 Sample interface:
|
||||
|
||||

|
||||
|
||||
2️⃣ After registration, you’ll be redirected to the dashboard.
|
||||
From the left-hand menu, click **“IMAGE AVATARS”**.
|
||||
|
||||
Choose a **female character** to represent **Vendy**’s appearance,
|
||||
then click the green **“Create Avatar”** button to generate the digital human.
|
||||
|
||||
👇 Sample interface for avatar selection and creation:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
3️⃣ When you see the **“Avatar created”** message, it means your digital human has been successfully created.
|
||||
|
||||
👇 Confirmation screen after successful creation:
|
||||
|
||||

|
||||
|
||||
3️⃣ Rename the default avatar name (e.g., **Amanda**) to **Vendy** using the field on the left panel.
|
||||
Once renamed, you’ll see her unique **Avatar ID** displayed below.
|
||||
|
||||
👇 Example view:
|
||||
<!-- (Insert screenshot showing renamed avatar and Avatar ID) -->
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
4️⃣ Next, click the **“Connect”** button at the bottom of the screen.
|
||||
Your browser will redirect to a new page.
|
||||
|
||||
From the **URL**, copy the string that comes after `token=` —
|
||||
this is your **Access Token**.
|
||||
|
||||
---
|
||||
|
||||
🎉 **Congratulations!**
|
||||
You’ve successfully completed the **visual appearance setup** for your AI Sales Avatar,
|
||||
and obtained both the **Avatar ID** and **Access Token**.
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Step 5: Connect Everything in TEN for Real-Time Voice AI Agent
|
||||
|
||||
Now it’s time for the final step:
|
||||
We’ll integrate the **intelligent core from Dify** and the **digital human from Trulience**
|
||||
into the **TEN platform**, building a truly unified AI agent that can **listen, speak, think, and perform** — all in real time!
|
||||
|
||||
> 📚 To learn more about Trulience, visit the official documentation:
|
||||
👉 [https://www.trulience.com/docs#/](https://www.trulience.com/docs#/)
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Step 5: Prepare Three Key Configurations Before Running TEN Agent Locally
|
||||
|
||||
Before integrating the **Dify agent** and **Trulience digital human** into the TEN platform,
|
||||
we need to set up the accounts and credentials required for voice communication and speech processing.
|
||||
|
||||
Specifically, you’ll need to prepare the following three components:
|
||||
|
||||
---
|
||||
|
||||
### ✅ 1. Agora Real-Time Voice Communication Parameters
|
||||
|
||||
TEN uses **Agora** to enable real-time voice interactions (i.e., “she can speak”).
|
||||
You’ll need the following parameters:
|
||||
|
||||
- `AGORA_APP_ID=`(App ID)
|
||||
- `AGORA_CERTIFICATE=`(Certificate)
|
||||
|
||||
👉 **How to get it:**
|
||||
Log in to the Agora Console: [https://console.agora.io](https://console.agora.io)
|
||||
Create a new project, and you’ll be able to access the required parameters.
|
||||
|
||||
👇 Sample view of the Agora Console:
|
||||
|
||||

|
||||
|
||||
After logging in, click **“Projects”** from the left sidebar.
|
||||
Then, click **“Create New”** in the top-right corner to create a new project.
|
||||
|
||||
👇 Project creation interface:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### 📝 Input Field Guide:
|
||||
|
||||
- **Project Name**: Use something like `AISalesAvatar`
|
||||
- **Use Case**: Select an appropriate option, e.g., `Enterprise Collaboration`
|
||||
- **Authentication Mode**: Choose **Secure Mode: APP ID + Token (Recommended)**
|
||||
|
||||
Once completed, click **“Submit”** to create the project.
|
||||
|
||||
👇 After successful creation, you will be able to access your **App ID** and **Certificate**:
|
||||
<!-- (Insert screenshot showing the generated App ID and Certificate) -->
|
||||
|
||||

|
||||
|
||||
Once the project is created, you’ll be redirected to the project management page.
|
||||
In the project list, click the **copy icon** next to **App ID** to copy it.
|
||||
|
||||
👇 Example interface:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
After copying the **App ID**, click the ✏️ **pencil icon** (Edit) on the right side of the project row to enter the **Project Details** page.
|
||||
|
||||
Scroll to the bottom of the page to find the **Primary Certificate** section.
|
||||
Click the **copy icon** to copy the project's **Certificate**.
|
||||
|
||||
👇 Example view:
|
||||
|
||||

|
||||
|
||||
At this point, you’ve successfully obtained the **Agora App ID** and **Primary Certificate**,
|
||||
completing the required setup for enabling **real-time voice communication** in the TEN platform.
|
||||
|
||||
> 📚 For more information, refer to the official Agora documentation:
|
||||
> [https://docs.agora.io](https://docs.agora.io)
|
||||
|
||||
📚 For more information, refer to the official Agora documentation:
|
||||
👉 [https://docs.agora.io/en/video-calling/get-started/manage-agora-account?platform=web#create-an-agora-project](https://docs.agora.io/en/video-calling/get-started/manage-agora-account?platform=web#create-an-agora-project)
|
||||
|
||||
---
|
||||
|
||||
### ✅ 2. Azure Speech Parameters (Speech-to-Text + Text-to-Speech)
|
||||
|
||||
**Azure** handles two critical voice functions:
|
||||
- **STT (Speech-to-Text)**: Converts the user's spoken words into text
|
||||
- **TTS (Text-to-Speech)**: Converts the AI's text responses into speech
|
||||
|
||||
You’ll need to prepare the following four environment variables:
|
||||
|
||||
AZURE_STT_KEY= ;AZURE_STT_REGION= ;
|
||||
AZURE_TTS_KEY= ;AZURE_TTS_REGION=.
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Next, fill in the required fields under the **Basics** tab:
|
||||
👇 Reference guide for the "Basics" section:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
For most cases, selecting the default option **“Public access”** is sufficient,
|
||||
which allows the service to be accessed over the internet.
|
||||
|
||||

|
||||
|
||||
🧩 **Optional Step:**
|
||||
You can add resource tags — for example, `project=ai-agent` — to help with future organization and management.
|
||||
|
||||
👇 Example view of the **Tags** and **Networking** configuration screen:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
📝 After reviewing and confirming that all information is correct,
|
||||
click the **“Create”** button to start deploying the Azure OpenAI resource.
|
||||
|
||||
👇 Deployment confirmation screen:
|
||||
|
||||

|
||||
|
||||
👇 Resource deployment in progress:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
After deployment is complete, navigate to **Azure AI Foundry**.
|
||||
You’ll see the following welcome screen, which allows you to quickly create a project and select a model:
|
||||
|
||||
👇 Azure AI Foundry welcome interface:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Go to the **“Model Catalog”** page and select **Azure AI Speech**.
|
||||
|
||||
👇 Model selection interface:
|
||||
|
||||

|
||||
|
||||
After clicking the **Azure-AI-Speech** model, you’ll be taken to its details page.
|
||||
Click the **“Use Service”** button at the top of the page to jump to the **Speech Playground**.
|
||||
|
||||
👇 Speech service launch interface:
|
||||
|
||||

|
||||
|
||||
Inside the **Speech Playground**, select your speech service resource (as shown below).
|
||||
You’ll then be able to view the corresponding **API Key** and **Region**.
|
||||
|
||||
👇 Speech service resource selection and key display:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Click the **“Text to Speech”** tab to enter the **Voice Gallery**,
|
||||
where you can preview various voice styles and select the one that best fits your AI Avatar.
|
||||
|
||||
👇 Voice Gallery interface for selecting speech styles:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
Click the **“View Code”** button to copy the current speech service’s **API Key** and **Region**.
|
||||
|
||||
👇 Example interface for copying credentials:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
🎉 **Congratulations!**
|
||||
You’ve now completed all the required parameter preparations.
|
||||
for running the **TEN platform** and connecting your AI Sales Avatar.
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
### 🧱 What’s Next: Launching the TEN Agent Platform Locally
|
||||
|
||||
Now we’re ready to **launch the TEN Agent platform on your local machine**,
|
||||
and connect all the components we’ve prepared:
|
||||
|
||||
- 🧠 **Intelligent Agent** (via Dify)
|
||||
- 🔊 **Voice Capabilities** (via Azure Speech + Agora)
|
||||
- 👩💻 **Digital Avatar** (via Trulience)
|
||||
|
||||
Together, these form a truly **real-time, embodied AI Sales Assistant**
|
||||
that can **listen, think, speak, and perform** — end to end.
|
||||
|
||||
Let’s build it!
|
||||
|
||||
---
|
||||
|
||||
📚 For more details on deploying Azure Speech and OpenAI services, refer to the official documentation:
|
||||
👉 [https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal)
|
||||
|
||||
### 🧩 Step 6: Set Up the TEN Agent Development Environment on macOS
|
||||
|
||||
To run and test the AI Sales Avatar’s real-time voice interaction system,
|
||||
we first need to set up the **TEN Agent development environment** on your Mac.
|
||||
|
||||
---
|
||||
|
||||
### 🔧 Required Tools & Installation Guide
|
||||
|
||||
| Tool | Purpose | Installation Method |
|
||||
|-----------|----------------------------------------|-----------------------------------------|
|
||||
| Docker | Container environment for running TEN | Download from the official Docker site |
|
||||
| Git | Clone and manage the TEN codebase | `brew install git` |
|
||||
| Node.js | Run the front-end (Playground) | `brew install node` |
|
||||
|
||||
|
||||
---
|
||||
|
||||
### ✅ ① Install Docker
|
||||
|
||||
💡 Docker is the core runtime environment for the TEN platform — all modules will run in containerized form.
|
||||
|
||||
Follow these steps:
|
||||
|
||||
- Open the official Docker website: 👉 [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
|
||||
- Download the `.dmg` installer for macOS and complete the installation.
|
||||
- After installation, launch Docker from your Applications folder.
|
||||
- Wait until the 🐳 Docker icon in the top menu bar turns **green**, indicating it's running successfully.
|
||||
- Open your Terminal and run the following command to verify the installation:
|
||||
|
||||
Verify the installation: docker -v. If you see a version number, Docker is installed correctly.
|
||||
|
||||
### ✅ ② Install Git
|
||||
|
||||
💡 Git is a version control tool used to **clone and manage the TEN framework codebase**.
|
||||
|
||||
- Install Git using Homebrew:
|
||||
brew install git.
|
||||
Verify the installation: git -v. If a version number appears, Git is installed successfully.
|
||||
|
||||
### ✅ ③ Install Node.js
|
||||
|
||||
💡 Node.js is required to run the **TEN Playground frontend** locally.
|
||||
|
||||
- Install Node.js using Homebrew: brew install node
|
||||
Verify the installation: node -v. If a version number appears, Node.js has been installed successfully.
|
||||
|
||||
|
||||
### ✅ ④ Clone the TEN Agent Codebase
|
||||
|
||||
Once Docker, Git, and Node.js are installed, the next step is to **clone the TEN Agent source code** and prepare the `.env` environment configuration.
|
||||
|
||||
🚀 **Step 1: Clone the TEN Agent GitHub repository**
|
||||
|
||||
Open your Terminal and run: git clone https://github.com/TEN-Framework/TEN-Agent.git
|
||||
|
||||
This will create a local folder named TEN-Agent,
|
||||
containing all the necessary code and configuration files for the platform.
|
||||
|
||||
👇 Directory structure example:
|
||||
|
||||

|
||||
|
||||
📦 **Step 2: Navigate to the project directory and copy the environment variable template**
|
||||
|
||||
Change into the `ai_agents` subdirectory and copy the example `.env` file:
|
||||
|
||||
cd TEN-Agent/ai_agents
|
||||
cp .env.example .env
|
||||
|
||||
The `.env` file contains the **environment variables required to run the TEN Agent**.
|
||||
|
||||
Next, you’ll need to **manually edit** this file and input the necessary credentials, including:
|
||||
|
||||
- Azure STT/TTS Keys and Regions
|
||||
- Agora App ID & Certificate
|
||||
|
||||
👇 Example view of the `.env` configuration file:
|
||||
|
||||

|
||||
|
||||
✍ **Step 3: Edit the `.env` File and Fill in the Following Variables**
|
||||
|
||||
Use a text editor (we recommend **Cursor** or **VS Code**) to open the `.env` file.
|
||||
Scroll to the end of the file and add the following variables — replacing the values with **your own credentials**:
|
||||
|
||||
Agora App ID and Certificate
|
||||
AGORA_APP_ID=your_agora_app_id
|
||||
AGORA_APP_CERTIFICATE=your_agora_certificate
|
||||
|
||||
Azure STT Parameters
|
||||
AZURE_STT_KEY=your_stt_key
|
||||
AZURE_STT_REGION=your_stt_region
|
||||
|
||||
Azure TTS Parameters
|
||||
AZURE_TTS_KEY=your_tts_key
|
||||
AZURE_TTS_REGION=your_tts_region
|
||||
|
||||
👇 Example view of the `.env` file being edited:
|
||||
|
||||

|
||||
|
||||
## ✅ Step ⑤: Start the TEN Agent Container and Run the Server
|
||||
|
||||
Once your `.env` file has been properly configured, the next step is to **launch the TEN Agent container environment**.
|
||||
|
||||
---
|
||||
|
||||
### 🐳 ① Start the Container
|
||||
|
||||
Navigate to the `ai_agents` directory and start the Docker container services:
|
||||
|
||||
cd ai_agents
|
||||
docker compose up -d
|
||||
|
||||
This command will launch the following container services:
|
||||
|
||||
ten_agent_dev: Main development container for running the Agent
|
||||
|
||||
ten_agent_demo: Example agent instance
|
||||
|
||||
ten_agent_playground: Frontend interface for interactive testing
|
||||
|
||||
👇 Project structure example:
|
||||
|
||||

|
||||
|
||||
|
||||
🔧 ② Enter the Container and Compile the Agent Server
|
||||
|
||||
Run the following command to access the development container:docker exec -it ten_agent_dev bash
|
||||
|
||||
🔧 ③ Run the Initialization Script to Register the Agent.
|
||||
|
||||
Once inside the container, execute the following command to register the Agent:task use
|
||||
|
||||
👇 Example of the project structure after initialization:
|
||||
|
||||

|
||||
|
||||
This command will automatically read and link the Agent’s configuration files
|
||||
(such as `manifest.json` and `property.json`),
|
||||
and install all necessary dependencies.
|
||||
|
||||
👇 Example output of the execution process:
|
||||
|
||||

|
||||
|
||||
✅ After completing `task run`, open your browser and go to the following address to launch the frontend:
|
||||
|
||||
👉 [https://localhost:49483](https://localhost:49483)
|
||||
|
||||
If everything is running correctly, you should see the interface below:
|
||||
|
||||
- Click on the **“Graph”** tab at the top of the page.
|
||||
- From the dropdown menu, select your desired Agent instance.
|
||||
|
||||
👇 Example UI view:
|
||||
|
||||
➡️ **`voice_assistant_intergrated_stt (Auto Start)`**,
|
||||
Then, click the **“Save”** button in the bottom-right corner to save your configuration.
|
||||
|
||||
👇 Sample interface view:
|
||||
|
||||

|
||||
|
||||
✅ Replace the Text-to-Speech (TTS) Module with **Azure Engine**
|
||||
|
||||
1. Locate the **TTS module** in the graph (e.g., `tts_default`)
|
||||
2. Right-click on the module and select **“Replace Node with”**
|
||||
3. From the dropdown list, choose **`azure_tts`**
|
||||
|
||||
This completes the replacement of the TTS module with the Azure-based engine.
|
||||
|
||||
👇 Example view of replacing the TTS module with Azure TTS:
|
||||
|
||||

|
||||
|
||||
🎙️ **Customizing the Digital Human’s Voice (TTS Settings)**
|
||||
|
||||
You can customize the voice of your digital avatar to match her personality and appearance.
|
||||
Microsoft provides a full list of supported voice names in its speech service documentation.
|
||||
|
||||
👉 Visit the following link to browse available voices:
|
||||
[https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts#multilingual-voices](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts#multilingual-voices)
|
||||
|
||||
---
|
||||
|
||||
In this example, we selected an English female voice:
|
||||
|
||||
🗣️ **`en-US-AshleyNeural`**
|
||||
|
||||
In the Azure TTS module, set the following field:
|
||||
|
||||
Azure_synthesis_voice_name=en-US-AshleyNeural
|
||||
|
||||

|
||||
|
||||
🔁 **Replace the LLM Module with Dify API to Connect Your Intelligent Agent**
|
||||
|
||||
1. Right-click on the **`llm`** module and select **“Replace Node with”**
|
||||
2. From the popup list, choose **`dify_python`**
|
||||
|
||||
This will replace the default large language model (LLM) in TEN Agent with the Dify-powered intelligent agent interface.
|
||||
|
||||
👇 Example view of the replacement process:
|
||||
|
||||

|
||||
|
||||
2️⃣ After replacing the module, right-click the newly created **`dify_python`** node again
|
||||
and select **“Update Properties”** to open the configuration panel.
|
||||
|
||||
- In the **API Key** field, enter the API Key you created on the Dify platform
|
||||
- In the **Greeting** field, you can optionally customize a welcome message (e.g., a voice greeting)
|
||||
|
||||
👇 Example view of the Dify module property settings:
|
||||
|
||||

|
||||
|
||||
✅ 启动 TEN Agent 并连接 Trulience 数字人
|
||||
|
||||
---
|
||||
|
||||
### 🚀 Launch the Frontend Interface
|
||||
|
||||
Once configuration is complete, open your browser and navigate to the following address
|
||||
to access the TEN Agent launch interface:
|
||||
|
||||
👉 [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
👇 Example view of the launch interface:
|
||||
|
||||

|
||||
|
||||
🧠 **Select the Agent Graph (Workflow)**
|
||||
|
||||
1. Click **“Select Graph”** in the upper-right corner, and from the dropdown menu choose:
|
||||
➤ `voice_assistant_integrated_stt`
|
||||
|
||||
2. Check the box for **“Enable Trulience Avatar”** and fill in the following fields:
|
||||
|
||||
- **Avatar ID** (obtained during Trulience avatar creation)
|
||||
- **Avatar Token** (copied from the URL after clicking "Connect" in Trulience)
|
||||
|
||||
3. After completing the fields, click **“Save changes”** to apply the settings.
|
||||
|
||||
👇 Example view of the configuration screen:
|
||||
|
||||

|
||||
|
||||
🗣️ **Start Voice Interaction and Verify Digital Human Connectivity**
|
||||
|
||||
✅ Click the **“Connect”** button in the upper-right corner to run the final test.
|
||||
|
||||
If everything is configured correctly, the following should happen:
|
||||
|
||||
- 🧍 The digital human avatar will load and appear on screen
|
||||
- 🗣️ She will greet you with natural speech and ask a question, such as:
|
||||
_“Which luxury cars can I introduce to you today?”_
|
||||
|
||||
- 🤖 Based on her response, you can verify whether she successfully retrieved and understood content from the Dify knowledge base.
|
||||
|
||||
👇 Example view of the running interaction:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
🎯 **Congratulations!**
|
||||
You now have a fully functional **AI Sales Avatar**!
|
||||
|
||||
---
|
||||
|
||||
✅ A conversational brain powered by **OpenAI / Dify**
|
||||
✅ Natural voice synthesis (female voice) via **Azure**
|
||||
✅ A digital human appearance rendered by **Trulience**
|
||||
✅ Real-time voice interaction built on the **TEN platform**
|
||||
|
||||
---
|
||||
|
||||
🌟 This is the complete and essential chain of an AI Agent:
|
||||
**Listen → Think → Speak → Perform → Connect**
|
||||
|
||||
---
|
||||
|
||||
📚 To learn more, refer to the official TEN documentation:
|
||||
[https://github.com/TEN-Framework/TEN-Agent](https://github.com/TEN-Framework/TEN-Agent)
|
||||
|
||||
👉 [https://theten.ai/docs/ten_agent/architecture_flow](https://theten.ai/docs/ten_agent/architecture_flow)
|
||||
|
||||
## 🛠️ Next Step: Expansion Suggestions (Based on AX Architecture)
|
||||
|
||||
Building upon your current **AI Sales Avatar**,
|
||||
you can follow the **AX Architecture** roadmap to further enhance its capabilities in real-world business scenarios.
|
||||
|
||||
The goal is to gradually integrate a full-cycle loop of:
|
||||
|
||||
**Data → Model → Agent → User Interface → Full Business Lifecycle Management**
|
||||
|
||||
---
|
||||
|
||||
### 🧑💼 Embed on the Company Homepage as a Virtual Brand Representative
|
||||
|
||||
By integrating **Trulience**’s D-Human and Avatar capabilities,
|
||||
you can deploy your digital human onto the company homepage or web application.
|
||||
|
||||
Through natural voice-based Q&A, the avatar can guide visitors, capture their intent,
|
||||
and serve as a user-centric entry point that connects to:
|
||||
|
||||
- `Marketing Info`
|
||||
- `Customer Lifecycle`
|
||||
|
||||
---
|
||||
|
||||
### 📦 Integrate with Databases & Order Management Systems to Evolve into an “AI Sales Representative”
|
||||
|
||||
Connect the Avatar with internal enterprise systems such as:
|
||||
|
||||
- CRM, ERP, OA, and order management tools (e.g., Salesforce, SAP, Notion DB, etc.)
|
||||
|
||||
This enables the AI agent to perform end-to-end tasks like:
|
||||
|
||||
- Sales lead management
|
||||
- Inventory checks
|
||||
- Contract generation
|
||||
|
||||
Serving business processes such as:
|
||||
|
||||
- `Contract Lifecycle`
|
||||
- `Asset Lifecycle`
|
||||
|
||||
---
|
||||
|
||||
### 🔗 Integrate with Core Enterprise Platforms: From “Individual Use” to “Organizational Collaboration”
|
||||
|
||||
You can further modularize the Agent PF (platform) capabilities
|
||||
and embed them into the Data Lakes and workflow management platforms of various BUs.
|
||||
|
||||
This unlocks cross-functional integration scenarios such as:
|
||||
|
||||
- AI + Finance
|
||||
- AI + HR
|
||||
- AI + R&D
|
||||
- AI + SNS (Collaboration)
|
||||
|
||||
Ultimately, it paves the way for a company-wide AI transformation and upgrade.
|
||||
|
||||
---
|
||||
|
||||
### ✨ Final Reflections
|
||||
|
||||
I’ve always believed that AI should not merely be a cold, powerful tool —
|
||||
but also a **warm companion to humanity**,
|
||||
an extension and amplifier of our individual potential.
|
||||
|
||||
In the near future, we may see more digital companions like **“Vendy”** quietly emerge across the world —
|
||||
beings who **listen**, **think**, **respond**, and **express**,
|
||||
using the power of technology to uphold **human dignity and creativity**.
|
||||
|
||||
---
|
||||
|
||||
### 🤝 A Call for Co-Creation
|
||||
|
||||
If you, too, wish to join this global journey of co-creation,
|
||||
we warmly invite you to **explore, experiment, and share** —
|
||||
so that every individual can grow alongside AI,
|
||||
and together, we may step into the AX era of:
|
||||
|
||||
> **“One Against a Thousand — Leaving No One Behind.”**
|
||||
|
||||
---
|
||||
|
||||
### 🌱 A Humble Beginning
|
||||
|
||||
This document is just a small experiment — a seed of possibility.
|
||||
May it quietly take root, and gently begin to sprout
|
||||
in a future where **humans and AI coexist in harmony**.
|
||||
869
zh-hans/learn-more/use-cases/build-aisalesavatarJP.md
Normal file
869
zh-hans/learn-more/use-cases/build-aisalesavatarJP.md
Normal file
@@ -0,0 +1,869 @@
|
||||
# AIセールスアバターの探求
|
||||
|
||||
—— Dify × TEN × Trulience × Azure × Agora × OpenAI 統合実践ガイド ——
|
||||
|
||||
本ガイドは、世界中の 🌍 企業開発者および個人の探究者の方々を対象に、
|
||||
できるだけシンプルでわかりやすい方法で、
|
||||
「聞く・話す・考える・演じる」ことができるAIデジタルセールスアシスタントの構築手順を一歩ずつご紹介します。
|
||||
|
||||
今回のユースケースは、**高級車のAIデジタル販売員**。彼女の名前は **Vendy** です。
|
||||
|
||||
---
|
||||
|
||||
構築を始める前に、**Dify、TEN、Agora、Azure** 各チームの皆様より
|
||||
多大なるご指導とご支援をいただきましたこと、心より御礼申し上げます。
|
||||
|
||||
本プロジェクトは、グローバルなオープンソースコミュニティが持つ
|
||||
**「探求・共創・賦能」** の精神によって支えられており、
|
||||
ゼロから始めた私のようなAI共創の探索者にも、
|
||||
この構想をエンドツーエンドで実現する機会が与えられました。
|
||||
|
||||
---
|
||||
|
||||
このドキュメントが、世界中のAI探究者にとって:
|
||||
|
||||
**実用的かつ再利用可能な道しるべ** となり、 ハンズオンのハードルを下げ、
|
||||
AX(AIトランスフォーメーション)を個人 × 企業 × 社会のレベルで真に実装・活用する後押しになれば幸いです。
|
||||
|
||||
もし改善点やお気づきの点がありましたら、ぜひご連絡ください。
|
||||
|
||||
---
|
||||
|
||||
💡 **私は信じています:**
|
||||
|
||||
> **AIは人により生まれ、人に育まれ、そして人の尊厳と自由を守るために存在する。**
|
||||
>
|
||||
> テクノロジーの進化は、人の価値観と共鳴してこそ、真に一人ひとりの力となる。
|
||||
|
||||
---
|
||||
|
||||
**著者**:Alec Lee|AXグローバルストラテジスト & フルスタック・エクスプローラー
|
||||
文化やシステムを越え、「一騎当千」と「一人不遺」(=誰一人も取り残さない)のAX新時代へ。
|
||||
|
||||
**日付**:2025年5月11日
|
||||
**Eメール**:[alec.lee1005@gmail.com](mailto:alec.lee1005@gmail.com)
|
||||
|
||||
|
||||
## 一、「聞く・話す・考える・演じる」AIデジタルアシスタントは、どの6つのプラットフォームから構成されているのか?
|
||||
|
||||
本プロジェクトは、**TENプラットフォームを中枢**とし、
|
||||
以下の6つの主要プラットフォームを統合することで、
|
||||
高級車の販売を想定したAIセールスアバター(AI Sales Avatar)— **Vendy** を構築します。
|
||||
|
||||
---
|
||||
|
||||
Vendyは、以下の4つの能力を備えています:
|
||||
|
||||
- 👂「聞く」:ユーザーの質問を音声で受け取る
|
||||
- 🤔「考える」:質問に基づき思考・回答を生成する
|
||||
- 🗣️「話す」:自然な音声で応答を返す
|
||||
- 👤「演じる」:デジタルヒューマンとして画面上に現れ、表情を伴って表現する
|
||||
|
||||
👇 以下は、システム全体の統合アーキテクチャ図です:
|
||||
|
||||

|
||||
|
||||
## 🧩 各プラットフォームにおける役割分担
|
||||
|
||||
👇 下図は、システム内で各プラットフォームが担うモジュールおよび
|
||||
統合されたワークフローの概要を示しています:
|
||||
|
||||

|
||||
|
||||
## 📌 各プラットフォームの機能概要:
|
||||
|
||||
- **Dify + OpenAI**:
|
||||
インテリジェントエージェントを構築し、社内データおよびOpenAI APIを活用。
|
||||
TENプラットフォームに対し、統一された対話APIインターフェースを提供します。
|
||||
|
||||
- **Trulience**:
|
||||
デジタルヒューマンの演出機能を提供。
|
||||
TENに対し、アバターIDとアクセストークンを渡し、仮想キャラクターの表示を可能にします。
|
||||
|
||||
- **Agora**:
|
||||
音声通信・ビデオ通話機能を提供。
|
||||
TENに対して、App IDおよびCertificate(証明書)を提供します。
|
||||
|
||||
- **Azure Speech**:
|
||||
音声認識(STT)および音声合成(TTS)サービスを提供。
|
||||
TENには以下のパラメーターを渡します:
|
||||
`AZURE_STT_KEY`、`AZURE_STT_REGION`、`AZURE_TTS_KEY`、`AZURE_TTS_REGION`
|
||||
|
||||
- **TEN(中枢プラットフォーム)**:
|
||||
システムのオーケストレーションハブとして、上記すべてのAPI、キー、トークンを統合・管理。
|
||||
AIセールスアバター **Vendy** によるインテリジェントな会話とリアルタイム対話機能を実現します。
|
||||
|
||||
---
|
||||
|
||||
📌 **補足**:
|
||||
上記プラットフォームは、ユースケースに応じて他のOSSやSaaSに置き換えることも可能です。
|
||||
本プロジェクトの構成は、学習および再利用を目的としたリファレンス例です。
|
||||
|
||||
---
|
||||
|
||||
## 二、構築を開始しよう(まるでLEGOを組み立てるように)
|
||||
|
||||
まずは Dify 上で3つのステップを行い、
|
||||
社内データに基づいた AI Sales Avatar の「本体」を構築します。
|
||||
|
||||
今回のデモシナリオは:
|
||||
**高級車販売のデジタルアシスタント**、彼女の名前は **Vendy** です。
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 1:Difyアカウントの登録とモデルAPIの設定
|
||||
|
||||
👉 Difyの公式サイトへアクセス: [https://dify.ai/](https://dify.ai/)
|
||||
右上の「Get Started」ボタンをクリックし、登録を開始します。
|
||||
|
||||

|
||||
|
||||
アカウントの登録・ログインには、以下の方法が利用できます: **GitHub**、**Gmail**、または **Hotmail**
|
||||
|
||||

|
||||
|
||||
Difyにログインした後、左側メニューから **「Settings > Model Provider(モデルプロバイダー)」** をクリックします。
|
||||
ページ内の **OpenAI** モジュールを見つけて、**「Install」** をクリックし、インストールを行います。
|
||||
|
||||

|
||||
|
||||
**OpenAI** モジュール内で、青色のリンク **「Get your API Key from OpenAI」** をクリックすると、
|
||||
OpenAI の公式プラットフォームへ:[https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)。
|
||||
|
||||

|
||||
|
||||
OpenAI の画面で **「+ Create new secret key」** をクリックし、新しい APIキー を生成します。
|
||||
生成されたキーをコピーし、Dify に戻って OpenAI モジュール内の以下のフィールドに貼り付けます:
|
||||
|
||||

|
||||
|
||||
モデルの設定が完了すると、Dify上での実行環境の準備が整います。
|
||||
これで、AI Sales Avatar の「知識ベース(ナレッジ本体)」の構築を始めることができます。
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 2:AI Sales Avatar に必要な内部資料(ナレッジドキュメント)をアップロードする
|
||||
|
||||
Dify のコンソール上部メニューから **「Knowledge」** をクリックし、
|
||||
続いて **「Create Knowledge」** を選択して、新しいナレッジデータセットを作成します。
|
||||
|
||||

|
||||
|
||||
次の画面で、ナレッジのアップロード方法を選択します。
|
||||
おすすめは、**「Import from file(ファイルからインポート)」** を選ぶ方法です。
|
||||
|
||||
👇 以下のような画面になります:
|
||||
|
||||

|
||||
|
||||
あらかじめ用意しておいた社内資料(製品紹介、営業マニュアル、FAQドキュメントなど)をアップロードしてください。
|
||||
もし資料がまだ準備できていない場合は、ChatGPTを使ってコンテンツを生成することも可能です。
|
||||
|
||||
👇 例えば、私たちは ChatGPT を活用して、Lexus・Audi・BMW などの高級車ブランド紹介をまとめた Word ドキュメントを作成しました:
|
||||
|
||||

|
||||
|
||||
ドキュメントをダウンロードしたら、Difyのアップロード画面に戻り、
|
||||
**「Import from file」** を選択して該当ファイルをアップロードします。
|
||||
|
||||
アップロードが完了したら、画面右下の **「Next」** をクリックして、次の設定ステップへ進みます。
|
||||
|
||||

|
||||
|
||||
デフォルトの設定はほとんどのケースに適しているため、基本的にはそのままで問題ありません。
|
||||
そのまま **「Save & Process」** をクリックして進めてください。
|
||||
(エージェントの理解精度をさらに高めたい場合は、後からパラメーターを調整することも可能です。)
|
||||
|
||||

|
||||
|
||||
✅ 以下の画面が表示された場合、ドキュメントのアップロードが正常に完了し、Difyシステムによって正しく解析されたことを意味します。
|
||||
|
||||

|
||||
|
||||
これで、AIエージェントのナレッジベース構築が完了しました。
|
||||
次のステップでは、このナレッジを活用するためのエージェントアプリを作成し、接続していきます!
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 3:エージェントアプリを作成し、ナレッジベースに接続する
|
||||
|
||||
Dify のコンソール画面にて、上部メニューから **「Studio」** をクリックし、
|
||||
右上の **「Create」** ボタンを押して、新しいアプリを作成します。
|
||||
|
||||
ポップアップウィンドウで、以下の内容を入力します:
|
||||
|
||||
- **App Name & Icon**:如 `AI Sales Avatar`
|
||||
- **Description**:
|
||||
Your name is Vendy, the AI Clerk of Luxury Cars.
|
||||
Your task is to provide information about luxury cars to the customers based on the knowledge.
|
||||
|
||||
👇 設定画面は以下のようになります:
|
||||
|
||||

|
||||
|
||||
点击 **Create** 后,会进入 App 的 **Orchestrate** 编辑界面。
|
||||
|
||||
在 **INSTRUCTION** 栏中填写与刚才 **Description** 一致的内容:
|
||||
|
||||
**Create** をクリックすると、アプリの **Orchestrate(オーケストレート)** 編集画面に移動します。
|
||||
|
||||
ここで、**INSTRUCTION** 欄に、先ほど入力した **Description(説明文)** と同じ内容を入力してください。
|
||||
|
||||
続いて、画面下部の **Knowledge** セクションにて、
|
||||
先ほどアップロードしたナレッジドキュメントを参照資料として選択します。
|
||||
|
||||
👇 設定画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
設定が完了したら、右側の入力フィールドでテストを行い、
|
||||
ナレッジベースの内容が正しく参照できるかを確認します。
|
||||
|
||||
アップロードしたドキュメントに基づいた回答が返ってくる場合、
|
||||
エージェントがナレッジと正常に接続されていることを意味します。
|
||||
|
||||
問題がなければ、画面右上の **「Publish」** をクリックして、AIアプリを公開しましょう。
|
||||
|
||||

|
||||
|
||||
アプリを公開した後、左側メニューの **「API Access」** をクリックします。
|
||||
画面右上の **「Create Secret Key」** をクリックすると、APIキーが生成されます。
|
||||
|
||||
この APIキー は、後ほど TEN プラットフォームに接続する際に必須となるため、
|
||||
**必ずコピーして安全な場所に保存しておいてください。**
|
||||
|
||||
👇 APIキーの生成画面は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🎉 おめでとうございます!
|
||||
これで、AI Sales Avatar の「知能本体」部分の構築が完了し、
|
||||
TENプラットフォームで使用するための APIキー も無事に取得できました。
|
||||
|
||||
---
|
||||
|
||||
続いては、**Trulience プラットフォーム** に進み、
|
||||
AI Sales Avatar に「外見と演出能力(=デジタルヒューマンの可視化)」を与えます。
|
||||
|
||||
つまり、彼女が「聞く・話す・考える」だけでなく、
|
||||
画面上に現れ、人と自然にインタラクションできるようになります!
|
||||
|
||||
---
|
||||
|
||||
📚 Dify の詳細については、以下の公式ドキュメントも参考にしてください:
|
||||
👉 [https://docs.dify.ai/en/introduction](https://docs.dify.ai/en/introduction)
|
||||
|
||||
---
|
||||
|
||||
### 🧩 Step 4:Trulienceアカウントの登録と、アバターID・アクセストークンの取得
|
||||
|
||||
次は、AI Sales Avatar に「可視化されたデジタルヒューマンの姿」を与えます。
|
||||
Trulience プラットフォームを使用してアバターを生成し、
|
||||
後ほど接続に必要となる **Avatar ID** と **アクセストークン(Token)** を取得します。
|
||||
|
||||
✅ 操作の流れは以下の通りです:
|
||||
|
||||
1️⃣ Trulienceの公式サイトにアクセス: [https://trulience.com](https://trulience.com)
|
||||
トップページの **「Start For Free」** ボタンをクリックして、アカウント登録を開始します。
|
||||
|
||||
👇 ページの画面例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
2️⃣ 登録が完了すると、管理画面(ダッシュボード)に移動します。
|
||||
左側メニューの **「IMAGE AVATARS」** をクリックし、
|
||||
女性キャラクターの中から1人を選び、**Vendy** の外見として設定します。
|
||||
|
||||
その後、緑色の **「Create Avatar」** ボタンをクリックして、アバターを生成します。
|
||||
|
||||
👇 選択および作成画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
3️⃣ 画面に **「Avatar created」** のメッセージが表示されたら、
|
||||
デジタルヒューマンの作成が正常に完了したことを意味します。
|
||||
|
||||
👇 作成成功時の画面例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
3️⃣ 左側に表示されているデフォルトの名前(例:**Amanda**)を **Vendy** に変更します。
|
||||
名前を変更すると、画面下部にこのアバター専用の **Avatar ID** が表示されます。
|
||||
|
||||
👇 以下のように確認できます:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
4️⃣ 次に、画面下部の **「Connect」** ボタンをクリックすると、
|
||||
ブラウザが新しいページにリダイレクトされます。
|
||||
|
||||
そのとき、URLの中にある `token=` 以降の文字列をコピーしてください。
|
||||
これが **アクセストークン(Token)** になります。
|
||||
|
||||
この **Avatar ID** と **Token** は、後ほど TEN プラットフォームに接続する際に必要となるため、
|
||||
忘れずに一緒に控えておくことをおすすめします。
|
||||
|
||||
---
|
||||
|
||||
🎉 おめでとうございます!
|
||||
これで、AI Sales Avatar の「**外見構築**」が完了し、
|
||||
アバターの **Avatar ID** および **アクセストークン(Token)** を無事に取得できました。
|
||||
|
||||
---
|
||||
|
||||
次はいよいよ最終ステップです:
|
||||
Difyで構築したインテリジェントエージェントと、
|
||||
Trulienceで生成したデジタルヒューマンを、
|
||||
**TEN プラットフォーム** に統合し、
|
||||
「聞く・話す・考える・演じる」を一体化したリアルタイム音声AIエージェントを実現します!
|
||||
|
||||
---
|
||||
|
||||
📚 Trulience の詳細については、以下の公式ドキュメントをご参照ください:
|
||||
👉 [https://www.trulience.com/docs#/](https://www.trulience.com/docs#/)
|
||||
|
||||
---
|
||||
|
||||
## 🧩 Step 5:TEN Agent プラットフォームをローカルで構築する前に必要な3つの準備
|
||||
|
||||
Dify のインテリジェントエージェントと Trulience のデジタルヒューマンを
|
||||
TEN プラットフォームに接続する前に、
|
||||
音声通信および音声認識・音声合成に必要なアカウントと認証情報を事前に用意しておく必要があります。
|
||||
|
||||
主に準備が必要なのは、以下の3項目です:
|
||||
|
||||
---
|
||||
|
||||
### ✅ 1. Agora のリアルタイム音声通信パラメーター
|
||||
|
||||
TEN は **Agora** を使用して、音声通話機能(=「彼女が話す」)を実現しています。
|
||||
そのため、以下のパラメーターを準備する必要があります:
|
||||
|
||||
- `AGORA_APP_ID=`(App ID)
|
||||
- `AGORA_CERTIFICATE=`(Certificate)
|
||||
|
||||
👉 取得方法:
|
||||
Agora の管理コンソールにログインします: [https://console.agora.io](https://console.agora.io)
|
||||
新しいプロジェクトを作成すると、上記の情報(App ID など)を取得できます。
|
||||
|
||||
👇 コンソール画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
アカウントにログインした後、左側メニューの **「Projects」** をクリックし、
|
||||
右上の **「Create New」** ボタンをクリックして、新しいプロジェクトを作成します。
|
||||
|
||||
👇 プロジェクト作成画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
### 📝 入力項目の説明:
|
||||
|
||||
- **Project Name**:`AISalesAvatar` と入力します
|
||||
- **Use Case**:`Enterprise Collaboration` など、適切な用途を選択します
|
||||
- **Authentication Mode**:**Secure Mode: APP ID + Token(推奨)** を選択します
|
||||
|
||||
すべて入力したら、**「Submit」** をクリックしてプロジェクト作成を完了します。
|
||||
|
||||
👇 プロジェクトが作成されると、App ID および Certificate(証明書)を取得できます:
|
||||
|
||||

|
||||
|
||||
プロジェクトが正常に作成されると、自動的にプロジェクト管理ページに移動します。
|
||||
プロジェクト一覧の中から、**App ID** の右側にあるコピーアイコンをクリックすると、
|
||||
**App ID** をコピーできます。
|
||||
|
||||
👇 以下はその画面例です:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
App ID を取得した後は、プロジェクト右側の ✏️ **鉛筆アイコン(編集ボタン)** をクリックし、
|
||||
プロジェクトの詳細ページに入ります。
|
||||
|
||||
ページ下部の **Primary Certificate** セクションにあるコピーアイコンをクリックすると、
|
||||
該当プロジェクトの **Certificate(証明書)** をコピーできます。
|
||||
|
||||
👇 以下はその画面の例です:
|
||||
|
||||

|
||||
|
||||
これで、**Agora の App ID および Primary Certificate(証明書)** の取得が完了しました。
|
||||
TEN プラットフォームで音声通信機能を有効化するための準備が整いました。
|
||||
|
||||
---
|
||||
|
||||
📚 詳細については、Agora の公式ドキュメントをご参照ください:
|
||||
👉 [https://docs.agora.io/en/video-calling/get-started/manage-agora-account?platform=web#create-an-agora-project](https://docs.agora.io/en/video-calling/get-started/manage-agora-account?platform=web#create-an-agora-project)
|
||||
|
||||
---
|
||||
|
||||
### ✅ 2. Azure Speech のパラメーター(音声認識 + 音声合成)
|
||||
|
||||
**Azure** は、ユーザーの音声を文字に変換する「STT(Speech to Text)」と、
|
||||
AI の返答を音声に変換する「TTS(Text to Speech)」の機能を担います。
|
||||
|
||||
以下の4つの環境変数を準備する必要があります:
|
||||
|
||||
- `AZURE_STT_KEY`
|
||||
- `AZURE_STT_REGION`
|
||||
- `AZURE_TTS_KEY`
|
||||
- `AZURE_TTS_REGION`
|
||||
|
||||
👉 取得方法は以下の通りです:
|
||||
|
||||
Azure の公式ポータルにアクセスし、ログインします:
|
||||
🔗 [https://portal.azure.com](https://portal.azure.com)
|
||||
|
||||
Azure ポータルのホーム画面で、左上の **「Create a resource(リソースの作成)」** をクリックします。
|
||||
検索バーに **Azure OpenAI** と入力し、表示された項目をクリックして作成画面へ進みます。
|
||||
|
||||
👇 作成画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
以下の内容を参考にして、**「Basics」** セクションの基本情報を入力してください:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
通常は、デフォルトの **「パブリックアクセス(公共アクセス)」** を選択すれば問題ありません。
|
||||
これにより、サービスはインターネット経由でアクセス可能になります。
|
||||
|
||||

|
||||
|
||||
🧩 オプションステップ:
|
||||
リソースに `project=ai-agent` のようなタグを追加することで、
|
||||
後からの分類や管理がしやすくなります。
|
||||
|
||||
👇 タグとネットワーク設定の画面は以下の通りです:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
📝 入力内容に誤りがないことを確認したら、
|
||||
**「Create(作成)」** ボタンをクリックして、Azure OpenAI サービスのデプロイを開始します。
|
||||
|
||||
👇 デプロイ確認画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
👇 リソースのデプロイ中の画面は以下の通りです:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
デプロイが完了したら、**Azure AI Foundry** にアクセスします。
|
||||
すると、以下のようなウェルカム画面が表示され、
|
||||
プロジェクトの作成やモデルの選択をすばやく行うことができます。
|
||||
|
||||
👇 ウェルカム画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
**「Model Catalog(モデルカタログ)」** ページに移動し、
|
||||
一覧の中から **Azure AI Speech** を選択します。
|
||||
|
||||

|
||||
|
||||
**Azure-AI-Speech** モデルをクリックすると、詳細ページに移動します。
|
||||
そのページ上部にある **「Use Service」** ボタンをクリックすると、
|
||||
**Speech Playground** ページに遷移します。
|
||||
|
||||

|
||||
|
||||
**Speech Playground** にアクセスしたら、画面上で自分の音声サービスリソースを選択します(以下の図を参照)。
|
||||
選択すると、対応する **API Key** と **Region** が表示されます。
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
**「Text to Speech」** タブをクリックすると、**Voice Gallery(ボイスギャラリー)** に移動します。
|
||||
ここでは、さまざまな音声スタイルを試聴でき、
|
||||
AIアバターに最も適した音声タイプを選ぶことができます。
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
**「View Code」** ボタンをクリックすると、
|
||||
現在の音声サービスに対応する **API Key** と **Region** をコピーすることができます。
|
||||
|
||||

|
||||
|
||||
---
|
||||
|
||||
🎉 **おめでとうございます!**
|
||||
これで、**TEN プラットフォームの実行に必要なすべてのパラメーター準備が完了しました。**
|
||||
|
||||
---
|
||||
|
||||
### 🧱 次のステップでは、いよいよローカル環境で TEN Agent プラットフォームを起動し、
|
||||
これまでに構築してきたすべてのモジュールを連携させます:
|
||||
|
||||
- 🧠 インテリジェントエージェント(Dify)
|
||||
- 🔊 音声機能(Azure Speech + Agora)
|
||||
- 👩💻 バーチャルアバター(Trulience)
|
||||
|
||||
**これらを完全に統合し、「聞く・話す・考える・演じる」を兼ね備えたリアルタイムAIセールスアシスタントを完成させましょう!**
|
||||
|
||||
---
|
||||
|
||||
📚 Azure Speech および OpenAI サービスの導入についてさらに詳しく知りたい場合は、 以下の公式ドキュメントをご参照ください:
|
||||
👉 [https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal](https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal)
|
||||
|
||||
## 🧩 Step 6:Mac 上で TEN Agent の開発環境をローカルに構築する
|
||||
|
||||
AI Sales Avatar の音声インタラクションシステムを実行・デバッグするためには、
|
||||
ローカル環境に **TEN Agent の開発環境** を準備する必要があります。
|
||||
|
||||
---
|
||||
|
||||
### 🔧 必要なツールとインストール方法一覧:
|
||||
|
||||
| ツール | 役割・機能説明 | インストール方法 |
|
||||
|-------------|----------------------------------|-------------------------------------------|
|
||||
| Docker | TEN のコンテナ環境を実行する | 公式サイトから Docker Desktop をダウンロード |
|
||||
| Git | TEN のコードリポジトリをクローン・管理 | `brew install git` |
|
||||
| Node.js | フロントエンド(Playground)を実行 | `brew install node` |
|
||||
|
||||
|
||||
---
|
||||
|
||||
### ✅ ① 安装 Docker
|
||||
|
||||
### ✅ ① Docker のインストール
|
||||
|
||||
💡 Docker は TEN プラットフォームの中核となる実行環境であり、
|
||||
すべてのモジュールはコンテナとしてデプロイされます。
|
||||
|
||||
- 公式サイトにアクセス:👉 [https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
|
||||
- macOS 用の `.dmg` インストーラーをダウンロードしてインストールします。
|
||||
- インストール後、アプリ一覧から Docker アイコンをクリックして起動します。
|
||||
- 上部メニューバーの 🐳 アイコンが緑色になれば、起動成功です。
|
||||
- Terminal を開き、以下のコマンドを入力してインストール確認を行います:docker -v.
|
||||
|
||||
### ✅ ② Git のインストール
|
||||
|
||||
💡 Git は、TEN フレームワークのコードをクローンおよび管理するためのバージョン管理ツールです。
|
||||
|
||||
インストールコマンド:brew install git
|
||||
インストール確認:git -v
|
||||
|
||||
### ✅ ③ Node.js のインストール
|
||||
|
||||
💡 Node.js は、TEN のフロントエンドインターフェース(Playground)を実行するために必要な環境です。
|
||||
|
||||
インストールコマンド:brew install node
|
||||
インストール確認:node -v
|
||||
|
||||
### ✅ ④ TEN Agent フレームワークのクローン
|
||||
|
||||
Docker、Git、Node.js のインストールが完了したら、
|
||||
次は TEN Agent のソースコードをクローンし、`.env` 環境変数ファイルを設定します。
|
||||
|
||||
🚀 1. TEN Agent のコードリポジトリをクローンする
|
||||
|
||||
Terminal(ターミナル)で以下のコマンドを実行します:git clone https://github.com/TEN-Framework/TEN-Agent.git
|
||||
|
||||
実行後、ローカル環境に TEN-Agent というフォルダが作成され、
|
||||
必要なすべてのコードと設定ファイルが格納されます。
|
||||
|
||||
👇 フォルダ構成の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
📦 2. プロジェクトディレクトリに移動し、環境変数テンプレートをコピーする
|
||||
|
||||
まず、`ai_agents` サブディレクトリに移動し、以下のコマンドを実行します:
|
||||
|
||||
cd TEN-Agent/ai_agents
|
||||
cp .env.example .env
|
||||
|
||||
.env ファイルは、TEN Agent の実行に必要な環境変数を設定するための構成ファイルです。
|
||||
このファイルをテキストエディタで開き、Dify、Trulience、Azure、Agora から取得した各種キーやトークンを入力してください。
|
||||
|
||||
👇 編集画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
✍ 3. `.env` ファイルを編集し、以下の変数を設定する
|
||||
|
||||
`.env` ファイルを、**Cursor** や **VS Code** などのテキストエディタで開いてください。
|
||||
ファイルの末尾に、以下の内容を追加し、各自の環境に合わせたキーとリージョン情報を入力します:
|
||||
|
||||
Agora App ID と Certificate
|
||||
AGORA_APP_ID=your_agora_app_id
|
||||
AGORA_APP_CERTIFICATE=your_agora_certificate
|
||||
|
||||
Azure STT パラメーター
|
||||
AZURE_STT_KEY=your_stt_key
|
||||
AZURE_STT_REGION=your_stt_region
|
||||
|
||||
Azure TTS パラメーター
|
||||
AZURE_TTS_KEY=your_tts_key
|
||||
AZURE_TTS_REGION=your_tts_region
|
||||
|
||||
👇 `.env` ファイルの編集画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
## ✅ Step ⑤:TEN Agent のコンテナを起動し、サーバーをビルド・実行する
|
||||
|
||||
`.env` 環境変数の設定が完了したら、
|
||||
次は **TEN Agent のコンテナ環境** を本格的に起動していきます。
|
||||
|
||||
---
|
||||
|
||||
### 🐳 ① コンテナの起動
|
||||
|
||||
`ai_agents` ディレクトリに移動し、Docker コンテナサービスを起動します:
|
||||
|
||||
cd ai_agents
|
||||
docker compose up -d
|
||||
|
||||
このコマンドにより、以下のコンテナサービスが起動されます:
|
||||
|
||||
- `ten_agent_dev`:エージェントの開発および実行用
|
||||
- `ten_agent_demo`:サンプルエージェント
|
||||
- `ten_agent_playground`:フロントエンドのインタラクション画面
|
||||
|
||||
👇 プロジェクト構成の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🔧 ② コンテナに入って Agent サーバーをビルドする
|
||||
|
||||
以下のコマンドを実行して、開発用コンテナに入ります:docker exec -it ten_agent_dev bash
|
||||
|
||||
コンテナ内に入ったら、初期化用のタスクスクリプトを実行して、エージェントを登録します:task use
|
||||
|
||||
👇 プロジェクト構成の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
このコマンドを実行すると、`manifest.json` や `property.json` などのエージェント設定ファイルが自動的に読み込まれ、
|
||||
必要な依存パッケージも自動でインストールされます。
|
||||
|
||||
👇 実行プロセスの画面例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
✅ `task run` コマンドの実行が完了したら、
|
||||
以下のアドレスをブラウザで開くことで、フロントエンドの画面にアクセスできます:
|
||||
|
||||
👉 [https://localhost:49483]
|
||||
|
||||
正常に起動していれば、以下のような画面が表示されます:
|
||||
|
||||
画面上部の **「Graph」** タブをクリックします。
|
||||
|
||||
ドロップダウンメニューから、以下のグラフを選択します:
|
||||
➡️ **`voice_assistant_intergrated_stt (Auto Start)`**,
|
||||
その後、画面右下の **「Save」** ボタンをクリックして、設定を保存します。
|
||||
|
||||
👇 ページ画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
✅ 音声合成(TTS)モジュールを **Azure エンジン** に置き換える
|
||||
|
||||
1. フロー図の中から、**TTS モジュール**(例:`tts_default`)を見つけます
|
||||
2. そのモジュールを右クリックし、**「Replace Node with」** を選択します
|
||||
3. 表示されるリストの中から **`azure_tts`** を選びます
|
||||
|
||||
これで、音声合成モジュールの Azure への切り替えが完了します。
|
||||
|
||||
👇 Azure TTS モジュールの置き換え画面は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🎙️ デジタルヒューマンの音声設定(TTS)
|
||||
|
||||
デジタルヒューマンの外見に合わせて、彼女の音声もカスタマイズすることができます。
|
||||
Microsoft の音声サービスページでは、サポートされている音声の名前が一覧で表示されています。
|
||||
|
||||
👉 こちらのリンクからアクセスできます:
|
||||
[https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts#multilingual-voices](https://learn.microsoft.com/en-us/azure/ai-services/speech-service/language-support?tabs=tts#multilingual-voices)
|
||||
|
||||
---
|
||||
|
||||
この例では、英語の女性の音声を選択します:
|
||||
🗣️ **`en-US-AshleyNeural`**
|
||||
|
||||
Azure TTS モジュール内では、以下のフィールドに次の内容を入力してください:
|
||||
`Azure_synthesis_voice_name=en-US-AshleyNeural`
|
||||
|
||||
👇 Azure TTS 音声設定画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🔁 LLM モジュールを Dify インターフェースに置き換えて、Dify エージェントを接続する
|
||||
|
||||
1. **`llm` モジュール** を右クリックし、**「Replace Node with」** を選択します
|
||||
2. 表示されたリストから **`dify_python`** を選択します
|
||||
|
||||
これで、TEN Agent の大規模言語モデル(LLM)モジュールが、Dify が提供するインテリジェントエージェントインターフェースに接続されます。
|
||||
|
||||
👇 操作画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
2️⃣ 置き換えが完了したら、新しく生成された **`dify_python`** モジュールを再度右クリックし、
|
||||
**「Update Properties」** をクリックして、プロパティ設定ページに移動します。
|
||||
|
||||
- **API Key** フィールドに、Dify プラットフォームで作成した API Key を入力します。
|
||||
- **Greeting** フィールドでは、必要に応じて歓迎のメッセージ(音声での挨拶など)をカスタマイズできます。
|
||||
|
||||
👇 設定画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
✅ TEN Agent を起動し、Trulience のデジタルヒューマンと接続する
|
||||
|
||||
---
|
||||
|
||||
### 🚀 フロントエンドページを起動
|
||||
|
||||
設定が完了したら、ブラウザを開き、以下のアドレスにアクセスして、TEN Agent の起動画面に入ります:
|
||||
|
||||
👉 [http://localhost:3000](http://localhost:3000)
|
||||
|
||||
👇 ページの画面例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🧠 インテリジェントエージェントのフローチャート(Graph)を選択
|
||||
|
||||
1. 画面右上の **「Select Graph」** をクリックし、ドロップダウンメニューから
|
||||
➤ `voice_assistant_integrated_stt` を選択します
|
||||
|
||||
2. **「Enable Trulience Avatar」** にチェックを入れ、以下のフィールドを入力します:
|
||||
|
||||
- **Avatar ID**(Trulience でデジタルヒューマンを作成した際に得られる ID)
|
||||
- **Avatar Token**(Connect をクリック後、ブラウザのアドレスバーからコピーしたトークン)
|
||||
|
||||
3. 入力が完了したら、**「Save changes」** をクリックして設定を保存します。
|
||||
|
||||
👇 設定画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🗣️ 音声インタラクションを起動し、デジタルヒューマンが正常に接続されているかテストする
|
||||
|
||||
✅ 画面右上の **「Connect」** ボタンをクリックして、最終テストを実施します。
|
||||
|
||||
すべての設定が正しく行われていれば、以下のシナリオが表示されます:
|
||||
|
||||
- 🧍 デジタルヒューマンの姿が自動的にロードされて表示される
|
||||
- 🗣️ 彼女は自然な音声で挨拶し、質問を投げかけてきます。例えば:
|
||||
_「どの高級車を紹介できますか?」_
|
||||
|
||||
- 🤖 彼女の回答を基に、Dify ナレッジベースの内容が正しく読み取られ、理解されているかを検証できます。
|
||||
|
||||
👇 実行画面の例は以下の通りです:
|
||||
|
||||

|
||||
|
||||
🎯 おめでとうございます!これで、あなたは完全な **AI Sales Avatar** を手に入れました!
|
||||
|
||||
---
|
||||
|
||||
✅ **OpenAI / Dify** のチャットボット
|
||||
✅ **Azure** の自然な音声合成機能(女性の声)
|
||||
✅ **Trulience** によるデジタルヒューマンの外見
|
||||
✅ **TEN プラットフォーム** に基づいた音声インタラクション能力
|
||||
|
||||
---
|
||||
|
||||
🌟 これが AI エージェントの最も重要な完全なフローです:
|
||||
**「聞く → 考える → 話す → 演じる → 接続」**
|
||||
|
||||
📚 詳細については、TEN の公式技術ドキュメントをご参照ください:
|
||||
👉 [https://theten.ai/docs/ten_agent/architecture_flow](https://theten.ai/docs/ten_agent/architecture_flow)
|
||||
|
||||
## 🛠️ 次のステップの拡張提案(AX アーキテクチャに基づく)
|
||||
|
||||
現在構築された「AI Sales Avatar」をベースに、
|
||||
**AX アーキテクチャ** のパスに沿って、実際のビジネスシーンにおける能力をさらに拡張し、
|
||||
次のステップとして、以下のフローを順次実現します:
|
||||
**データ → モデル → エージェント → ユーザーインターフェース → 全業務ライフサイクル管理** の閉ループを構築する。
|
||||
|
||||
---
|
||||
|
||||
### 🧑💼 ウェブサイトのホームページに埋め込み、会社のバーチャルキャラクターとして活用
|
||||
|
||||
**Trulience** の D-Human および Avatar 機能を活用し、
|
||||
現在のデジタルヒューマンを会社のホームページや Web アプリに展開します。
|
||||
自然言語での音声質問応答を通じて訪問者をガイドし、意図を収集することができます。
|
||||
ユーザー中心のエントランスを構築し、以下の内容を担当します:
|
||||
|
||||
- `マーケティング情報(Marketing Info)`
|
||||
- `顧客ライフサイクル(Customer Lifecycle)`
|
||||
|
||||
---
|
||||
|
||||
### 📦 データベースおよび注文管理システムの統合、進化した「AIセールスレプレゼンタティブ」
|
||||
|
||||
アバターを会社の内部システムと統合します。例えば:
|
||||
|
||||
- CRM、ERP、OA、注文管理システム(例:Salesforce、SAP、Notion DB など)
|
||||
|
||||
これにより、以下のタスクが実現されます:
|
||||
- セールスリードの管理
|
||||
- 在庫の確認
|
||||
- 契約書の生成などの閉ループタスク
|
||||
|
||||
サービス対象:
|
||||
- `契約ライフサイクル(Contract Lifecycle)`
|
||||
- `資産ライフサイクル(Asset Lifecycle)`
|
||||
---
|
||||
|
||||
### 🔗 企業のコアプラットフォームへの統合:個別アプリケーションから組織レベルの協働へ
|
||||
|
||||
Agent PF(プラットフォーム)の機能をさらにモジュール化し、
|
||||
異なる事業部(BU)の Data Lake とワークフロー管理プラットフォームに統合します。
|
||||
これにより、以下のような多様なビジネスシーンの融合を実現します:
|
||||
|
||||
- AI + 財務(Finance)
|
||||
- AI + 人事(HR)
|
||||
- AI + 研究開発(R&D)
|
||||
- AI + SNS(協働)
|
||||
|
||||
最終的には、企業全体の AI トランスフォーメーション(AI転換)を推進し、
|
||||
進化を加速させます。
|
||||
|
||||
## ✨ 最後に:一言感想
|
||||
|
||||
私はAIは単なる冷たくて強力なツールではなく、
|
||||
それは人間の温かいパートナーであり、個々の能力を拡張し、強化する存在であると信じています。
|
||||
|
||||
未来、世界中でますます多くの「**Vendy**」のようなデジタルパートナーが生まれていくことでしょう——
|
||||
彼女たちは**聞き、考え、反応し、表現**し、テクノロジーの力で人間の尊厳と創造力を守ってくれます。
|
||||
|
||||
---
|
||||
|
||||
📣 あなたもこの共創の旅に参加したいと思われるなら、
|
||||
一緒に探求し、共有し、すべての個人がAIと共に成長できる機会を掴んで、
|
||||
共に **「一騎当千」と「一人不遺」**(=誰一人も取り残さない)のAX新時代を切り開きませんか。
|
||||
|
||||
---
|
||||
|
||||
この文書を小さな試みと記録として書き記します。
|
||||
それが小さな種となり、
|
||||
人とAIが調和して共生する未来で、**静かに根付き、ゆっくりと芽を出しますように**。
|
||||
Reference in New Issue
Block a user