完善 Rust SDK:中文化文档和注释,添加多个测试示例
- 翻译所有文档和注释为中文(README.md, CHANGELOG.md, API文档等) - 修复 reqwest TLS 支持问题,添加 rustls-tls 功能 - 新增5个测试示例: * health_check.rs - 基础健康检查 * llm_chat_test.rs - LLM聊天功能测试 * midjourney_image_test.rs - Midjourney图像生成测试 * file_upload_test.rs - 文件上传和媒体分析测试 * comprehensive_test.rs - 综合功能测试 - 添加测试脚本(PowerShell和Bash版本) - 验证API功能正常:LLM聊天、图像生成、健康检查等
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
# Text Video Agent Client
|
||||
# 文本视频智能体客户端
|
||||
|
||||
[](https://crates.io/crates/text_video_agent_client)
|
||||
[](https://docs.rs/text_video_agent_client)
|
||||
[](https://github.com/your-repo/text-video-agent-rust-sdk)
|
||||
[](https://docs.rs/text_video_agent_client)
|
||||
[](https://github.com/your-repo/text-video-agent-rust-sdk)
|
||||
|
||||
A comprehensive Rust client for the Text Video Agent API - an AI content generation service that supports:
|
||||
一个全面的 Rust 客户端,用于文本视频智能体 API - 一个支持以下功能的 AI 内容生成服务:
|
||||
|
||||
- 🎨 **Image Generation** - Multiple AI models (Midjourney, Stable Diffusion, etc.)
|
||||
- 🎬 **Video Generation** - Text-to-video and image-to-video conversion
|
||||
- 🎵 **Audio Synthesis** - Text-to-speech and voice cloning
|
||||
- 💋 **Lip Sync** - Advanced lip synchronization with Hedra
|
||||
- 🤖 **Digital Human** - Create and animate digital avatars
|
||||
- 🧠 **LLM Integration** - Multi-modal AI analysis and inference
|
||||
- 🔧 **Workflow Automation** - ComfyUI workflow execution
|
||||
- 🎨 **图像生成** - 多种 AI 模型(Midjourney、Stable Diffusion 等)
|
||||
- 🎬 **视频生成** - 文本转视频和图像转视频
|
||||
- 🎵 **音频合成** - 文本转语音和声音克隆
|
||||
- 💋 **唇形同步** - 使用 Hedra 的高级唇形同步技术
|
||||
- 🤖 **数字人** - 创建和动画数字化身
|
||||
- 🧠 **大语言模型集成** - 多模态 AI 分析和推理
|
||||
- 🔧 **工作流自动化** - ComfyUI 工作流执行
|
||||
|
||||
## Features
|
||||
## 特性
|
||||
|
||||
- **Type-safe API** - Generated from OpenAPI 3.1 specification
|
||||
- **Async/await support** - Built on `reqwest` and `tokio`
|
||||
- **Comprehensive coverage** - All API endpoints included
|
||||
- **File upload support** - Multipart form data handling
|
||||
- **Error handling** - Structured error responses
|
||||
- **Documentation** - Complete API documentation
|
||||
- **类型安全的 API** - 从 OpenAPI 3.1 规范生成
|
||||
- **异步/等待支持** - 基于 `reqwest` 和 `tokio` 构建
|
||||
- **全面覆盖** - 包含所有 API 端点
|
||||
- **文件上传支持** - 多部分表单数据处理
|
||||
- **错误处理** - 结构化错误响应
|
||||
- **文档** - 完整的 API 文档
|
||||
|
||||
## Installation
|
||||
## 安装
|
||||
|
||||
Add this to your `Cargo.toml`:
|
||||
将以下内容添加到您的 `Cargo.toml`:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
@@ -33,7 +33,7 @@ text_video_agent_client = "1.0.6"
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
## 快速开始
|
||||
|
||||
```rust
|
||||
use text_video_agent_client::{apis::configuration::Configuration, apis::default_api};
|
||||
@@ -45,30 +45,30 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Generate an image
|
||||
// 生成图像
|
||||
let response = default_api::submit_image_task_api_custom_image_submit_task_post(
|
||||
&config,
|
||||
// Add your parameters here
|
||||
// 在此处添加您的参数
|
||||
).await?;
|
||||
|
||||
println!("Task submitted: {:?}", response);
|
||||
println!("任务已提交: {:?}", response);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
## API Overview
|
||||
## API 概览
|
||||
|
||||
This client was generated from the Text Video Agent API specification and provides access to all available endpoints:
|
||||
此客户端是从文本视频智能体 API 规范生成的,提供对所有可用端点的访问:
|
||||
|
||||
- **API version**: 1.0.6
|
||||
- **Package version**: 1.0.6
|
||||
- **Generated with**: OpenAPI Generator 7.14.0
|
||||
- **API 版本**: 1.0.6
|
||||
- **包版本**: 1.0.6
|
||||
- **生成工具**: OpenAPI Generator 7.14.0
|
||||
|
||||
## Documentation for API Endpoints
|
||||
## API 端点文档
|
||||
|
||||
All URIs are relative to *http://localhost*
|
||||
所有 URI 都相对于 *http://localhost*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
类 | 方法 | HTTP 请求 | 描述
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*DefaultApi* | [**check_template_task_type_api_template_check_task_type_get**](docs/DefaultApi.md#check_template_task_type_api_template_check_task_type_get) | **GET** /api/template/check/task_type | 检查任务类型是否可用
|
||||
*DefaultApi* | [**create_higgsfield_character_api_custom_extend_higgsfield_create_character_post**](docs/DefaultApi.md#create_higgsfield_character_api_custom_extend_higgsfield_create_character_post) | **POST** /api/custom/extend/higgsfield/create/character | 提交创建生成角色任务
|
||||
@@ -163,114 +163,180 @@ Class | Method | HTTP request | Description
|
||||
*OmniHumanApi* | [**submit_video_generate_task_api_ark_omnihuman_video_submit_task_post**](docs/OmniHumanApi.md#submit_video_generate_task_api_ark_omnihuman_video_submit_task_post) | **POST** /api/ark/omnihuman/video/submit/task | 提交视频生成任务
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
## 模型文档
|
||||
|
||||
- [FileUploadResponse](docs/FileUploadResponse.md)
|
||||
- [HttpValidationError](docs/HttpValidationError.md)
|
||||
- [TaskRequest](docs/TaskRequest.md)
|
||||
- [ValidationError](docs/ValidationError.md)
|
||||
- [ValidationErrorLocInner](docs/ValidationErrorLocInner.md)
|
||||
- [FileUploadResponse](docs/FileUploadResponse.md) - 文件上传响应
|
||||
- [HttpValidationError](docs/HttpValidationError.md) - HTTP 验证错误
|
||||
- [TaskRequest](docs/TaskRequest.md) - 任务请求
|
||||
- [ValidationError](docs/ValidationError.md) - 验证错误
|
||||
- [ValidationErrorLocInner](docs/ValidationErrorLocInner.md) - 验证错误位置内部
|
||||
|
||||
|
||||
## Examples
|
||||
## 示例
|
||||
|
||||
### Image Generation
|
||||
### 快速开始 - 健康检查
|
||||
|
||||
```rust
|
||||
use text_video_agent_client::{apis::configuration::Configuration, apis::default_api};
|
||||
use text_video_agent_client::apis::configuration::Configuration;
|
||||
use text_video_agent_client::apis::{default_api, llm_api};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Configuration::default();
|
||||
let config = Configuration {
|
||||
base_path: "https://bowongai-dev--text-video-agent-fastapi-app.modal.run".to_string(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// Submit image generation task
|
||||
let response = default_api::submit_image_task_api_custom_image_submit_task_post(
|
||||
&config,
|
||||
// Add your parameters
|
||||
).await?;
|
||||
// 测试连接
|
||||
let response = default_api::root_get(&config).await?;
|
||||
println!("连接成功: {}", response);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
### Video Generation
|
||||
|
||||
```rust
|
||||
use text_video_agent_client::{apis::configuration::Configuration, apis::default_api};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Configuration::default();
|
||||
|
||||
// Submit video generation task
|
||||
let response = default_api::submit_video_task_api_custom_video_submit_task_post(
|
||||
&config,
|
||||
// Add your parameters
|
||||
).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
### LLM Integration
|
||||
|
||||
```rust
|
||||
use text_video_agent_client::{apis::configuration::Configuration, apis::llm_api};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Configuration::default();
|
||||
|
||||
// Get supported models
|
||||
// 获取支持的模型
|
||||
let models = llm_api::llm_supported_models(&config).await?;
|
||||
println!("Available models: {:?}", models);
|
||||
println!("可用模型: {}", models);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
## API Categories
|
||||
### LLM 聊天
|
||||
|
||||
The client provides access to the following API categories:
|
||||
```rust
|
||||
use text_video_agent_client::apis::{configuration::Configuration, llm_api};
|
||||
|
||||
- **DefaultApi** - Core functionality (templates, file upload, health checks)
|
||||
- **ApiApi** - Task management and basic operations
|
||||
- **Class302Api** - 302AI integration services
|
||||
- **Class302aiApiApi** - 302AI JiMeng video generation
|
||||
- **Class302aiMidjourneyApi** - 302AI Midjourney integration
|
||||
- **Class302aiVeoApi** - 302AI VEO video generation
|
||||
- **ComfyuiApi** - ComfyUI workflow execution
|
||||
- **Hedra20Api** - Hedra 2.0 lip sync services
|
||||
- **Hedra30Api** - Hedra 3.0 lip sync services
|
||||
- **LlmApi** - Large Language Model integration
|
||||
- **MidjourneyApi** - Midjourney image generation
|
||||
- **MidjourneyapiApi** - Midjourney video generation
|
||||
- **OmniHumanApi** - Digital human services
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Configuration {
|
||||
base_path: "https://bowongai-dev--text-video-agent-fastapi-app.modal.run".to_string(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
## Documentation
|
||||
// LLM 聊天
|
||||
let response = llm_api::llm_chat(
|
||||
&config,
|
||||
"你好,请介绍一下你自己",
|
||||
None, // model_name
|
||||
Some(0.7), // temperature
|
||||
Some(1000), // max_tokens
|
||||
Some(30.0), // timeout
|
||||
).await?;
|
||||
|
||||
To access the complete API documentation:
|
||||
println!("AI 回复: {}", response);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
### Midjourney 图像生成
|
||||
|
||||
```rust
|
||||
use text_video_agent_client::apis::{configuration::Configuration, midjourney_api};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let config = Configuration {
|
||||
base_path: "https://bowongai-dev--text-video-agent-fastapi-app.modal.run".to_string(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
// 异步图像生成
|
||||
let response = midjourney_api::async_gen_image_api_mj_async_generate_image_post(
|
||||
&config,
|
||||
"a beautiful sunset over mountains, digital art",
|
||||
None, // img_file
|
||||
).await?;
|
||||
|
||||
println!("图像生成任务: {}", response);
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
## 运行测试示例
|
||||
|
||||
我们提供了多个测试示例来验证 API 功能:
|
||||
|
||||
### 使用测试脚本(推荐)
|
||||
|
||||
**Windows (PowerShell):**
|
||||
```powershell
|
||||
cd cargos/text-video-agent-rust-sdk
|
||||
.\run_tests.ps1
|
||||
```
|
||||
|
||||
**Linux/macOS (Bash):**
|
||||
```bash
|
||||
cd cargos/text-video-agent-rust-sdk
|
||||
./run_tests.sh
|
||||
```
|
||||
|
||||
### 手动运行单个测试
|
||||
|
||||
```bash
|
||||
# 健康检查测试
|
||||
cargo run --example health_check
|
||||
|
||||
# LLM 聊天测试
|
||||
cargo run --example llm_chat_test
|
||||
|
||||
# Midjourney 图像生成测试
|
||||
cargo run --example midjourney_image_test
|
||||
|
||||
# 文件上传和媒体分析测试
|
||||
cargo run --example file_upload_test
|
||||
|
||||
# 综合功能测试
|
||||
cargo run --example comprehensive_test
|
||||
```
|
||||
|
||||
### 测试示例说明
|
||||
|
||||
1. **health_check.rs** - 基础健康检查,验证 API 连接和服务状态
|
||||
2. **llm_chat_test.rs** - 测试大语言模型聊天功能,包括交互式聊天
|
||||
3. **midjourney_image_test.rs** - 测试 Midjourney 图像生成功能
|
||||
4. **file_upload_test.rs** - 测试文件上传和媒体分析功能
|
||||
5. **comprehensive_test.rs** - 综合测试,包含性能测试和结果汇总
|
||||
|
||||
## API 分类
|
||||
|
||||
客户端提供对以下 API 分类的访问:
|
||||
|
||||
- **DefaultApi** - 核心功能(模板、文件上传、健康检查)
|
||||
- **ApiApi** - 任务管理和基本操作
|
||||
- **Class302Api** - 302AI 集成服务
|
||||
- **Class302aiApiApi** - 302AI 即梦视频生成
|
||||
- **Class302aiMidjourneyApi** - 302AI Midjourney 集成
|
||||
- **Class302aiVeoApi** - 302AI VEO 视频生成
|
||||
- **ComfyuiApi** - ComfyUI 工作流执行
|
||||
- **Hedra20Api** - Hedra 2.0 唇形同步服务
|
||||
- **Hedra30Api** - Hedra 3.0 唇形同步服务
|
||||
- **LlmApi** - 大语言模型集成
|
||||
- **MidjourneyApi** - Midjourney 图像生成
|
||||
- **MidjourneyapiApi** - Midjourney 视频生成
|
||||
- **OmniHumanApi** - 数字人服务
|
||||
|
||||
## 文档
|
||||
|
||||
要访问完整的 API 文档:
|
||||
|
||||
```bash
|
||||
cargo doc --open
|
||||
```
|
||||
|
||||
Or visit [docs.rs/text_video_agent_client](https://docs.rs/text_video_agent_client)
|
||||
或访问 [docs.rs/text_video_agent_client](https://docs.rs/text_video_agent_client)
|
||||
|
||||
## Contributing
|
||||
## 贡献
|
||||
|
||||
This client is auto-generated from the OpenAPI specification. For issues related to the API itself, please contact the API provider. For issues with this Rust client, please open an issue in the repository.
|
||||
此客户端是从 OpenAPI 规范自动生成的。对于与 API 本身相关的问题,请联系 API 提供商。对于此 Rust 客户端的问题,请在仓库中提交 issue。
|
||||
|
||||
## License
|
||||
## 许可证
|
||||
|
||||
Licensed under either of
|
||||
根据以下任一许可证授权:
|
||||
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) 或 http://www.apache.org/licenses/LICENSE-2.0)
|
||||
- MIT license ([LICENSE-MIT](LICENSE-MIT) 或 http://opensource.org/licenses/MIT)
|
||||
|
||||
at your option.
|
||||
您可以选择其中任何一个。
|
||||
|
||||
## Author
|
||||
## 作者
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user