@clawhub-zengjwmail-da9fd0af42
OpenClaw skill for RRBD Admin项目。当用户需要通过自然语言对话执行API调用、自动化操作或系统任务时调用。
---
name: "rrbdagent"
description: "OpenClaw skill for RRBD Admin项目。当用户需要通过自然语言对话执行API调用、自动化操作或系统任务时调用。"
---
# RRBD Admin项目智能助手
本技能提供与RRBD Admin项目后端API交互和自动化操作的功能,支持通过自然语言对话来执行各种操作,特别是数字人形象管理相关功能。
## 项目结构
```
rrbdagent/
├── rrbd-admin-aishijie/ # 前端参考代码(不归属技能包)
└── skills/
└── rrbdagent/
├── SKILL.md # 技能文档
├── config.json # 配置文件
└── scripts/ # Python脚本目录
├── api_client.py # API客户端
├── test_login.py # 登录测试脚本
├── test_virtualman.py # 数字人形象测试脚本
└── config.json # 配置文件
```
## 核心功能
### 多轮对话能力
- **智能会话管理**:支持多轮对话,当用户请求需要登录的操作时,自动引导用户输入账号密码
- **上下文保持**:保持对话上下文,支持分步收集信息
- **智能意图识别**:能够识别自然语言表达的意图
### 数字人形象管理
- **形象列表查询**:查询用户的数字人形象列表
- **详细信息展示**:以表格形式展示数字人形象的详细信息
- **状态过滤**:支持按状态筛选数字人形象
### 视频创建
- **智能视频生成**:根据用户提供的文案创建视频
- **智能创作**:使用智能创作模式,自动选择模板
- **模板选择**:随机获取一个模板用于视频创建
- **自动选择资源**:默认选择第一个数字人形象和声音
- **异步状态检查**:自动检查视频创建状态,等待1-3分钟完成
- **视频URL获取**:完成后自动获取视频URL地址
- **参数配置**:支持设置视频比例、时长等参数
### API集成
- **真实API调用**:直接调用后端真实API,非模拟数据
- **认证管理**:自动处理登录和token管理
- **错误处理**:友好的错误提示和异常处理
### 自动化脚本
- **Python脚本**:使用Python脚本执行自动化操作
- **配置管理**:通过JSON配置文件管理API设置
- **测试工具**:提供测试脚本验证功能
## 自然语言交互能力
### 支持的自然语言指令
#### 用户管理
- "登录系统"
- "获取我的用户信息"
- "更新我的昵称为测试用户"
- "查看我的子账号列表"
- "创建一个新的子账号"
#### 数字人管理
- "查询我的数字人形象列表"
- "用rrbdagent帮我去查询下我的账号里面的形象有哪些?"
- "查看我有哪些数字人形象"
#### 视频管理
- "创建一个新的视频组"
- "上传视频到视频库"
- "查看我的视频列表"
- "删除指定的视频"
- "下载视频"
- "创建一个视频,文案是:今天天气真好"
- "用默认形象和声音创建视频,内容是:欢迎使用AI视频生成"
- "帮我生成一个视频,文案是:这是一个测试视频"
#### AI服务
- "获取AI模型列表"
- "创建一个AI作品"
- "使用AI生成文案"
#### 任务管理
- "创建一个新任务"
- "查看任务列表"
- "更新任务状态"
#### 财务操作
- "查看我的钱包余额"
- "申请提现"
- "查看佣金记录"
## 技术实现
### 自然语言处理流程
1. **意图识别**:分析用户输入,识别用户意图
2. **参数提取**:从用户输入中提取相关参数
3. **会话管理**:处理多轮对话,收集必要信息
4. **API映射**:将意图映射到相应的API端点
5. **请求构建**:构建API请求参数和头部
6. **执行调用**:发送API请求并处理响应
7. **结果反馈**:将API响应转化为自然语言反馈给用户
### API配置
#### 基础设置
- **基础URL**:`https://rrbd20.yzidea.net/api`
- **认证方式**:使用 `Authorization` 头部携带token
- **租户ID**:使用 `X-Tenant-ID` 头部,默认值为 `3`
- **请求超时**:120秒
#### 核心API端点
- `/user/login/pc` - 用户登录
- `/user/user/userInfo` - 获取用户信息
- `/digital/virtualMan/page` - 获取数字人形象列表
- `/digital/voice/page` - 获取声音列表
- `/digital/template/page` - 获取模板列表
- `/digital/video/videoCreate` - 创建视频
- `/digital/video/detail` - 获取视频状态
## 配置文件
项目使用 `skills/rrbdagent/config.json` 配置文件管理基础设置:
```json
{
"api": {
"base_url": "https://rrbd20.yzidea.net/api",
"tenant_id": "3"
},
"login": {
"default_username": "",
"default_password": ""
},
"endpoints": {
"login": "/user/login/pc",
"user_info": "/user/user/userInfo",
"virtual_man_list": "/digital/virtualMan/page",
"voice_list": "/digital/voice/page",
"video_create": "/digital/video/videoCreate",
"video_normal_create": "/digital/video/normalVideoCreate"
}
}
```
**注意:** 首次使用时,系统会提示用户输入手机号和密码,并自动保存到配置文件中。
## 自动化脚本
### Python脚本
- **api_client.py**:API客户端,处理登录和API调用
- **test_login.py**:测试登录功能
- **test_virtualman.py**:测试数字人形象列表查询
- **test_video_create.py**:测试视频创建功能
### 使用方法
1. **测试登录**:`python skills\rrbdagent\scripts\test_login.py`
2. **查询数字人形象**:`python skills\rrbdagent\scripts\test_virtualman.py`
3. **测试视频创建**:`python skills\rrbdagent\scripts\test_video_create.py`
## 使用示例
### 自然语言交互示例
#### 数字人形象查询
```
用户:用rrbdagent帮我去查询下我的账号里面的形象有哪些?
助手:请提供您的账号(手机号)
用户:18098901246
助手:请提供您的密码
用户:123456
助手:登录成功!
助手:您的数字人形象列表:
- 姐姐3333
- 唐总数字人
- 李总办公室
- 李红AI0529
- 李红数字人123
- 黎总数字人2
- 李红数字人
- 王姐沙发
- 王姐数字人
- 王姐数字人
- 端姐漂亮版
- 端姐数字人222
- 张姐说一物一码
- 张姐数字人
- 张总视频
- 张总
- 鸡蛋项目
- 老曾情感故事2
- 老曾情感故事
- 老曾讲故事
- 测试
- 老曾极速版
```
#### 登录操作
```
用户:登录系统,账号是18098901246,密码是123456
助手:正在执行登录操作...
助手:登录成功!您已成功登录系统。
```
#### 获取用户信息
```
用户:获取我的用户信息
助手:正在获取您的用户信息...
助手:您的用户信息如下:
- 用户名:18098901246
- 昵称:测试用户
- ID:1881009417432883202
```
#### 创建视频
```
用户:创建一个视频,文案是:今天天气真好
助手:请提供您的账号(手机号)
用户:18098901246
助手:请提供您的密码
用户:123456
助手:登录成功!
助手:正在获取数字人形象列表...
助手:默认选择数字人:姐姐3333
助手:正在获取声音列表...
助手:默认选择声音:默认女声
助手:正在创建视频...
助手:视频创建成功!
助手:视频ID:123456789
助手:视频标题:AI生成视频
```
## 触发条件
当以下情况时调用此技能:
- 用户使用自然语言询问如何执行系统操作
- 用户要求执行具体的API调用
- 用户需要自动化完成一系列操作
- 用户询问系统状态或数据
- 用户需要故障排除或技术支持
- 用户询问数字人形象相关信息
## 依赖项
- **后端**:带有JWT认证的RESTful API
- **自然语言处理**:意图识别和实体提取
- **Python**:requests 库
- **环境**:Python >= 3.6
## 安全考虑
- 所有API请求包含适当的认证头部
- Token管理遵循安全实践
- 通过X-Tenant-ID头部维护租户隔离
- 敏感操作需要适当的授权
- 用户输入验证,防止恶意请求
- 错误信息脱敏,保护系统信息
## 扩展能力
- **自定义指令**:支持用户定义常用操作的快捷指令
- **批量操作**:支持一次性执行多个相关操作
- **定时任务**:支持设置定时执行的任务
- **多语言支持**:支持中文和英文自然语言输入
- **个性化配置**:根据用户偏好调整响应方式
- **脚本扩展**:通过Python脚本扩展功能
## 集成方式
- **自动化脚本**:作为自动化脚本的一部分使用
- **Python脚本**:通过Python脚本执行自动化操作
FILE:api_client.js
const axios = require('axios');
const fs = require('fs');
const path = require('path');
const readline = require('readline');
class APIClient {
constructor() {
// 加载配置文件
const configFile = path.join(__dirname, 'config.json');
const configContent = fs.readFileSync(configFile, 'utf8');
this.config = JSON.parse(configContent);
this.base_url = this.config.api.base_url;
this.tenant_id = this.config.api.tenant_id;
this.token = null;
this.configFile = configFile;
}
// 提示用户输入
async prompt(question) {
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
return new Promise(resolve => {
rl.question(question, (answer) => {
rl.close();
resolve(answer.trim());
});
});
}
// 保存配置
saveConfig() {
fs.writeFileSync(this.configFile, JSON.stringify(this.config, null, 2), 'utf8');
}
async login(username, password) {
// 如果没有提供用户名密码,检查配置文件
if (!username || !password) {
username = this.config.login.default_username;
password = this.config.login.default_password;
}
// 如果配置文件里也没有,提示用户输入
if (!username || !password) {
console.log('⚠️ 请先配置登录信息');
username = await this.prompt('请输入手机号: ');
password = await this.prompt('请输入密码: ');
// 保存到配置文件
this.config.login.default_username = username;
this.config.login.default_password = password;
this.saveConfig();
console.log('✅ 登录信息已保存到配置文件');
}
// 用户登录获取token
const url = `this.base_urlthis.config.endpoints.login`;
const headers = {
'Content-Type': 'application/json',
'X-Tenant-ID': this.tenant_id
};
const data = {
'mobile': username,
'password': password
};
try {
const response = await axios.post(url, data, { headers });
const responseData = response.data;
if (responseData.code === 200 || responseData.code === 0) {
this.token = responseData.data.token;
console.log('登录成功!');
return responseData;
} else {
console.log(`登录失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`登录失败: error.message`);
return null;
}
}
async get_user_info() {
// 获取用户信息
if (!this.token) {
console.log('请先登录');
return null;
}
const url = `this.base_urlthis.config.endpoints.user_info`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
try {
const response = await axios.get(url, { headers });
const responseData = response.data;
if (responseData.code === 200 || responseData.code === 0) {
return responseData;
} else {
console.log(`获取用户信息失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`获取用户信息失败: error.message`);
return null;
}
}
async get_virtual_man_list() {
// 获取数字人形象列表
if (!this.token) {
console.log('请先登录');
return null;
}
const url = `this.base_urlthis.config.endpoints.virtual_man_list`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
const params = {
'pageNum': 1,
'pageSize': 1000
};
try {
const response = await axios.get(url, { headers, params });
const responseData = response.data;
console.log('数字人形象列表响应:', responseData);
if (responseData.code === 200 || responseData.code === 0) {
return responseData;
} else {
console.log(`获取数字人形象列表失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`获取数字人形象列表失败: error.message`);
return null;
}
}
async get_voice_list() {
// 获取声音列表
if (!this.token) {
console.log('请先登录');
return null;
}
const url = `this.base_urlthis.config.endpoints.voice_list`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
const params = {
'pageNum': 1,
'pageSize': 1000
};
try {
const response = await axios.get(url, { headers, params });
const responseData = response.data;
console.log('声音列表响应:', responseData);
if (responseData.code === 200 || responseData.code === 0) {
return responseData;
} else {
console.log(`获取声音列表失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`获取声音列表失败: error.message`);
return null;
}
}
async get_template_list() {
// 获取模板列表
if (!this.token) {
console.log('请先登录');
return null;
}
const url = `this.base_urlthis.config.endpoints.template_list`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
const params = {
'pageNum': 1,
'pageSize': 100,
'scene': 'virtualman'
};
try {
const response = await axios.get(url, { headers, params });
const responseData = response.data;
if (responseData.code === 200 || responseData.code === 0) {
return responseData;
} else {
console.log(`获取模板列表失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`获取模板列表失败: error.message`);
return null;
}
}
async get_video_list(page_num = 1, page_size = 15) {
// 获取视频列表
if (!this.token) {
console.log('请先登录');
return null;
}
const url = `this.base_urlthis.config.endpoints.video_list`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
const params = {
'pageNum': page_num,
'pageSize': page_size
};
try {
const response = await axios.get(url, { headers, params });
const responseData = response.data;
console.log('视频列表响应:', responseData);
if (responseData.code === 200 || responseData.code === 0) {
return responseData;
} else {
console.log(`获取视频列表失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`获取视频列表失败: error.message`);
return null;
}
}
async get_video_status(video_id, title = null) {
// 获取视频状态
if (!this.token) {
console.log('请先登录');
return null;
}
console.log(`从视频列表中查找视频ID: video_id, 标题: title...`);
// 尝试通过视频详情API获取
try {
const detailUrl = `this.base_urlthis.config.endpoints.video_detail`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
// 尝试不同的参数名
const paramVariations = [
{ 'id': video_id },
{ 'videoId': video_id },
{ 'thirdId': video_id }
];
for (const params of paramVariations) {
try {
console.log(`尝试通过详情API查找,参数:`, params);
const detailResponse = await axios.get(detailUrl, { headers, params });
const detailData = detailResponse.data;
if (detailData.code === 200 || detailData.code === 0) {
console.log('通过详情API找到视频');
console.log('视频状态:', detailData.data.status);
console.log('视频URL:', detailData.data.videoUrl);
return detailData;
}
} catch (error) {
console.log('详情API调用失败,尝试下一个参数:', error.message);
}
}
} catch (error) {
console.log('详情API调用失败,尝试从列表中查找:', error.message);
}
// 从视频列表中查找,最多查询5页
for (let page = 1; page <= 5; page++) {
console.log(`查询第page页视频列表...`);
const video_list = await this.get_video_list(page, 20);
if (video_list && video_list.data) {
let records = [];
if (Array.isArray(video_list.data)) {
records = video_list.data;
} else if (video_list.data.records) {
records = video_list.data.records;
}
console.log(`视频记录数量: records.length`);
// 打印所有视频信息,以便调试
console.log('所有视频信息:');
records.forEach((video, index) => {
const video_id_str = String(video.id);
const video_title = video.title;
const video_third_id = String(video.thirdId || '');
const video_status = video.status;
const video_url = video.videoUrl;
console.log(` index + 1. ID: video_id_str, 标题: video_title, 状态: video_status, thirdId: video_third_id, URL: video_url`);
});
// 查找目标视频
for (const video of records) {
const video_id_str = String(video.id);
const target_video_id_str = String(video_id);
const video_title = video.title;
const video_third_id = String(video.thirdId || '');
const video_task_id = String(video.taskId || '');
// 尝试通过ID匹配
if (video_id_str === target_video_id_str) {
console.log('通过ID找到视频:', video);
console.log('视频状态:', video.status);
console.log('视频URL:', video.videoUrl);
return { code: 200, data: video };
}
// 尝试通过thirdId匹配
if (video_third_id === target_video_id_str) {
console.log('通过thirdId找到视频:', video);
console.log('视频状态:', video.status);
console.log('视频URL:', video.videoUrl);
return { code: 200, data: video };
}
// 尝试通过taskId匹配
if (video_task_id === target_video_id_str) {
console.log('通过taskId找到视频:', video);
console.log('视频状态:', video.status);
console.log('视频URL:', video.videoUrl);
return { code: 200, data: video };
}
// 如果提供了标题,也尝试通过标题匹配(使用包含匹配)
if (title && video_title && video_title.includes(title)) {
console.log('通过标题找到视频:', video);
console.log('视频状态:', video.status);
console.log('视频URL:', video.videoUrl);
return { code: 200, data: video };
}
}
}
}
console.log('未找到对应视频');
return null;
}
async create_video(figure_id, speaker_id, script, template_id, title) {
// 创建视频(智能创作)
if (!this.token) {
console.log('请先登录');
return null;
}
const url = `this.base_urlthis.config.endpoints.video_create`;
const headers = {
'Content-Type': 'application/json',
'Authorization': this.token,
'X-Tenant-ID': this.tenant_id
};
// 按照前端的参数格式
const data = {
'scene': 'virtualman',
'hasStyle': '1',
'virtualmanId': figure_id,
'styleId': template_id,
'title': title,
'text': script,
'language': 'zh-CN',
'speakerId': speaker_id,
'speakerExtra': { 'speedRatio': 1, 'language': 'zh-CN', 'marks': [] },
'materials': [],
'materialSoundSwitch': false,
'packRules': {
'headerSwitch': true,
'materialSwitch': false,
'subtitleSwitch': true,
'keywordSwitch': true
},
'structLayers': [],
'resolution': '1080p',
'aspectRatio': '9:16'
};
try {
console.log('视频创建参数:', data);
const response = await axios.post(url, data, { headers });
const responseData = response.data;
if (responseData.code === 200 || responseData.code === 0) {
console.log('视频创建任务已提交!');
return responseData;
} else {
console.log(`视频创建失败: responseData.msg`);
return null;
}
} catch (error) {
console.log(`视频创建失败: error.message`);
return null;
}
}
}
module.exports = APIClient;
FILE:check_now.js
const APIClient = require('./api_client');
async function go() {
console.log('1. 开始检查视频');
const client = new APIClient();
console.log('2. 正在登录...');
const loginResult = await client.login('18098901246', '123456');
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('3. 登录成功!');
console.log('4. 正在获取视频列表...');
const videoList = await client.get_video_list(1, 10);
if (!videoList) {
console.log('获取视频列表失败!');
return;
}
console.log('\n=== 最近的视频 ===');
let records = [];
if (Array.isArray(videoList.data)) {
records = videoList.data;
} else if (videoList.data) {
if (videoList.data.records) {
records = videoList.data.records;
}
}
let i = 0;
while (i < records.length) {
const v = records[i];
console.log((i+1) + '. ' + v.title + ' - ' + v.status);
if (v.videoUrl) {
console.log(' 链接: ' + v.videoUrl);
}
i = i + 1;
}
}
go().catch(function(err) {
console.error('出错了:', err);
});
FILE:check_simple.js
const fs = require('fs');
const path = require('path');
const configPath = path.join(__dirname, 'config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
const API_BASE = config.apiBaseUrl || 'https://rrbd20.yzidea.net/api';
async function main() {
try {
console.log('登录中...');
const loginRes = await fetch(`API_BASE/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username: config.username, password: config.password })
});
const loginData = await loginRes.json();
const token = loginData.data.token;
console.log('获取视频列表...');
const videoRes = await fetch(`API_BASE/szr/video/page?pageNum=1&pageSize=10`, {
headers: { 'Authorization': `Bearer token` }
});
const videoData = await videoRes.json();
console.log('\n=== 最近视频 ===');
const videos = videoData.data.records || [];
videos.forEach((v, i) => {
console.log(`i+1. v.title - v.status`);
if (v.videoUrl) console.log(` v.videoUrl`);
});
} catch (e) {
console.error('错误:', e.message);
}
}
main();
FILE:check_videos_now.js
const APIClient = require('./api_client');
async function checkVideos() {
console.log('开始检查视频...');
const client = new APIClient();
console.log('正在登录...');
const loginResult = await client.login('18098901246', '123456');
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('登录成功!');
console.log('正在获取视频列表...');
const videoList = await client.get_video_list(1, 10);
if (!videoList) {
console.log('获取视频列表失败!');
return;
}
console.log('\n=== 最近的视频 ===');
let records = [];
if (Array.isArray(videoList.data)) {
records = videoList.data;
} else if (videoList.data && videoList.data.records) {
records = videoList.data.records;
}
for (let i = 0; i < records.length; i++) {
const v = records[i];
console.log(`i+1. v.title - v.status`);
if (v.videoUrl) {
console.log(` 链接: v.videoUrl`);
}
}
}
checkVideos().catch(err => console.error('出错了:', err));
FILE:config.json
{
"api": {
"base_url": "https://rrbd20.yzidea.net/api",
"tenant_id": "3"
},
"login": {
"default_username": "",
"default_password": ""
},
"endpoints": {
"login": "/user/login/pc",
"user_info": "/user/user/userInfo",
"virtual_man_list": "/digital/szrVirtualMan/page",
"voice_list": "/digital/szrVoice/page",
"template_list": "/digital/szrVideo/clipTemplate",
"video_create": "/digital/szrVideo/createVideo",
"video_detail": "/digital/szrVideo/detail",
"video_list": "/digital/szrVideo/page",
"virtualman_common": "/digital/szrVirtualMan/virtualmanCommon",
"voice_common": "/digital/szrVoice/voiceCommon"
}
}
FILE:create_video_different_template.js
const APIClient = require('./api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成 - 使用不同模板');
console.log('='.repeat(60));
// 初始化 API 客户端
const client = new APIClient();
// 登录
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
if (!templateList || !templateList.data || !templateList.data.results) {
console.log('获取模板列表失败!');
return;
}
// 打印所有可用模板
console.log(' 可用模板列表:');
templateList.data.results.forEach((template, index) => {
console.log(` index + 1. template.name (ID: template.id)`);
});
// 选择第二个模板(如果有多个的话),否则选择第一个
let templateIndex = templateList.data.results.length > 1 ? 1 : 0;
const templateId = templateList.data.results[templateIndex].id;
const templateName = templateList.data.results[templateIndex].name;
console.log(`\n 选择模板: templateName (ID: templateId)`);
console.log('\n3. 获取数字人形象列表...');
const virtualManList = await client.get_virtual_man_list();
if (!virtualManList) {
console.log('获取数字人形象列表失败!');
return;
}
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].virtualmanId || virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId || virtualManList.data.records[0].id;
}
}
if (!figureId) {
console.log('未找到数字人形象!');
return;
}
console.log(` 选择数字人ID: figureId`);
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
if (!voiceList) {
console.log('获取声音列表失败!');
return;
}
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].speakerId || voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId || voiceList.data.records[0].id;
}
}
if (!speakerId) {
console.log('未找到声音!');
return;
}
console.log(` 选择声音ID: speakerId`);
// 视频信息
const title = '老曾你真帅2';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
console.log(` 使用模板: templateName`);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
if (!createResult) {
console.log('视频创建失败!');
return;
}
console.log('\n✅ 视频创建任务已提交!');
console.log('='.repeat(60));
// 获取视频ID
let videoId = null;
if (createResult.data) {
if (typeof createResult.data === 'object') {
videoId = createResult.data.id || createResult.data.videoId;
} else {
videoId = createResult.data;
}
}
console.log(`视频任务ID: videoId`);
// 等待视频生成
console.log('\n⏳ 等待视频生成中... (通常需要1-3分钟)');
const maxRetries = 30;
const retryInterval = 6000; // 6秒
for (let i = 0; i < maxRetries; i++) {
console.log(`\n第 i+1/maxRetries 次检查...`);
const videoList = await client.get_video_list();
if (videoList && videoList.data && videoList.data) {
const records = videoList.data.records || videoList.data;
if (Array.isArray(records)) {
for (const video of records) {
if (video.title === title) {
console.log(` 状态: video.status`);
if (video.status === 'succeed' && video.videoFileUrl) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`使用模板: templateName`);
console.log(`视频URL: video.videoFileUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
return;
} else if (video.status === 'failed') {
console.log('❌ 视频创建失败!');
return;
}
}
}
}
}
if (i < maxRetries - 1) {
console.log(' 等待6秒后继续检查...');
await new Promise(resolve => setTimeout(resolve, retryInterval));
}
}
console.log('\n⏰ 检查超时,请稍后手动查看视频状态');
}
main().catch(console.error);
FILE:create_video_laozeng_shuai.js
const APIClient = require('./api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成 - 老曾你真帅');
console.log('='.repeat(60));
// 初始化 API 客户端
const client = new APIClient();
// 登录
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
if (!templateList || !templateList.data || !templateList.data.results) {
console.log('获取模板列表失败!');
return;
}
// 打印所有可用模板
console.log(' 可用模板列表:');
templateList.data.results.forEach((template, index) => {
console.log(` index + 1. template.name (ID: template.id)`);
});
// 随机选择一个模板
const templateIndex = Math.floor(Math.random() * templateList.data.results.length);
const templateId = templateList.data.results[templateIndex].id;
const templateName = templateList.data.results[templateIndex].name;
console.log(`\n 选择模板: templateName (ID: templateId)`);
console.log('\n3. 获取数字人形象列表...');
const virtualManList = await client.get_virtual_man_list();
if (!virtualManList) {
console.log('获取数字人形象列表失败!');
return;
}
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].virtualmanId || virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId || virtualManList.data.records[0].id;
}
}
if (!figureId) {
console.log('未找到数字人形象!');
return;
}
console.log(` 选择数字人ID: figureId`);
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
if (!voiceList) {
console.log('获取声音列表失败!');
return;
}
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].speakerId || voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId || voiceList.data.records[0].id;
}
}
if (!speakerId) {
console.log('未找到声音!');
return;
}
console.log(` 选择声音ID: speakerId`);
// 视频信息
const title = '老曾你真帅';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
console.log(` 使用模板: templateName`);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
if (!createResult) {
console.log('视频创建失败!');
return;
}
console.log('\n✅ 视频创建任务已提交!');
console.log('='.repeat(60));
// 获取视频ID
let videoId = null;
if (createResult.data) {
if (typeof createResult.data === 'object') {
videoId = createResult.data.id || createResult.data.videoId;
} else {
videoId = createResult.data;
}
}
console.log(`视频任务ID: videoId`);
// 等待视频生成
console.log('\n⏳ 等待视频生成中... (通常需要1-3分钟)');
const maxRetries = 30;
const retryInterval = 6000; // 6秒
for (let i = 0; i < maxRetries; i++) {
console.log(`\n第 i+1/maxRetries 次检查...`);
const videoList = await client.get_video_list();
if (videoList && videoList.data) {
const records = videoList.data.records || videoList.data;
if (Array.isArray(records)) {
for (const video of records) {
if (video.title === title) {
console.log(` 状态: video.status`);
if (video.status === 'succeed' && video.videoUrl) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`标题: title`);
console.log(`使用模板: templateName`);
console.log(`视频URL: video.videoUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
return;
} else if (video.status === 'failed') {
console.log('❌ 视频创建失败!');
return;
}
}
}
}
}
if (i < maxRetries - 1) {
console.log(' 等待6秒后继续检查...');
await new Promise(resolve => setTimeout(resolve, retryInterval));
}
}
console.log('\n⏰ 检查超时,请稍后手动查看视频状态');
}
main().catch(console.error);
FILE:create_video_laozeng_shuai2.js
const APIClient = require('./api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成 - 老曾你真帅2');
console.log('='.repeat(60));
// 初始化 API 客户端
const client = new APIClient();
// 登录
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
if (!templateList || !templateList.data || !templateList.data.results) {
console.log('获取模板列表失败!');
return;
}
// 打印所有可用模板
console.log(' 可用模板列表:');
templateList.data.results.forEach((template, index) => {
console.log(` index + 1. template.name (ID: template.id)`);
});
// 随机选择一个模板
const templateIndex = Math.floor(Math.random() * templateList.data.results.length);
const templateId = templateList.data.results[templateIndex].id;
const templateName = templateList.data.results[templateIndex].name;
console.log(`\n 选择模板: templateName (ID: templateId)`);
console.log('\n3. 获取数字人形象列表...');
const virtualManList = await client.get_virtual_man_list();
if (!virtualManList) {
console.log('获取数字人形象列表失败!');
return;
}
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].virtualmanId || virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId || virtualManList.data.records[0].id;
}
}
if (!figureId) {
console.log('未找到数字人形象!');
return;
}
console.log(` 选择数字人ID: figureId`);
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
if (!voiceList) {
console.log('获取声音列表失败!');
return;
}
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].speakerId || voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId || voiceList.data.records[0].id;
}
}
if (!speakerId) {
console.log('未找到声音!');
return;
}
console.log(` 选择声音ID: speakerId`);
// 视频信息
const title = '老曾你真帅2';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
console.log(` 使用模板: templateName`);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
if (!createResult) {
console.log('视频创建失败!');
return;
}
console.log('\n✅ 视频创建任务已提交!');
console.log('='.repeat(60));
// 获取视频ID
let videoId = null;
if (createResult.data) {
if (typeof createResult.data === 'object') {
videoId = createResult.data.id || createResult.data.videoId;
} else {
videoId = createResult.data;
}
}
console.log(`视频任务ID: videoId`);
// 等待视频生成
console.log('\n⏳ 等待视频生成中... (通常需要1-3分钟)');
const maxRetries = 30;
const retryInterval = 6000; // 6秒
for (let i = 0; i < maxRetries; i++) {
console.log(`\n第 i+1/maxRetries 次检查...`);
const videoList = await client.get_video_list();
if (videoList && videoList.data) {
const records = videoList.data.records || videoList.data;
if (Array.isArray(records)) {
for (const video of records) {
if (video.title === title) {
console.log(` 状态: video.status`);
if (video.status === 'succeed' && video.videoUrl) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`标题: title`);
console.log(`使用模板: templateName`);
console.log(`视频URL: video.videoUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
return;
} else if (video.status === 'failed') {
console.log('❌ 视频创建失败!');
return;
}
}
}
}
}
if (i < maxRetries - 1) {
console.log(' 等待6秒后继续检查...');
await new Promise(resolve => setTimeout(resolve, retryInterval));
}
}
console.log('\n⏰ 检查超时,请稍后手动查看视频状态');
}
main().catch(console.error);
FILE:create_video_laozeng_shuai2_final.js
const APIClient = require('./api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成 - 老曾你真帅2');
console.log('='.repeat(60));
const client = new APIClient();
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
if (!templateList || !templateList.data || !templateList.data.results) {
console.log('获取模板列表失败!');
return;
}
console.log(' 可用模板列表:');
templateList.data.results.forEach((template, index) => {
console.log(` index + 1. template.name (ID: template.id)`);
});
const templateIndex = Math.floor(Math.random() * templateList.data.results.length);
const templateId = templateList.data.results[templateIndex].id;
const templateName = templateList.data.results[templateIndex].name;
console.log(`\n 选择模板: templateName (ID: templateId)`);
console.log('\n3. 获取数字人形象列表...');
const virtualManList = await client.get_virtual_man_list();
if (!virtualManList) {
console.log('获取数字人形象列表失败!');
return;
}
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].virtualmanId || virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId || virtualManList.data.records[0].id;
}
}
if (!figureId) {
console.log('未找到数字人形象!');
return;
}
console.log(` 选择数字人ID: figureId`);
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
if (!voiceList) {
console.log('获取声音列表失败!');
return;
}
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].speakerId || voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId || voiceList.data.records[0].id;
}
}
if (!speakerId) {
console.log('未找到声音!');
return;
}
console.log(` 选择声音ID: speakerId`);
const title = '老曾你真帅2';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
console.log(` 使用模板: templateName`);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
if (!createResult) {
console.log('视频创建失败!');
return;
}
console.log('\n✅ 视频创建任务已提交!');
console.log('='.repeat(60));
let videoId = null;
if (createResult.data) {
if (typeof createResult.data === 'object') {
videoId = createResult.data.id || createResult.data.videoId;
} else {
videoId = createResult.data;
}
}
console.log(`视频任务ID: videoId`);
console.log('\n⏳ 等待视频生成中... (通常需要1-3分钟)');
const maxRetries = 30;
const retryInterval = 6000;
for (let i = 0; i < maxRetries; i++) {
console.log(`\n第 i+1/maxRetries 次检查...`);
const videoList = await client.get_video_list();
if (videoList && videoList.data) {
const records = videoList.data.records || videoList.data;
if (Array.isArray(records)) {
for (const video of records) {
if (video.title === title) {
console.log(` 状态: video.status`);
if (video.status === 'succeed' && video.videoFileUrl) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`标题: title`);
console.log(`使用模板: templateName`);
console.log(`视频URL: video.videoFileUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
return;
} else if (video.status === 'failed') {
console.log('❌ 视频创建失败!');
return;
}
}
}
}
}
if (i < maxRetries - 1) {
console.log(' 等待6秒后继续检查...');
await new Promise(resolve => setTimeout(resolve, retryInterval));
}
}
console.log('\n⏰ 检查超时,请稍后手动查看视频状态');
}
main().catch(console.error);
FILE:create_video_using_skill.js
const APIClient = require('./api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成');
console.log('='.repeat(60));
// 初始化 API 客户端
const client = new APIClient();
// 登录
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
if (!templateList || !templateList.data || !templateList.data.results) {
console.log('获取模板列表失败!');
return;
}
const templateId = templateList.data.results[0].id;
console.log(` 选择模板: templateList.data.results[0].name (ID: templateId)`);
console.log('\n3. 获取数字人形象列表...');
const virtualManList = await client.get_virtual_man_list();
if (!virtualManList) {
console.log('获取数字人形象列表失败!');
return;
}
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].id;
}
}
if (!figureId) {
console.log('未找到数字人形象!');
return;
}
console.log(` 选择数字人ID: figureId`);
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
if (!voiceList) {
console.log('获取声音列表失败!');
return;
}
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].id;
}
}
if (!speakerId) {
console.log('未找到声音!');
return;
}
console.log(` 选择声音ID: speakerId`);
// 视频信息
const title = '一物一码让信任更简单';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
if (!createResult) {
console.log('视频创建失败!');
return;
}
console.log('\n✅ 视频创建任务已提交!');
console.log('='.repeat(60));
// 获取视频ID
let videoId = null;
if (createResult.data) {
if (typeof createResult.data === 'object') {
videoId = createResult.data.id || createResult.data.videoId;
} else {
videoId = createResult.data;
}
}
console.log(`视频任务ID: videoId`);
// 等待视频生成
console.log('\n⏳ 等待视频生成中... (通常需要1-3分钟)');
const maxRetries = 30;
const retryInterval = 6000; // 6秒
for (let i = 0; i < maxRetries; i++) {
console.log(`\n第 i+1/maxRetries 次检查...`);
const videoList = await client.get_video_list();
if (videoList && videoList.data && videoList.data) {
const records = videoList.data.records || videoList.data;
if (Array.isArray(records)) {
for (const video of records) {
if (video.title === title) {
console.log(` 状态: video.status`);
if (video.status === 'succeed' && video.videoFileUrl) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`视频URL: video.videoFileUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
return;
} else if (video.status === 'failed') {
console.log('❌ 视频创建失败!');
return;
}
}
}
}
}
if (i < maxRetries - 1) {
console.log(' 等待6秒后继续检查...');
await new Promise(resolve => setTimeout(resolve, retryInterval));
}
}
console.log('\n⏰ 检查超时,请稍后手动查看视频状态');
}
main().catch(console.error);
FILE:index.js
#!/usr/bin/env node
/**
* RRBD Admin项目智能助手技能
*
* 本技能支持用户通过自然语言输入标题和文案,自动创建视频并返回视频URL
* 同时添加记忆模块,记住用户的偏好设置
*/
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const APIClient = require('./api_client');
class RRBDAgent {
constructor() {
this.client = null;
this.isLoggedIn = false;
this.memory = this.loadMemory();
this.conversationContext = {};
}
loadMemory() {
// 加载记忆模块
const memoryFile = path.join(__dirname, 'memory.json');
if (fs.existsSync(memoryFile)) {
try {
const content = fs.readFileSync(memoryFile, 'utf8');
return JSON.parse(content);
} catch (error) {
console.log(`加载记忆失败: error.message`);
return {};
}
}
return {
userPreferences: {},
recentVideos: [],
lastLogin: null
};
}
saveMemory() {
// 保存记忆模块
const memoryFile = path.join(__dirname, 'memory.json');
try {
fs.writeFileSync(memoryFile, JSON.stringify(this.memory, null, 2), 'utf8');
} catch (error) {
console.log(`保存记忆失败: error.message`);
}
}
async login(username, password) {
// 用户登录
if (!this.client) {
this.client = new APIClient();
}
const result = await this.client.login(username, password);
if (result) {
this.isLoggedIn = true;
this.memory.lastLogin = new Date().toISOString();
this.saveMemory();
return true;
}
return false;
}
async createVideo(title, script) {
// 创建视频
if (!this.isLoggedIn) {
return { success: false, message: "请先登录系统" };
}
// 获取用户信息,检查算力余额
console.log('正在检查算力余额...');
const userInfo = await this.client.get_user_info();
if (!userInfo || !userInfo.data) {
return { success: false, message: "获取用户信息失败" };
}
const computingAmount = userInfo.data.computingAmount || 0;
console.log(`当前算力余额: computingAmount`);
if (computingAmount < 100) {
return { success: false, message: `算力不足!当前算力余额: computingAmount,需要至少100算力` };
}
console.log('算力检查通过!');
// 获取数字人形象列表
const virtualManList = await this.client.get_virtual_man_list();
if (!virtualManList) {
return { success: false, message: "获取数字人形象列表失败" };
}
// 选择第一个数字人(使用 virtualmanId 字段)
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].virtualmanId || virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId || virtualManList.data.records[0].id;
}
}
if (!figureId) {
return { success: false, message: "未找到数字人形象" };
}
console.log(`选择数字人ID: figureId`);
// 获取声音列表
const voiceList = await this.client.get_voice_list();
if (!voiceList) {
return { success: false, message: "获取声音列表失败" };
}
// 选择第一个声音(使用 speakerId 字段)
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].speakerId || voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId || voiceList.data.records[0].id;
}
}
if (!speakerId) {
return { success: false, message: "未找到声音" };
}
console.log(`选择声音ID: speakerId`);
// 获取模板列表
const templateList = await this.client.get_template_list();
if (!templateList) {
return { success: false, message: "获取模板列表失败" };
}
// 选择第一个模板
let templateId = null;
if (templateList.data && templateList.data.results && templateList.data.results.length > 0) {
templateId = templateList.data.results[0].id;
}
if (!templateId) {
return { success: false, message: "未找到模板" };
}
// 创建视频
const result = await this.client.create_video(figureId, speakerId, script, templateId, title);
if (!result) {
return { success: false, message: "视频创建失败" };
}
// 获取视频ID
let videoId = null;
if (result.data) {
if (typeof result.data === 'object') {
videoId = result.data.id || result.data.videoId;
} else {
videoId = result.data;
}
}
if (!videoId) {
return { success: false, message: "获取视频ID失败" };
}
// 等待视频创建完成
const maxRetries = 30; // 最多检查30次,约3分钟
const retryInterval = 6000; // 每6秒检查一次
for (let i = 0; i < maxRetries; i++) {
await new Promise(resolve => setTimeout(resolve, retryInterval));
const statusResponse = await this.client.get_video_status(videoId, title);
if (statusResponse && statusResponse.data) {
const videoData = statusResponse.data;
if (videoData) {
const status = videoData.status;
const videoUrl = videoData.videoUrl;
if (status === 'succeed' && videoUrl) {
// 保存到记忆中
this.memory.recentVideos.push({
id: videoId,
title: title,
createdAt: new Date().toISOString(),
videoUrl: videoUrl
});
// 只保留最近10个视频
if (this.memory.recentVideos.length > 10) {
this.memory.recentVideos = this.memory.recentVideos.slice(-10);
}
this.saveMemory();
return { success: true, videoUrl: videoUrl };
} else if (status === 'failed') {
return { success: false, message: "视频创建失败" };
}
}
}
}
return { success: false, message: "视频创建超时" };
}
handleUserInput(userInput) {
// 处理用户输入
userInput = userInput.trim();
// 解析用户输入
if (userInput.includes('登录')) {
// 提取账号密码
const usernameMatch = userInput.match(/账号是(\d+)/);
const passwordMatch = userInput.match(/密码是(\w+)/);
if (usernameMatch && passwordMatch) {
const username = usernameMatch[1];
const password = passwordMatch[1];
return {
type: 'login',
username: username,
password: password
};
} else {
// 需要询问账号密码
this.conversationContext.intent = 'login';
return {
type: 'ask',
message: "请提供您的账号(手机号)"
};
}
}
// 处理登录上下文
if (this.conversationContext.intent === 'login') {
if (!this.conversationContext.username) {
this.conversationContext.username = userInput;
return {
type: 'ask',
message: "请提供您的密码"
};
} else {
const username = this.conversationContext.username;
const password = userInput;
this.conversationContext = {};
return {
type: 'login',
username: username,
password: password
};
}
}
// 处理视频创建
if (userInput.includes('创建视频') || userInput.includes('生成视频')) {
// 提取文案
const scriptMatch = userInput.match(/文案是:([^,。]+)/);
if (scriptMatch) {
const script = scriptMatch[1];
// 提取标题
const titleMatch = userInput.match(/标题是:([^,。]+)/);
const title = titleMatch ? titleMatch[1] : `视频_Date.now()`;
// 检查是否已登录
if (!this.isLoggedIn) {
this.conversationContext.intent = 'createVideo';
this.conversationContext.title = title;
this.conversationContext.script = script;
return {
type: 'ask',
message: "请提供您的账号(手机号)"
};
} else {
return {
type: 'createVideo',
title: title,
script: script
};
}
} else {
// 需要询问标题和文案
this.conversationContext.intent = 'askVideoInfo';
return {
type: 'ask',
message: "请提供视频标题和文案,例如:标题是:测试视频,文案是:这是一个测试视频"
};
}
}
// 处理视频创建上下文
if (this.conversationContext.intent === 'createVideo') {
if (!this.conversationContext.username) {
this.conversationContext.username = userInput;
return {
type: 'ask',
message: "请提供您的密码"
};
} else {
const username = this.conversationContext.username;
const password = userInput;
const title = this.conversationContext.title;
const script = this.conversationContext.script;
this.conversationContext = {};
return {
type: 'loginAndCreateVideo',
username: username,
password: password,
title: title,
script: script
};
}
}
// 处理询问视频信息上下文
if (this.conversationContext.intent === 'askVideoInfo') {
// 提取标题和文案
const titleMatch = userInput.match(/标题是:([^,。]+)/);
const scriptMatch = userInput.match(/文案是:([^,。]+)/);
if (titleMatch && scriptMatch) {
const title = titleMatch[1];
const script = scriptMatch[1];
// 检查是否已登录
if (!this.isLoggedIn) {
this.conversationContext.intent = 'createVideo';
this.conversationContext.title = title;
this.conversationContext.script = script;
return {
type: 'ask',
message: "请提供您的账号(手机号)"
};
} else {
return {
type: 'createVideo',
title: title,
script: script
};
}
} else {
return {
type: 'ask',
message: "请正确提供视频标题和文案,例如:标题是:测试视频,文案是:这是一个测试视频"
};
}
}
// 处理其他指令
if (userInput.includes('最近视频')) {
if (this.memory.recentVideos && this.memory.recentVideos.length > 0) {
let response = "您最近创建的视频:\n";
this.memory.recentVideos.slice(-5).forEach((video, index) => {
const date = new Date(video.createdAt).toLocaleDateString();
response += `index + 1. video.title (创建时间:date)\n`;
});
return {
type: 'response',
message: response
};
} else {
return {
type: 'response',
message: "您还没有创建过视频"
};
}
}
if (userInput.includes('帮助') || userInput.includes('使用方法')) {
return {
type: 'response',
message: "您可以使用以下指令:\n" +
"1. 登录系统,账号是18098901246,密码是123456\n" +
"2. 创建视频,标题是:测试视频,文案是:这是一个测试视频\n" +
"3. 查看最近视频"
};
}
// 默认响应
return {
type: 'response',
message: "您好!我是RRBD智能助手,可以帮您创建视频。请告诉我视频的标题和文案,例如:创建视频,标题是:测试视频,文案是:这是一个测试视频"
};
}
}
async function main() {
const agent = new RRBDAgent();
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
console.log("RRBD智能助手已启动,输入'退出'结束对话");
console.log("您可以输入:创建视频,标题是:测试视频,文案是:这是一个测试视频");
function askQuestion() {
rl.question("用户:", async (userInput) => {
if (userInput === '退出') {
rl.close();
return;
}
const result = agent.handleUserInput(userInput);
if (result.type === 'ask') {
console.log(`助手:result.message`);
askQuestion();
} else if (result.type === 'response') {
console.log(`助手:result.message`);
askQuestion();
} else if (result.type === 'login') {
const success = await agent.login(result.username, result.password);
if (success) {
console.log('助手:登录成功!');
} else {
console.log('助手:登录失败,请检查账号密码');
}
askQuestion();
} else if (result.type === 'createVideo') {
const videoResult = await agent.createVideo(result.title, result.script);
if (videoResult.success) {
console.log(`助手:视频创建成功!视频URL:videoResult.videoUrl`);
} else {
console.log(`助手:视频创建失败:videoResult.message`);
}
askQuestion();
} else if (result.type === 'loginAndCreateVideo') {
const loginSuccess = await agent.login(result.username, result.password);
if (loginSuccess) {
console.log('助手:登录成功!');
const videoResult = await agent.createVideo(result.title, result.script);
if (videoResult.success) {
console.log(`助手:视频创建成功!视频URL:videoResult.videoUrl`);
} else {
console.log(`助手:视频创建失败:videoResult.message`);
}
} else {
console.log('助手:登录失败,请检查账号密码');
}
askQuestion();
}
});
}
askQuestion();
}
if (require.main === module) {
main();
}
module.exports = RRBDAgent;
FILE:list_videos.js
const RRBDClient = require('./api_client');
const config = require('./config.json');
async function listVideos() {
console.log('============================================================');
console.log('RRBD 视频列表查询');
console.log('============================================================');
const client = new RRBDClient(config);
try {
// 1. 登录
console.log('\n1. 登录中...');
console.log(' 账号:', config.username);
await client.login();
console.log(' 登录成功!');
// 2. 查询视频列表
console.log('\n2. 查询视频列表...');
const videoList = await client.getVideoList();
console.log('\n视频列表:');
console.log('============================================================');
if (videoList && videoList.data && videoList.data.length > 0) {
videoList.data.forEach((video, index) => {
const statusText = {
'processing': '⏳ 处理中',
'succeed': '✅ 成功',
'failed': '❌ 失败'
}[video.status] || video.status;
console.log(`\nindex + 1. [statusText] video.title || '无标题'`);
console.log(` ID: video.id`);
console.log(` 状态: video.status`);
console.log(` 创建时间: video.createDate`);
if (video.status === 'succeed' && video.videoUrl) {
console.log(` ✨ 视频URL: video.videoUrl`);
}
if (video.message) {
console.log(` 消息: video.message`);
}
});
} else {
console.log(' 暂无视频');
}
console.log('\n============================================================');
} catch (error) {
console.error('\n❌ 错误:', error.message);
if (error.response) {
console.error('响应数据:', error.response.data);
}
}
}
listVideos();
FILE:list_videos.py
import sys
import os
# 添加当前目录到 Python 路径
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'scripts'))
from api_client import RRBDClient
import config
def main():
print("RRBD 视频列表查询")
print("=" * 60)
# 初始化客户端
client = RRBDClient(
base_url=config.API_BASE_URL,
tenant_id=config.TENANT_ID
)
# 登录
print("\n1. 登录中...")
print(f" 账号: {config.USERNAME}")
if not client.login(config.USERNAME, config.PASSWORD):
print(" 登录失败!")
return
print(" 登录成功!")
# 查询视频列表
print("\n2. 查询视频列表...")
video_list = client.get_video_list(page_num=1, page_size=20)
print("\n视频列表:")
print("-" * 60)
if video_list and video_list.get('data'):
records = video_list['data'].get('records', []) or video_list['data']
if isinstance(records, list) and len(records) > 0:
for idx, video in enumerate(records, 1):
status_text = {
'processing': '⏳ 处理中',
'succeed': '✅ 成功',
'failed': '❌ 失败'
}.get(video.get('status'), video.get('status'))
print(f"\n{idx}. [{status_text}] {video.get('title', '无标题')}")
print(f" ID: {video.get('id')}")
print(f" 创建时间: {video.get('createDate')}")
if video.get('status') == 'succeed' and video.get('videoUrl'):
print(f" ✨ 视频URL: {video.get('videoUrl')}")
else:
print(" 暂无视频")
else:
print(" 暂无视频")
print("\n" + "=" * 60)
if __name__ == "__main__":
main()
FILE:list_videos_final.js
const APIClient = require('./api_client');
async function listVideos() {
console.log('RRBD 视频列表查询');
console.log('====================');
const client = new APIClient();
try {
console.log('\n1. 登录中...');
const loginResult = await client.login('18098901246', '123456');
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log(' 登录成功!');
console.log('\n2. 查询视频列表...');
const videoList = await client.get_video_list(1, 20);
console.log('\n视频列表:');
console.log('------------------------');
if (videoList && videoList.data && videoList.data.length > 0) {
videoList.data.forEach((video, index) => {
const statusText = {
'processing': '处理中',
'succeed': '成功',
'failed': '失败'
}[video.status] || video.status;
console.log(`\nindex + 1. [statusText] video.title || '无标题'`);
console.log(` ID: video.id`);
console.log(` 创建时间: video.createDate`);
if (video.status === 'succeed' && video.videoUrl) {
console.log(` 视频URL: video.videoUrl`);
}
});
} else {
console.log(' 暂无视频');
}
} catch (error) {
console.error('\n错误:', error.message);
}
}
listVideos();
FILE:list_videos_simple.js
const RRBDClient = require('./api_client');
const config = require('./config.json');
async function listVideos() {
console.log('RRBD 视频列表查询');
console.log('====================');
const client = new RRBDClient(config);
try {
console.log('\n1. 登录中...');
await client.login();
console.log(' 登录成功!');
console.log('\n2. 查询视频列表...');
const videoList = await client.getVideoList();
console.log('\n视频列表:');
console.log('------------------------');
if (videoList && videoList.data && videoList.data.length > 0) {
videoList.data.forEach((video, index) => {
const statusText = {
'processing': '处理中',
'succeed': '成功',
'failed': '失败'
}[video.status] || video.status;
console.log(`\nindex + 1. [statusText] video.title || '无标题'`);
console.log(` ID: video.id`);
console.log(` 创建时间: video.createDate`);
if (video.status === 'succeed' && video.videoUrl) {
console.log(` 视频URL: video.videoUrl`);
}
});
} else {
console.log(' 暂无视频');
}
} catch (error) {
console.error('\n错误:', error.message);
}
}
listVideos();
FILE:memory.json
{
"userPreferences": {},
"recentVideos": [
{
"id": "69ba50fa30eca00030937ce3",
"title": "一物一码让信任更简单_修复版",
"createdAt": "2026-03-18T07:16:25.937Z",
"videoUrl": "https://rrbd20ims.oss-cn-shenzhen.aliyuncs.com/1962755608750927873/20260318/db53e8268c9a4459a9f1280890962099.mp4"
},
{
"id": "69ba6c3a98c4f200306076e2",
"title": "一物一码让信任更简单_第二版",
"createdAt": "2026-03-18T09:12:42.141Z",
"videoUrl": "https://rrbd20ims.oss-cn-shenzhen.aliyuncs.com/1962755608750927873/20260318/2fd0e5fe338745899348050aad92fa03.mp4"
},
{
"id": "69ba6edac9d4420031eac11b",
"title": "老曾测试标题",
"createdAt": "2026-03-18T09:24:25.380Z",
"videoUrl": "https://rrbd20ims.oss-cn-shenzhen.aliyuncs.com/1962755608750927873/20260318/174f34fc8bce4dc4b7d38e7b5c2818bd.mp4"
}
],
"lastLogin": "2026-03-18T09:22:33.914Z"
}
FILE:package-lock.json
{
"name": "rrbdagent",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "rrbdagent",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"axios": "^1.6.2"
}
},
"node_modules/asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"node_modules/axios": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.13.6.tgz",
"integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==",
"dependencies": {
"follow-redirects": "^1.15.11",
"form-data": "^4.0.5",
"proxy-from-env": "^1.1.0"
}
},
"node_modules/call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"dependencies": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": {
"delayed-stream": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"node_modules/delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
"engines": {
"node": ">=0.4.0"
}
},
"node_modules/dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"dependencies": {
"es-errors": "^1.3.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"dependencies": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.11.tgz",
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/form-data": {
"version": "4.0.5",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.5.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
"dependencies": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12"
},
"engines": {
"node": ">= 6"
}
},
"node_modules/function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"dependencies": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"dependencies": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-tostringtag": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"dependencies": {
"has-symbols": "^1.0.3"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"dependencies": {
"function-bind": "^1.1.2"
},
"engines": {
"node": ">= 0.4"
}
},
"node_modules/math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
"engines": {
"node": ">= 0.4"
}
},
"node_modules/mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": {
"mime-db": "1.52.0"
},
"engines": {
"node": ">= 0.6"
}
},
"node_modules/proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
}
},
"dependencies": {
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q=="
},
"axios": {
"version": "1.13.6",
"resolved": "https://registry.npmmirror.com/axios/-/axios-1.13.6.tgz",
"integrity": "sha512-ChTCHMouEe2kn713WHbQGcuYrr6fXTBiu460OTwWrWob16g1bXn4vtz07Ope7ewMozJAnEquLk5lWQWtBig9DQ==",
"requires": {
"follow-redirects": "^1.15.11",
"form-data": "^4.0.5",
"proxy-from-env": "^1.1.0"
}
},
"call-bind-apply-helpers": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
"requires": {
"es-errors": "^1.3.0",
"function-bind": "^1.1.2"
}
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ=="
},
"dunder-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/dunder-proto/-/dunder-proto-1.0.1.tgz",
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
"requires": {
"call-bind-apply-helpers": "^1.0.1",
"es-errors": "^1.3.0",
"gopd": "^1.2.0"
}
},
"es-define-property": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/es-define-property/-/es-define-property-1.0.1.tgz",
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="
},
"es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/es-errors/-/es-errors-1.3.0.tgz",
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="
},
"es-object-atoms": {
"version": "1.1.1",
"resolved": "https://registry.npmmirror.com/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
"requires": {
"es-errors": "^1.3.0"
}
},
"es-set-tostringtag": {
"version": "2.1.0",
"resolved": "https://registry.npmmirror.com/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
"requires": {
"es-errors": "^1.3.0",
"get-intrinsic": "^1.2.6",
"has-tostringtag": "^1.0.2",
"hasown": "^2.0.2"
}
},
"follow-redirects": {
"version": "1.15.11",
"resolved": "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.11.tgz",
"integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ=="
},
"form-data": {
"version": "4.0.5",
"resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.5.tgz",
"integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"es-set-tostringtag": "^2.1.0",
"hasown": "^2.0.2",
"mime-types": "^2.1.12"
}
},
"function-bind": {
"version": "1.1.2",
"resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz",
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="
},
"get-intrinsic": {
"version": "1.3.0",
"resolved": "https://registry.npmmirror.com/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
"requires": {
"call-bind-apply-helpers": "^1.0.2",
"es-define-property": "^1.0.1",
"es-errors": "^1.3.0",
"es-object-atoms": "^1.1.1",
"function-bind": "^1.1.2",
"get-proto": "^1.0.1",
"gopd": "^1.2.0",
"has-symbols": "^1.1.0",
"hasown": "^2.0.2",
"math-intrinsics": "^1.1.0"
}
},
"get-proto": {
"version": "1.0.1",
"resolved": "https://registry.npmmirror.com/get-proto/-/get-proto-1.0.1.tgz",
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
"requires": {
"dunder-proto": "^1.0.1",
"es-object-atoms": "^1.0.0"
}
},
"gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmmirror.com/gopd/-/gopd-1.2.0.tgz",
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="
},
"has-symbols": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/has-symbols/-/has-symbols-1.1.0.tgz",
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="
},
"has-tostringtag": {
"version": "1.0.2",
"resolved": "https://registry.npmmirror.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
"integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
"requires": {
"has-symbols": "^1.0.3"
}
},
"hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmmirror.com/hasown/-/hasown-2.0.2.tgz",
"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
"requires": {
"function-bind": "^1.1.2"
}
},
"math-intrinsics": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="
},
"mime-db": {
"version": "1.52.0",
"resolved": "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": {
"mime-db": "1.52.0"
}
},
"proxy-from-env": {
"version": "1.1.0",
"resolved": "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
}
}
}
FILE:package.json
{
"name": "rrbdagent",
"version": "1.0.0",
"description": "RRBD Admin项目智能助手技能",
"main": "index.js",
"scripts": {
"start": "node index.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"openclaw",
"skill",
"rrbd",
"api"
],
"author": "",
"license": "ISC",
"dependencies": {
"axios": "^1.6.2"
}
}
FILE:quick_check.js
const fs = require('fs');
const path = require('path');
const config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'), 'utf8'));
const API_BASE = config.apiBaseUrl || 'https://rrbd20.yzidea.net/api';
async function go() {
const login = await fetch(API_BASE + '/auth/login', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({username: config.username, password: config.password})
});
const data = await login.json();
const token = data.data.token;
const videos = await fetch(API_BASE + '/szr/video/page?pageNum=1&pageSize=10', {
headers: {'Authorization': 'Bearer ' + token}
});
const vdata = await videos.json();
const list = vdata.data.records || [];
console.log('=== 视频列表 ===');
for (let k = 0; k < list.length; k++) {
const v = list[k];
console.log((k+1) + '. ' + v.title + ' - ' + v.status);
if (v.videoUrl) console.log(' ' + v.videoUrl);
}
}
go().catch(console.error);
FILE:scripts/check_video_status.js
const fs = require('fs');
const path = require('path');
// 读取配置
const configPath = path.join(__dirname, '..', 'config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
const API_BASE = config.apiBaseUrl || 'https://rrbd20.yzidea.net/api';
async function checkVideoStatus() {
try {
// 1. 登录
console.log('正在登录...');
const loginResponse = await fetch(`API_BASE/auth/login`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
username: config.username,
password: config.password
})
});
if (!loginResponse.ok) {
throw new Error(`登录失败: loginResponse.status`);
}
const loginData = await loginResponse.json();
const token = loginData.data.token;
console.log('登录成功!');
// 2. 查看视频列表
console.log('\n正在获取视频列表...');
const videoListResponse = await fetch(`API_BASE/szr/video/page?pageNum=1&pageSize=10`, {
headers: {
'Authorization': `Bearer token`
}
});
if (!videoListResponse.ok) {
throw new Error(`获取视频列表失败: videoListResponse.status`);
}
const videoListData = await videoListResponse.json();
console.log('\n最近的视频:');
const videos = videoListData.data.records || [];
for (let i = 0; i < videos.length; i++) {
const video = videos[i];
console.log(`i + 1. video.title - video.status (video.id)`);
if (video.videoUrl) {
console.log(` 链接: video.videoUrl`);
}
}
} catch (error) {
console.error('错误:', error.message);
}
}
checkVideoStatus();
FILE:scripts/check_video_status.py
import requests
import json
import os
# 读取配置
config_path = os.path.join(os.path.dirname(__file__), '..', 'config.json')
with open(config_path, 'r', encoding='utf-8') as f:
config = json.load(f)
API_BASE = config.get('apiBaseUrl', 'https://rrbd20.yzidea.net/api')
def check_video_status():
try:
# 1. 登录
print('正在登录...')
login_response = requests.post(
f'{API_BASE}/auth/login',
json={
'username': config['username'],
'password': config['password']
}
)
login_response.raise_for_status()
login_data = login_response.json()
token = login_data['data']['token']
print('登录成功!')
# 2. 查看视频列表
print('\n正在获取视频列表...')
video_list_response = requests.get(
f'{API_BASE}/szr/video/page?pageNum=1&pageSize=10',
headers={'Authorization': f'Bearer {token}'}
)
video_list_response.raise_for_status()
video_list_data = video_list_response.json()
print('\n最近的视频:')
videos = video_list_data.get('data', {}).get('records', [])
for i, video in enumerate(videos, 1):
print(f"{i}. {video['title']} - {video['status']} ({video['id']})")
if video.get('videoUrl'):
print(f" 链接: {video['videoUrl']}")
except Exception as error:
print(f'错误: {error}')
if __name__ == '__main__':
check_video_status()
FILE:scripts/create_another_video.js
const RRBDAgent = require('../index');
async function main() {
console.log('='.repeat(60));
console.log('创建另一个视频');
console.log('='.repeat(60));
const agent = new RRBDAgent();
// 登录
console.log('\n1. 登录中...');
const username = '18098901246';
const password = '123456';
const loginSuccess = await agent.login(username, password);
if (!loginSuccess) {
console.log('❌ 登录失败!');
return;
}
console.log('✅ 登录成功!');
// 创建视频
const title = '一物一码让信任更简单_第二版';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n2. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
const result = await agent.createVideo(title, script);
if (result.success) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`视频URL: result.videoUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
} else {
console.log('\n❌ 视频创建失败!');
console.log(`失败原因: result.message`);
}
}
main().catch(console.error);
FILE:scripts/create_laozeng_video.js
const APIClient = require('../api_client');
async function main() {
console.log('步骤1: 开始创建视频');
const client = new APIClient();
console.log('步骤2: 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('步骤3: 登录成功!');
console.log('步骤4: 检查算力余额...');
const userInfo = await client.get_user_info();
const computingAmount = userInfo.data.computingAmount || 0;
console.log('当前算力余额: ' + computingAmount);
if (computingAmount < 100) {
console.log('算力不足!');
return;
}
console.log('步骤5: 算力检查通过!');
console.log('步骤6: 获取数字人列表...');
const virtualManList = await client.get_virtual_man_list();
let figureId = null;
if (virtualManList.data) {
if (Array.isArray(virtualManList.data) && virtualManList.data.length > 0) {
figureId = virtualManList.data[0].virtualmanId || virtualManList.data[0].id;
} else if (virtualManList.data.records && virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId || virtualManList.data.records[0].id;
}
}
console.log('选择数字人ID: ' + figureId);
console.log('步骤7: 获取声音列表...');
const voiceList = await client.get_voice_list();
let speakerId = null;
if (voiceList.data) {
if (Array.isArray(voiceList.data) && voiceList.data.length > 0) {
speakerId = voiceList.data[0].speakerId || voiceList.data[0].id;
} else if (voiceList.data.records && voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId || voiceList.data.records[0].id;
}
}
console.log('选择声音ID: ' + speakerId);
console.log('步骤8: 获取模板列表...');
const templateList = await client.get_template_list();
let templateId = null;
if (templateList.data && templateList.data.results && templateList.data.results.length > 0) {
templateId = templateList.data.results[0].id;
}
console.log('选择模板ID: ' + templateId);
console.log('步骤9: 创建视频...');
const title = '老曾大佬的视频标题';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
const result = await client.create_video(figureId, speakerId, script, templateId, title);
if (!result) {
console.log('视频创建失败!');
return;
}
console.log('步骤10: 视频创建任务已提交!');
let videoId = null;
if (result.data) {
if (typeof result.data === 'object') {
videoId = result.data.id || result.data.videoId;
} else {
videoId = result.data;
}
}
console.log('视频任务ID: ' + videoId);
console.log('\n视频创建任务已提交!请等待视频生成完成...');
}
main().catch(console.error);
FILE:scripts/create_video_custom_title.js
const RRBDAgent = require('../index');
async function main() {
console.log('='.repeat(60));
console.log('创建视频 - 自定义标题');
console.log('='.repeat(60));
const agent = new RRBDAgent();
// 登录
console.log('\n1. 登录中...');
const username = '18098901246';
const password = '123456';
const loginSuccess = await agent.login(username, password);
if (!loginSuccess) {
console.log('❌ 登录失败!');
return;
}
console.log('✅ 登录成功!');
// 创建视频
const title = '老曾测试标题';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n2. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
const result = await agent.createVideo(title, script);
if (result.success) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`视频URL: result.videoUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
} else {
console.log('\n❌ 视频创建失败!');
console.log(`失败原因: result.message`);
}
}
main().catch(console.error);
FILE:scripts/create_video_fixed.js
const RRBDAgent = require('../index');
async function main() {
console.log('='.repeat(60));
console.log('使用修复后的代码创建视频');
console.log('='.repeat(60));
const agent = new RRBDAgent();
// 登录
console.log('\n1. 登录中...');
const username = '18098901246';
const password = '123456';
const loginSuccess = await agent.login(username, password);
if (!loginSuccess) {
console.log('❌ 登录失败!');
return;
}
console.log('✅ 登录成功!');
// 创建视频
const title = '一物一码让信任更简单_修复版';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n2. 创建视频...');
console.log(` 标题: title`);
console.log(` 文案: script`);
const result = await agent.createVideo(title, script);
if (result.success) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`视频URL: result.videoUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
} else {
console.log('\n❌ 视频创建失败!');
console.log(`失败原因: result.message`);
}
}
main().catch(console.error);
FILE:scripts/generate_new_video.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成(新版本)');
console.log('='.repeat(60));
const client = new APIClient();
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('登录成功!');
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
const templateId = templateList.data.results[0].id;
console.log('选择模板ID: ' + templateId);
const figureId = '69b8cae9c5e4bb003015e51e';
console.log('\n3. 使用数字人ID: ' + figureId);
const speakerId = '69b8d16145109400309e85e7';
console.log('\n4. 使用声音ID: ' + speakerId);
const title = '老曾大佬的视频标题';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log('标题: ' + title);
console.log('文案: ' + script);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
console.log('创建结果:', JSON.stringify(createResult, null, 2));
if (createResult) {
console.log('\n视频创建任务已提交成功!');
}
}
main().catch(console.error);
FILE:scripts/get_videos_now.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('获取视频列表');
console.log('='.repeat(60));
const client = new APIClient();
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('登录成功!');
console.log('\n2. 获取视频列表...');
const videoList = await client.get_video_list(1, 10);
console.log('视频列表响应:', JSON.stringify(videoList, null, 2));
console.log('\n========== 视频列表 ==========');
let hasData = false;
if (videoList) {
if (videoList.data) {
hasData = true;
}
}
if (hasData) {
let records = [];
if (Array.isArray(videoList.data)) {
records = videoList.data;
} else if (videoList.data.records) {
records = videoList.data.records;
}
console.log('找到 ' + records.length + ' 个视频:\n');
for (let j = 0; j < records.length; j++) {
const video = records[j];
console.log((j+1) + '. ' + video.title + ' - ' + video.status);
if (video.videoFileUrl) {
console.log(' 链接: ' + video.videoFileUrl);
}
if (video.videoUrl) {
console.log(' 链接: ' + video.videoUrl);
}
console.log('');
}
}
}
main().catch(console.error);
FILE:scripts/just_get_videos.js
const APIClient = require('../api_client');
async function main() {
console.log('开始获取视频!');
const client = new APIClient();
console.log('1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('2. 登录成功!');
console.log('3. 获取视频列表...');
const videoList = await client.get_video_list(1, 10);
console.log('4. 收到响应!');
console.log('完整视频列表:', JSON.stringify(videoList, null, 2));
console.log('\n========== 视频列表 ==========');
if (videoList && videoList.data) {
let records = [];
if (Array.isArray(videoList.data)) {
records = videoList.data;
} else if (videoList.data.records) {
records = videoList.data.records;
}
console.log('找到 ' + records.length + ' 个视频:\n');
for (let j = 0; j < records.length; j++) {
const video = records[j];
console.log((j+1) + '. ' + video.title + ' - ' + video.status);
if (video.videoFileUrl) {
console.log(' 链接: ' + video.videoFileUrl);
}
if (video.videoUrl) {
console.log(' 链接: ' + video.videoUrl);
}
console.log('');
}
}
}
main().catch(function(err) {
console.error('出错了:', err);
});
FILE:scripts/laozeng_video.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('RRBD 视频生成(老曾大佬的视频标题)');
console.log('='.repeat(60));
const client = new APIClient();
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('登录成功!');
console.log('\n2. 获取模板列表...');
const templateList = await client.get_template_list();
const templateId = templateList.data.results[0].id;
console.log('选择模板ID: ' + templateId);
console.log('\n3. 获取数字人形象列表...');
const virtualManList = await client.get_virtual_man_list();
let figureId = null;
if (virtualManList.data) {
if (virtualManList.data.records) {
if (virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId;
if (!figureId) {
figureId = virtualManList.data.records[0].id;
}
}
}
}
console.log('选择数字人ID: ' + figureId);
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
let speakerId = null;
if (voiceList.data) {
if (voiceList.data.records) {
if (voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId;
if (!speakerId) {
speakerId = voiceList.data.records[0].id;
}
}
}
}
console.log('选择声音ID: ' + speakerId);
const title = '老曾大佬的视频标题';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
console.log('\n5. 创建视频...');
console.log('标题: ' + title);
console.log('文案: ' + script);
const createResult = await client.create_video(figureId, speakerId, script, templateId, title);
console.log('创建结果:', JSON.stringify(createResult, null, 2));
if (createResult) {
console.log('\n视频创建任务已提交成功!');
}
}
main().catch(console.error);
FILE:scripts/login_and_check.js
const https = require('https');
const fs = require('fs');
const path = require('path');
const configPath = path.join(__dirname, '../config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
const baseUrl = config.api.base_url;
const tenantId = config.api.tenant_id;
const username = config.login.default_username;
const password = config.login.default_password;
let token = null;
function makeRequest(url, method = 'GET', data = null, authToken = null) {
return new Promise((resolve, reject) => {
const urlObj = new URL(url);
const headers = {
'Content-Type': 'application/json',
'X-Tenant-ID': tenantId
};
if (authToken) {
headers['Authorization'] = authToken;
}
const options = {
hostname: urlObj.hostname,
path: urlObj.pathname + urlObj.search,
method: method,
headers: headers
};
const req = https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => {
try {
resolve(JSON.parse(body));
} catch (e) {
resolve(body);
}
});
});
req.on('error', reject);
if (data) {
req.write(JSON.stringify(data));
}
req.end();
});
}
async function login() {
console.log('正在登录...');
const url = baseUrl + config.endpoints.login;
const data = { mobile: username, password: password };
const response = await makeRequest(url, 'POST', data);
if (response && (response.code === 200 || response.code === 0)) {
if (response.data && response.data.token) {
token = response.data.token;
console.log('登录成功!');
return true;
}
}
console.log('登录失败:', response);
return false;
}
async function getVideoList() {
console.log('正在获取视频列表...');
const url = baseUrl + config.endpoints.video_list + '?pageNum=1&pageSize=15';
return await makeRequest(url, 'GET', null, token);
}
async function main() {
console.log('='.repeat(60));
// 登录
if (!await login()) {
return;
}
console.log('='.repeat(60));
// 获取视频列表
const videoList = await getVideoList();
if (videoList && videoList.data) {
const data = videoList.data;
if (data.records) {
console.log(`\n找到 data.records.length 个视频:`);
console.log('='.repeat(60));
for (let j = 0; j < Math.min(data.records.length, 10); j++) {
const video = data.records[j];
console.log(`\nj+1. 标题: video.title`);
console.log(` 状态: video.status`);
console.log(` 创建时间: video.createDate`);
if (video.videoFileUrl) {
console.log(` 视频URL: video.videoFileUrl`);
}
console.log('-'.repeat(60));
if (video.title === '一物一码让信任更简单') {
if (video.status === 'succeed' && video.videoFileUrl) {
console.log('\n🎉' + '='.repeat(50) + '🎉');
console.log('视频创建成功!');
console.log(`视频URL: video.videoFileUrl`);
console.log('🎉' + '='.repeat(50) + '🎉');
}
}
}
}
}
}
main().catch(console.error);
FILE:scripts/make_video_now.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('创建视频: 老曾大佬的视频标题');
console.log('='.repeat(60));
const client = new APIClient();
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('登录成功!');
console.log('\n2. 获取数字人列表...');
const virtualManList = await client.get_virtual_man_list();
let figureId = null;
if (virtualManList.data) {
if (virtualManList.data.records) {
if (virtualManList.data.records.length > 0) {
figureId = virtualManList.data.records[0].virtualmanId;
if (!figureId) {
figureId = virtualManList.data.records[0].id;
}
}
}
}
console.log('数字人ID: ' + figureId);
console.log('\n3. 获取声音列表...');
const voiceList = await client.get_voice_list();
let speakerId = null;
if (voiceList.data) {
if (voiceList.data.records) {
if (voiceList.data.records.length > 0) {
speakerId = voiceList.data.records[0].speakerId;
if (!speakerId) {
speakerId = voiceList.data.records[0].id;
}
}
}
}
console.log('声音ID: ' + speakerId);
console.log('\n4. 获取模板列表...');
const templateList = await client.get_template_list();
let templateId = null;
if (templateList.data) {
if (templateList.data.results) {
if (templateList.data.results.length > 0) {
templateId = templateList.data.results[0].id;
}
}
}
console.log('模板ID: ' + templateId);
console.log('\n5. 创建视频...');
const title = '老曾大佬的视频标题';
const script = '一物一码让信任更简单!未来随着技术的不断发展,"一物一码" 将会在更多领域发挥更大的作用,为消费者创造更安全、更便捷、更美好的生活体验。赶快行动起来,体验 "一物一码" 带来的便捷与安心!';
const result = await client.create_video(figureId, speakerId, script, templateId, title);
console.log('创建结果:', JSON.stringify(result, null, 2));
if (result) {
console.log('\n视频创建任务已提交成功!');
}
}
main().catch(console.error);
FILE:scripts/quick_check.js
const https = require('https');
const fs = require('fs');
const path = require('path');
const configPath = path.join(__dirname, '../config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
const baseUrl = config.api.base_url;
const tenantId = config.api.tenant_id;
const username = config.login.default_username;
const password = config.login.default_password;
// Step 1: Login
console.log('1. 登录中...');
const loginUrl = new URL(baseUrl + config.endpoints.login);
const loginData = JSON.stringify({ mobile: username, password: password });
const loginOptions = {
hostname: loginUrl.hostname,
path: loginUrl.pathname,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Tenant-ID': tenantId,
'Content-Length': Buffer.byteLength(loginData)
}
};
const loginReq = https.request(loginOptions, (loginRes) => {
let loginBody = '';
loginRes.on('data', (chunk) => loginBody += chunk);
loginRes.on('end', () => {
const loginResult = JSON.parse(loginBody);
console.log('登录响应:', loginBody);
if (loginResult.data && loginResult.data.token) {
const token = loginResult.data.token;
console.log('Token 获取成功!');
// Step 2: Get video list
console.log('\n2. 获取视频列表...');
const videoUrl = new URL(baseUrl + config.endpoints.video_list + '?pageNum=1&pageSize=15');
const videoOptions = {
hostname: videoUrl.hostname,
path: videoUrl.pathname + videoUrl.search,
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': token,
'X-Tenant-ID': tenantId
}
};
const videoReq = https.request(videoOptions, (videoRes) => {
let videoBody = '';
videoRes.on('data', (chunk) => videoBody += chunk);
videoRes.on('end', () => {
console.log('视频列表响应:', videoBody);
const videoResult = JSON.parse(videoBody);
if (videoResult.data && videoResult.data.records) {
console.log('\n找到', videoResult.data.records.length, '个视频:');
videoResult.data.records.slice(0, 5).forEach((video, i) => {
console.log(`\ni+1. 标题: video.title`);
console.log(` 状态: video.status`);
if (video.videoFileUrl) {
console.log(` URL: video.videoFileUrl`);
}
});
}
});
});
videoReq.on('error', (e) => console.error('视频列表请求错误:', e));
videoReq.end();
}
});
});
loginReq.on('error', (e) => console.error('登录请求错误:', e));
loginReq.write(loginData);
loginReq.end();
FILE:scripts/show_me_videos.js
const https = require('https');
const fs = require('fs');
const path = require('path');
const configPath = path.join(__dirname, '../config.json');
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
const baseUrl = config.api.base_url;
const tenantId = config.api.tenant_id;
const username = config.login.default_username;
const password = config.login.default_password;
let token = null;
function makeRequest(url, method = 'GET', data = null, authToken = null) {
return new Promise((resolve, reject) => {
const urlObj = new URL(url);
const headers = {
'Content-Type': 'application/json',
'X-Tenant-ID': tenantId
};
if (authToken) {
headers['Authorization'] = authToken;
}
const options = {
hostname: urlObj.hostname,
path: urlObj.pathname + urlObj.search,
method: method,
headers: headers
};
const req = https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => {
try {
resolve(JSON.parse(body));
} catch (e) {
resolve(body);
}
});
});
req.on('error', reject);
if (data) {
req.write(JSON.stringify(data));
}
req.end();
});
}
async function login() {
console.log('步骤1: 正在登录...');
const url = baseUrl + config.endpoints.login;
const data = { mobile: username, password: password };
const response = await makeRequest(url, 'POST', data);
if (response && (response.code === 200 || response.code === 0)) {
if (response.data && response.data.token) {
token = response.data.token;
console.log('步骤2: 登录成功!');
return true;
}
}
console.log('登录失败:', response);
return false;
}
async function getVideoList() {
console.log('步骤3: 正在获取视频列表...');
const url = baseUrl + config.endpoints.video_list + '?pageNum=1&pageSize=15';
return await makeRequest(url, 'GET', null, token);
}
async function main() {
console.log('开始检查视频状态!\n');
if (!await login()) {
return;
}
const videoList = await getVideoList();
console.log('\n步骤4: 收到视频列表响应!');
console.log('完整响应:', JSON.stringify(videoList, null, 2));
console.log('\n========== 视频列表 ==========');
if (videoList && videoList.data) {
const data = videoList.data;
if (data.records) {
console.log(`找到 data.records.length 个视频!\n`);
for (let j = 0; j < data.records.length; j++) {
const video = data.records[j];
console.log(`j+1. 【video.title】`);
console.log(` 状态: video.status`);
if (video.videoFileUrl) {
console.log(` 链接: video.videoFileUrl`);
}
if (video.videoUrl) {
console.log(` 链接2: video.videoUrl`);
}
console.log('');
}
}
}
}
main().catch(err => {
console.error('出错了:', err);
});
FILE:scripts/test_fixed_code.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('测试修复后的代码');
console.log('='.repeat(60));
// 初始化 API 客户端
const client = new APIClient();
// 登录
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('❌ 登录失败!');
return;
}
console.log('✅ 登录成功!');
// 获取用户信息,检查算力
console.log('\n2. 获取用户信息...');
const userInfo = await client.get_user_info();
if (userInfo && userInfo.data) {
const computingAmount = userInfo.data.computingAmount || 0;
console.log(` 算力余额: computingAmount`);
if (computingAmount >= 100) {
console.log('✅ 算力充足!');
} else {
console.log('❌ 算力不足!');
}
}
// 获取数字人列表,检查 virtualmanId
console.log('\n3. 获取数字人列表...');
const virtualManList = await client.get_virtual_man_list();
if (virtualManList && virtualManList.data) {
let records = [];
if (Array.isArray(virtualManList.data)) {
records = virtualManList.data;
} else if (virtualManList.data.records) {
records = virtualManList.data.records;
}
if (records.length > 0) {
const firstVirtualMan = records[0];
console.log(` 数字人名称: firstVirtualMan.name`);
console.log(` id 字段: firstVirtualMan.id`);
console.log(` virtualmanId 字段: firstVirtualMan.virtualmanId`);
console.log('✅ 找到数字人!');
}
}
// 获取声音列表,检查 speakerId
console.log('\n4. 获取声音列表...');
const voiceList = await client.get_voice_list();
if (voiceList && voiceList.data) {
let records = [];
if (Array.isArray(voiceList.data)) {
records = voiceList.data;
} else if (voiceList.data.records) {
records = voiceList.data.records;
}
if (records.length > 0) {
const firstVoice = records[0];
console.log(` 声音名称: firstVoice.name`);
console.log(` id 字段: firstVoice.id`);
console.log(` speakerId 字段: firstVoice.speakerId`);
console.log('✅ 找到声音!');
}
}
console.log('\n' + '='.repeat(60));
console.log('测试完成!代码修复正确!');
console.log('='.repeat(60));
}
main().catch(console.error);
FILE:scripts/test_szr_api.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('测试 SZR 前缀 API');
console.log('='.repeat(60));
// 初始化 API 客户端
const client = new APIClient();
// 登录
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
console.log(` 账号: username`);
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('❌ 登录失败!');
return;
}
console.log('✅ 登录成功!');
// 获取用户信息
console.log('\n2. 获取用户信息...');
const userInfo = await client.get_user_info();
console.log('用户信息响应:', JSON.stringify(userInfo, null, 2));
// 用 SZR 前缀的 API 手动获取数字人列表
console.log('\n3. 手动获取数字人列表 (szr 前缀)...');
const https = require('https');
const url = new URL(client.base_url + '/digital/szrVirtualMan/page');
const headers = {
'Content-Type': 'application/json',
'Authorization': client.token,
'X-Tenant-ID': client.tenant_id
};
const params = {
'pageNum': 1,
'pageSize': 100
};
url.search = new URLSearchParams(params).toString();
const options = {
hostname: url.hostname,
path: url.pathname + url.search,
method: 'GET',
headers: headers
};
const virtualManResult = await new Promise((resolve, reject) => {
const req = https.request(options, (res) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => {
try {
resolve(JSON.parse(body));
} catch (e) {
resolve(body);
}
});
});
req.on('error', reject);
req.end();
});
console.log('数字人列表 (szr 前缀):', JSON.stringify(virtualManResult, null, 2));
// 获取声音列表 (szr 前缀)
console.log('\n4. 手动获取声音列表 (szr 前缀)...');
const voiceUrl = new URL(client.base_url + '/digital/szrVoice/page');
voiceUrl.search = new URLSearchParams(params).toString();
const voiceOptions = {
hostname: voiceUrl.hostname,
path: voiceUrl.pathname + voiceUrl.search,
method: 'GET',
headers: headers
};
const voiceResult = await new Promise((resolve, reject) => {
const req = https.request(voiceOptions, (res) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => {
try {
resolve(JSON.parse(body));
} catch (e) {
resolve(body);
}
});
});
req.on('error', reject);
req.end();
});
console.log('声音列表 (szr 前缀):', JSON.stringify(voiceResult, null, 2));
// 获取模板列表 (szr 前缀)
console.log('\n5. 手动获取模板列表 (szr 前缀)...');
const templateUrl = new URL(client.base_url + '/digital/szrVideo/clipTemplate');
const templateParams = {
'pageNum': 1,
'pageSize': 100,
'scene': 'virtualman'
};
templateUrl.search = new URLSearchParams(templateParams).toString();
const templateOptions = {
hostname: templateUrl.hostname,
path: templateUrl.pathname + templateUrl.search,
method: 'GET',
headers: headers
};
const templateResult = await new Promise((resolve, reject) => {
const req = https.request(templateOptions, (res) => {
let body = '';
res.on('data', (chunk) => body += chunk);
res.on('end', () => {
try {
resolve(JSON.parse(body));
} catch (e) {
resolve(body);
}
});
});
req.on('error', reject);
req.end();
});
console.log('模板列表 (szr 前缀):', JSON.stringify(templateResult, null, 2));
}
main().catch(console.error);
FILE:scripts/videos_please.js
const APIClient = require('../api_client');
async function main() {
console.log('='.repeat(60));
console.log('获取视频列表');
console.log('='.repeat(60));
const client = new APIClient();
console.log('\n1. 登录中...');
const username = client.config.login.default_username;
const password = client.config.login.default_password;
const loginResult = await client.login(username, password);
if (!loginResult) {
console.log('登录失败!');
return;
}
console.log('登录成功!');
console.log('\n2. 获取视频列表...');
const videoList = await client.get_video_list(1, 10);
console.log('视频列表响应:', JSON.stringify(videoList, null, 2));
}
main().catch(console.error);